JGraphpad Pro
v6.0.5.0


com.jgraph
Class JGraphpad

java.lang.Object
  extended bycom.jgraph.JGraphpad
Direct Known Subclasses:
JGraphpadDemo

public class JGraphpad
extends Object

Class that constructs a new editor by creating a custom document model, kit and factory. The document model defines the persistence delegates for xml encoding, the kit and factory contain tools, actions and factory methods respectively. The class also constructs all plugins and provides the methods for creating the custom graph, graph cells and user objects to be used in this editor and to exit the application. For this purpose it provides two inner anonymous classes which override the respective methods, namely JGraphEditor.exit(int) and JGraphEditorFactory.createGraph(GraphLayoutCache) editor's exit method and the factory's createGraph method.


Field Summary
static String APPTITLE
          Holds the application title for dialogs.
static String ARG_JGOODIESLOOKANDFEEL
          Defines the look and feel argument name.
static String ARG_SYSTEMLOOKANDFEEL
          Defines the look and feel argument name.
static String ARG_VERSION
          Defines the look and feel argument name.
 int defaultBeginDecoration
          Defines the default end and begin decorations for edges.
 Color defaultBorderColor
          Defines the default border color.
 Rectangle2D defaultBounds
          Defines the default vertex bounds.
 Font defaultEdgeFont
          Defines the default edge font.
 int defaultEndDecoration
          Defines the default end and begin decorations for edges.
 String[] defaultPlugins
          The class names for the defaut plugins.
 Point2D[] defaultPortLocations
          Defines the default port locations.
static boolean INNER_LIBRARIES
          Specifies if libraries should reside inside documents.
static String KEY_EDGEPROTOTYPE
          Defines the key used to identify the edge prototype settings.
static String KEY_GROUPPROTOTYPE
          Defines the key used to identify the group prototype settings.
static String KEY_MAINWINDOW
          Defines the key used to identify the main window settings.
static String KEY_RECENTFILES
          Defines the key used to identify the recent files settings.
static String KEY_VERTEXPROTOTYPE
          Defines the key used to identify the vertex prototype settings.
static String METHOD_CREATEGRADIENTCOMBO
          Defines the name of the createGradientCombo factory method.
static String METHOD_CREATELINECOLORCOMBO
          Defines the name of the createGradientCombo factory method.
static String METHOD_CREATESHAPECOMBO
          Defines the name of the createShapeCombo factory method.
static String NAME_CIRCLETOOL
          Defines the name for the circleTool.
static String NAME_CYLINDERTOOL
          Defines the name for the diamondTool.
static String NAME_DIAMONDTOOL
          Defines the name for the diamondTool.
static String NAME_EDGETOOL
          Defines the name for the edgeTool.
static String NAME_HEAVYTOOL
          Defines the name for the imageTool.
static String NAME_IMAGETOOL
          Defines the name for the imageTool.
static String NAME_ORTHOGONALEDGETOOL
          Defines the name for the orthogonalEdgeTool.
static String NAME_ROUNDEDTOOL
          Defines the name for the roundedTool.
static String NAME_SELECTTOOL
          Defines the name for the selectTool.
static String NAME_SETTINGSFILE
          Defines the filename for the settings file.
static String NAME_TEXTTOOL
          Defines the name for the textTool.
static String NAME_TRIANGLETOOL
          Defines the name for the triangleTool.
static String NAME_UICONFIG
          Defines the name for the ui XML document in the editor settings.
static String NAME_USERSETTINGS
          Defines the name for the user properties in the editor settings.
static String NAME_VERTEXTOOL
          Defines the name for the vertexTool.
static String PATH_DEFAULTLIBRARY
          Defines the path to the UI config file.
static String PATH_DEFAULTSETTINGS
          Defines the path the the user settings file.
static String PATH_SPLASHIMAGE
          Defines the path to the splash image file.
static String PATH_UICONFIG
          Defines the path to the UI config file.
static String PATH_USERSETTINGS
          Defines the path the the user settings file.
static String USAGE
          Defines the usage information (use --help), see http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html#programmatic on setting the look and feel.
static String VERSION
          Global static product identifier.
static String VERSION_NUMBER
          Global static product identifier.
 
Constructor Summary
JGraphpad()
          Constructs JGraphpad as an applet.
 
Method Summary
protected  void addActions(JGraphEditor editor, JGraphEditorKit kit)
          Adds the action bundles for JGraphpadEditAction, JGraphpadFileAction,JGraphpadViewAction, JGraphpadFormatActionand JGraphpadCellAction.
protected  void addPorts(MutableTreeNode parent, Point2D[] offsets)
          Adds ports to parent using offsets as the port relative offsets.
protected  void addTools(JGraphEditor editor, JGraphEditorKit kit)
          Adds the following tools to kit:NAME_SELECTTOOL, NAME_VERTEXTOOL,NAME_ROUNDEDTOOL, NAME_CIRCLETOOL,NAME_DIAMONDTOOL,NAME_TRIANGLETOOL, NAME_IMAGETOOL,NAME_HEAVYTOOL,NAME_EDGETOOLand NAME_ORTHOGONALEDGETOOL.
static void center(Window wnd)
          Centers the specified window on the screen, taking into account the current size of the window.
protected  void configureEdge(org.jgraph.graph.GraphCell edge)
          Hook for subclassers to configure the specified edge.
protected  void configureEditor(JGraphEditor editor, Map args)
          Hook for subclassers to configure new editors.
protected  void configureFactory(JGraphEditor editor, JGraphEditorFactory factory)
          Hook for subclassers to configure new editor factories.
protected  void configureGraph(JGraphEditor editor, org.jgraph.JGraph graph)
          Hook for subclassers to configure a new graph.
protected  void configureKit(JGraphEditor editor, JGraphEditorKit kit)
          Boilerplate method for configuring new editor kits.
protected  void configureModel(JGraphEditorModel model)
          Hook for subclassers to configure new document models.
 void configurePort(org.jgraph.graph.GraphCell port, Point2D offset)
          Hook for subclassers to configure the specified port using the offset as the relative location.
protected  void configureSettings(JGraphEditorSettings settings)
          Hook for subclassers to configure new editor settings.
protected  void configureVertex(org.jgraph.graph.GraphCell vertex)
          Hook for subclassers to configure the specified vertex.
 Window createApplication(List files, Map args)
          Constructs a new editor application and returns its main window.
protected  org.jgraph.graph.AttributeMap createAttributeMap()
          Hook for subclassers to construct attribute map for cells.
 org.jgraph.graph.DefaultEdge createEdge()
          Hook for subclassers to construct edgges with default user objects.
 org.jgraph.graph.DefaultEdge createEdge(Object userObj)
          Returns a new DefaultEdge containing the specified user object.
protected  JGraphpadEdgeTool createEdgeTool(String name, Object defaultValue, org.jgraph.graph.Edge.Routing routing)
          Helper method to create and return a new edge tool.
protected  Object createEdgeUserObject(Object value)
          Hook for subclassers to create a user object for edges that contains the specified value.
protected  JGraphEditor createEditor(Map args)
          Constructs a new JGraphEditor using the specified settings and document model model and calls configureEditor(JGraphEditor, Map) on the new instance.
protected  JGraphEditorFactory createFactory(JGraphEditor editor)
          Constructs a default factory for new editors.
protected  org.jgraph.JGraph createGraph(JGraphEditor editor, org.jgraph.graph.GraphLayoutCache graphLayoutCache)
          Hook for subclassers to provide a custom graph for the user interface.
 org.jgraph.graph.GraphCell createGroup()
          Hook for subclassers to construct groups with default user objects.
 org.jgraph.graph.GraphCell createGroup(Object userObj)
          Returns a new DefaultGraphCell containing the specified user object.
protected  JGraphEditorKit createKit(JGraphEditor editor)
          Constructs a default kit for new editors.
protected  Window createMainWindow(JGraphEditor editor, String factoryMethod)
          Helper method that invokes the specified factory method and configures the main window by setting its bounds and installing window listeners.
protected  JGraphEditorModel createModel()
          Constructs a document model for new editors.
protected  void createPlugins(JGraphEditor editor)
          Hook for subclassers to create plugins for a new editor.
 org.jgraph.graph.GraphCell createPort(MutableTreeNode parent, Object userObject)
          Creates a port containing the specified user object and adds it to parent.
protected  Object createPortUserObject(Object value)
          Hook for subclassers to create a user object for ports that contains the specified value.
protected  JGraphEditorSettings createSettings(Map args)
          Constructs the editor settings.
protected  Window createSplashWindow()
          Constructs a splash window to be displayed during the construction of the application.
 org.jgraph.graph.GraphCell createVertex()
          Hook for subclassers to construct vertices with default user objects.
 org.jgraph.graph.GraphCell createVertex(Object userObj)
          Returns a new DefaultGraphCell containing the specified user object.
protected  JGraphpadVertexTool createVertexTool(String name, Object defaultValue, int shape, ImageIcon icon)
          Invokes createVertexTool(String, Object, int, ImageIcon, boolean) with post editing set to false.
protected  JGraphpadVertexTool createVertexTool(String name, Object defaultValue, int shape, ImageIcon icon, boolean postEdit)
          Helper method to create and return a new vertex tool.
protected  Object createVertexUserObject(Object value)
          Returns a new JGraphpadBusinessObjectfor the specified value.
protected  void exit(int code)
          Hook for subclassers to implement the application exit method.
static boolean isImage(String filename)
          Returns true if the specified filename has an image extension, namely one in ImageIO.getReaderFormatNames().
static void main(String[] args)
          Constructs and displays a new application window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_NUMBER

public static final String VERSION_NUMBER
Global static product identifier.

See Also:
Constant Field Values

APPTITLE

public static String APPTITLE
Holds the application title for dialogs.


VERSION

public static final String VERSION
Global static product identifier.


INNER_LIBRARIES

public static boolean INNER_LIBRARIES
Specifies if libraries should reside inside documents. If this flag is true, then the navigator and libraries are inside the internal frames for documents. The libraries will be treated as part of their enclosing files. Default is false.


ARG_SYSTEMLOOKANDFEEL

public static String ARG_SYSTEMLOOKANDFEEL
Defines the look and feel argument name.


ARG_JGOODIESLOOKANDFEEL

public static String ARG_JGOODIESLOOKANDFEEL
Defines the look and feel argument name.


ARG_VERSION

public static String ARG_VERSION
Defines the look and feel argument name.


PATH_UICONFIG

public static String PATH_UICONFIG
Defines the path to the UI config file.


PATH_SPLASHIMAGE

public static String PATH_SPLASHIMAGE
Defines the path to the splash image file.


PATH_DEFAULTLIBRARY

public static String PATH_DEFAULTLIBRARY
Defines the path to the UI config file.


PATH_DEFAULTSETTINGS

public static String PATH_DEFAULTSETTINGS
Defines the path the the user settings file. This should also work with URLs (untested).


PATH_USERSETTINGS

public static String PATH_USERSETTINGS
Defines the path the the user settings file. This should also work with URLs (untested).


NAME_SETTINGSFILE

public static String NAME_SETTINGSFILE
Defines the filename for the settings file. Default is .jgraphpad.ini


NAME_UICONFIG

public static String NAME_UICONFIG
Defines the name for the ui XML document in the editor settings.


NAME_USERSETTINGS

public static String NAME_USERSETTINGS
Defines the name for the user properties in the editor settings.


KEY_MAINWINDOW

public static String KEY_MAINWINDOW
Defines the key used to identify the main window settings.


KEY_RECENTFILES

public static String KEY_RECENTFILES
Defines the key used to identify the recent files settings.


KEY_GROUPPROTOTYPE

public static String KEY_GROUPPROTOTYPE
Defines the key used to identify the group prototype settings.


KEY_VERTEXPROTOTYPE

public static String KEY_VERTEXPROTOTYPE
Defines the key used to identify the vertex prototype settings.


KEY_EDGEPROTOTYPE

public static String KEY_EDGEPROTOTYPE
Defines the key used to identify the edge prototype settings.


NAME_SELECTTOOL

public static final String NAME_SELECTTOOL
Defines the name for the selectTool.

See Also:
Constant Field Values

NAME_TEXTTOOL

public static final String NAME_TEXTTOOL
Defines the name for the textTool.

See Also:
Constant Field Values

NAME_VERTEXTOOL

public static final String NAME_VERTEXTOOL
Defines the name for the vertexTool.

See Also:
Constant Field Values

NAME_ROUNDEDTOOL

public static final String NAME_ROUNDEDTOOL
Defines the name for the roundedTool.

See Also:
Constant Field Values

NAME_CIRCLETOOL

public static final String NAME_CIRCLETOOL
Defines the name for the circleTool.

See Also:
Constant Field Values

NAME_DIAMONDTOOL

public static final String NAME_DIAMONDTOOL
Defines the name for the diamondTool.

See Also:
Constant Field Values

NAME_TRIANGLETOOL

public static final String NAME_TRIANGLETOOL
Defines the name for the triangleTool.

See Also:
Constant Field Values

NAME_CYLINDERTOOL

public static final String NAME_CYLINDERTOOL
Defines the name for the diamondTool.

See Also:
Constant Field Values

NAME_IMAGETOOL

public static final String NAME_IMAGETOOL
Defines the name for the imageTool.

See Also:
Constant Field Values

NAME_HEAVYTOOL

public static final String NAME_HEAVYTOOL
Defines the name for the imageTool.

See Also:
Constant Field Values

NAME_EDGETOOL

public static final String NAME_EDGETOOL
Defines the name for the edgeTool.

See Also:
Constant Field Values

NAME_ORTHOGONALEDGETOOL

public static final String NAME_ORTHOGONALEDGETOOL
Defines the name for the orthogonalEdgeTool.

See Also:
Constant Field Values

METHOD_CREATESHAPECOMBO

public static final String METHOD_CREATESHAPECOMBO
Defines the name of the createShapeCombo factory method.

See Also:
Constant Field Values

METHOD_CREATEGRADIENTCOMBO

public static final String METHOD_CREATEGRADIENTCOMBO
Defines the name of the createGradientCombo factory method.

See Also:
Constant Field Values

METHOD_CREATELINECOLORCOMBO

public static final String METHOD_CREATELINECOLORCOMBO
Defines the name of the createGradientCombo factory method.

See Also:
Constant Field Values

defaultPlugins

public String[] defaultPlugins
The class names for the defaut plugins.


defaultPortLocations

public Point2D[] defaultPortLocations
Defines the default port locations.


defaultBounds

public Rectangle2D defaultBounds
Defines the default vertex bounds.


defaultBorderColor

public Color defaultBorderColor
Defines the default border color.


defaultEdgeFont

public Font defaultEdgeFont
Defines the default edge font.


defaultEndDecoration

public int defaultEndDecoration
Defines the default end and begin decorations for edges.


defaultBeginDecoration

public int defaultBeginDecoration
Defines the default end and begin decorations for edges.


USAGE

public static final String USAGE
Defines the usage information (use --help), see http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html#programmatic on setting the look and feel.

Constructor Detail

JGraphpad

public JGraphpad()
Constructs JGraphpad as an applet.

Method Detail

exit

protected void exit(int code)
Hook for subclassers to implement the application exit method. This implementation calls System.exit with the specified code.


createApplication

public Window createApplication(List files,
                                Map args)
                         throws ParserConfigurationException,
                                SAXException,
                                IOException
Constructs a new editor application and returns its main window. Shows a splash window while the application is being constructed and returns the main window in visible state.
The parameters are obtained by parsing the arguments passed to the main method as follows. For all arguments -A B the value B is stored in the arguments under the A, for other arguments, eg. C D E the values C, D and E and passed in as elements of the list.

Parameters:
files - The list of filenames passed to the Java command.
args - The arguments to use for constructing the editor settings.
Returns:
Returns a new application main window.
Throws:
ParserConfigurationException
SAXException
IOException

createMainWindow

protected Window createMainWindow(JGraphEditor editor,
                                  String factoryMethod)
Helper method that invokes the specified factory method and configures the main window by setting its bounds and installing window listeners. This implementation invokes the exit action in the editor kit if the window is closed by the user.

Parameters:
editor - The editor to create the main window for.
factoryMethod - The name of the factory method to invoke.
Returns:
Returns a new main window for the specified editor.
See Also:
JGraphEditorFactory.executeMethod(String, Node), JGraphEditorKit.getAction(String), center(Window)

createSplashWindow

protected Window createSplashWindow()
Constructs a splash window to be displayed during the construction of the application.

Returns:
Returns a reference to the displaying splash window.

createEditor

protected JGraphEditor createEditor(Map args)
                             throws ParserConfigurationException,
                                    SAXException,
                                    IOException
Constructs a new JGraphEditor using the specified settings and document model model and calls configureEditor(JGraphEditor, Map) on the new instance. The returned instance has an overridden exit hook which disposes the main window and terminates the VM in the proper way for how the application was started.

Parameters:
args - The arguments passed to createApplication.
Returns:
Returns a new configured editor.
Throws:
IOException
SAXException
ParserConfigurationException

configureEditor

protected void configureEditor(JGraphEditor editor,
                               Map args)
                        throws ParserConfigurationException,
                               SAXException,
                               IOException
Hook for subclassers to configure new editors. This implementation configures the editor kit and -factory and invokes createPlugins(JGraphEditor)for the editor.

Parameters:
editor - The editor to be configured.
args - The arguments passed to createApplication.
Throws:
IOException
SAXException
ParserConfigurationException
See Also:
createKit(JGraphEditor), createFactory(JGraphEditor)

createSettings

protected JGraphEditorSettings createSettings(Map args)
                                       throws ParserConfigurationException,
                                              SAXException,
                                              IOException
Constructs the editor settings. This implementation constructs a new instance of JGraphEditorSettings using args as the initial object map and passes it to the configureSettings(JGraphEditorSettings)method.

Parameters:
args - The arguments passed to the command line.
Returns:
Returns a configured editor settings object.
Throws:
ParserConfigurationException
SAXException
IOException

configureSettings

protected void configureSettings(JGraphEditorSettings settings)
                          throws MalformedURLException,
                                 FileNotFoundException,
                                 ParserConfigurationException,
                                 SAXException,
                                 IOException
Hook for subclassers to configure new editor settings. This implementation adds the ui configuration (PATH_UICONFIG) to the NAME_UICONFIGand user settings (PATH_USERSETTINGS) to the NAME_USERSETTINGS.

Parameters:
settings - The editor settings to be configured.
Throws:
IOException
SAXException
ParserConfigurationException
FileNotFoundException
MalformedURLException
See Also:
JGraphEditorSettings.parse(InputStream), JGraphEditorSettings.add(String, InputStream)

createModel

protected JGraphEditorModel createModel()
Constructs a document model for new editors. This implementation constructs a new instance of JGraphEditorModeland passes it to the configureModel(JGraphEditorModel)method.

Returns:
Returns a configured document model for an editor.

configureModel

protected void configureModel(JGraphEditorModel model)
Hook for subclassers to configure new document models. This implementation adds persistence delegates for the following classes: JGraphpadDiagram,JGraphpadGraphModel, com.jgraph.graph.ConnectionSet, JGraphpadGraphLayoutCache, com.jgraph.graph.DefaultGraphCell, com.jgraph.graph.DefaultEdge, com.jgraph.graph.DefaultPort,JGraphpadBusinessObject, JGraphpadRichTextValueand JGraphpadShadowBorder.
JGraphpadDiagram
Constructs a persistence delegate for the diagram class. This uses the fact that all information is stored in the model, not the layout cache by ignoring the layout cache and accessing the model stored in the layout cache directly through the model bean property. Note: To allow this kind of encoding the diagram class offers a special constructor that takes a model and constructs a new graph layout cache for it.
JGraphpadGraphModel
To encode graph models we do not want the files to contain redundant connectivity information in the ports.edges and edges.source and target fields, so we add a method to the graph model that returns a connection set which describes the connections without redundancy. (Note: In the static initializer of this class we make sure that the edges, source and target of the respective classes or not encoded.)
ConnectionSet
The complete information of a connection set is stored in the actual connections, thus we only store the connections and use special constructor to restore the state of the complete object when de- coding. (Note: For connection sets this will update the edges field.)
JGraphpadGraphLayoutCache
The graph layout cache is encoded by encoding the various member fields, using a special constructor to restore the state of the layout cache upon decoding. Note that this is currently not used.
DefaultGraphCell, DefaultEdge, DefaultPort
Makes sure the cells are only encoded along with their user objects, the attributes, connections and tree-structure is stored in other objects and does not need to be encoded here.
JGraphpadBusinessObject, JGraphpadRichTextData
Allows to encode custom business objects used in JGraphpad. Since this object implements the bean interface we do only require a default persistence delegates with no special constructor calls to decode the object. Same holds for the rich text data object, which is a special value that can hold text formatting information.
JGraphShadowBorder
Since the shadow border is a singleton we must tell the decoder which method to use in order to find the shared instance of the class.

Parameters:
model - The document model to be configured.

createKit

protected JGraphEditorKit createKit(JGraphEditor editor)
Constructs a default kit for new editors. This implementation constructs a new instance of JGraphEditorKitand passes it to configureKit(JGraphEditor, JGraphEditorKit).

Parameters:
editor - The editor for which to create an editor kit.
Returns:
Returns a configured editor kit for the specified editor.

configureKit

protected void configureKit(JGraphEditor editor,
                            JGraphEditorKit kit)
Boilerplate method for configuring new editor kits. This implementation calls addActions(JGraphEditor, JGraphEditorKit), addTools(JGraphEditor, JGraphEditorKit)and registers the kit with the listeners required to update the state. This method is called from createKit(JGraphEditor).

Parameters:
editor - The editor for which to configure the editor kit.
kit - The new editor kit to be configured.

addActions

protected void addActions(JGraphEditor editor,
                          JGraphEditorKit kit)
Adds the action bundles for JGraphpadEditAction, JGraphpadFileAction,JGraphpadViewAction, JGraphpadFormatActionand JGraphpadCellAction. Uses the createVertex and createEdge method to construct prototypes for JGraphpadCellAction.NAME_GROUPand JGraphpadCellAction.NAME_CONNECT. This method is called from configureEditorKit.

Parameters:
editor - The editor for which to create the actions.
kit - The editor kit to add the actions to.
See Also:
configureKit(JGraphEditor, JGraphEditorKit), JGraphEditorKit.addBundle(JGraphEditorAction.Bundle), createVertex(), createEdge()

addTools

protected void addTools(JGraphEditor editor,
                        JGraphEditorKit kit)
Adds the following tools to kit:NAME_SELECTTOOL, NAME_VERTEXTOOL,NAME_ROUNDEDTOOL, NAME_CIRCLETOOL,NAME_DIAMONDTOOL,NAME_TRIANGLETOOL, NAME_IMAGETOOL,NAME_HEAVYTOOL,NAME_EDGETOOLand NAME_ORTHOGONALEDGETOOL. This method is called from configureEditorKit.

Parameters:
editor - The editor for which to create the tools.
kit - The editor kit to add the tools to.
See Also:
configureKit(JGraphEditor, JGraphEditorKit), JGraphEditorKit.addTool(JGraphEditorTool), createVertexTool(String, Object, int, ImageIcon), #createEdgeTool(String, String, Edge.Routing)

createVertexTool

protected JGraphpadVertexTool createVertexTool(String name,
                                               Object defaultValue,
                                               int shape,
                                               ImageIcon icon)
Invokes createVertexTool(String, Object, int, ImageIcon, boolean) with post editing set to false.


createVertexTool

protected JGraphpadVertexTool createVertexTool(String name,
                                               Object defaultValue,
                                               int shape,
                                               ImageIcon icon,
                                               boolean postEdit)
Helper method to create and return a new vertex tool. This uses the createVertexUserObject or creates a new JGraphpadRichTextValue object based on isRichText as the user object, which it passes to createVertex to create the graph cell. The method sets the shape on the created graph cell, and returns a new JGraphpadVertexTool with the specified name.

Parameters:
name - The name of the tool to be created.
defaultValue - The defaultValue for the vertices that this tool creates.
shape - The shape for the vertices that this tool creates. Use -1 for no border.
icon - The icon for the vertices that this tool creates.
postEdit - If in-place editing should be triggered after inserting the cell.
Returns:
Returns a new vertex tool.
See Also:
JGraphpadRichTextValue, createVertexUserObject(Object), createVertex(Object), JGraphpadGraphConstants.setVertexShape(Map, int), JGraphpadVertexTool

createEdgeTool

protected JGraphpadEdgeTool createEdgeTool(String name,
                                           Object defaultValue,
                                           org.jgraph.graph.Edge.Routing routing)
Helper method to create and return a new edge tool. This passes the return value of createEdgeUserObject to createEdge to create the graph cell. The method sets the routing on the created graph cell if it is not null, and returns a new JGraphpadEdgeTool with the specified name.

Parameters:
name - The name of the tool to be created.
defaultValue - The defaultValue for the edges that this tool creates.
routing - The routing for the edges that this tool creates.
Returns:
Returns a new edge tool.
See Also:
createEdgeUserObject(Object), createEdge(Object), GraphConstants.setRouting(Map, Edge.Routing), JGraphpadEdgeTool

createFactory

protected JGraphEditorFactory createFactory(JGraphEditor editor)
Constructs a default factory for new editors. This implementation constructs a new instance of JGraphEditorFactory and overrides JGraphEditorFactory.createGraph(GraphLayoutCache) to call createGraph(JGraphEditor, GraphLayoutCache) and configures the factory using configureFactory(JGraphEditor, JGraphEditorFactory).

Parameters:
editor - The editor for which to create an editor factory.
Returns:
Returns a configured editor factory for the specified editor.

configureFactory

protected void configureFactory(JGraphEditor editor,
                                JGraphEditorFactory factory)
Hook for subclassers to configure new editor factories. This implementation adds various following factory methods.

Parameters:
editor - The editor to create the factory methods for.
factory - The factory to be configured.

createPlugins

protected void createPlugins(JGraphEditor editor)
Hook for subclassers to create plugins for a new editor. This implementation creates the defaultPlugins. This method is called from configureEditor(JGraphEditor, Map).

Parameters:
editor - The editor for which to create the plugins.

createGraph

protected org.jgraph.JGraph createGraph(JGraphEditor editor,
                                        org.jgraph.graph.GraphLayoutCache graphLayoutCache)
Hook for subclassers to provide a custom graph for the user interface. This method is invoked by the default custom factory returned by the createEditorFactory method. It invokes configureGraph(JGraphEditor, JGraph) to configure the new graph instance.

See Also:
createFactory(JGraphEditor)

configureGraph

protected void configureGraph(JGraphEditor editor,
                              org.jgraph.JGraph graph)
Hook for subclassers to configure a new graph. This implementation adds a JGraphpadTransferHandler and JGraphpadMarqueeHandler to the instance. (Note: createVertex() is used to create the prototype cell for the transfer handler.)

Parameters:
graph - The graph to be configured

createVertex

public org.jgraph.graph.GraphCell createVertex()
Hook for subclassers to construct vertices with default user objects. This implementation invokes createVertexUserObject(Object)and passes the return value to createVertex(Object).

Returns:
Returns a new vertex with a default user object.

createVertex

public org.jgraph.graph.GraphCell createVertex(Object userObj)
Returns a new DefaultGraphCell containing the specified user object. This implementation uses createAttributeMap()to create the map that holds the attributes for the new vertex, and configureVertex(GraphCell)to configure the vertex.

Parameters:
userObj - The user object that the vertex should contain.
Returns:
Returns a new vertex.

configureVertex

protected void configureVertex(org.jgraph.graph.GraphCell vertex)
Hook for subclassers to configure the specified vertex. This implementation sets the defaultBorderColorand adds ports if the vertex implements the MutableTreeNodeinterface.

Parameters:
vertex - The vertex to be configured.
See Also:
addPorts(MutableTreeNode, Point2D[])

createGroup

public org.jgraph.graph.GraphCell createGroup()
Hook for subclassers to construct groups with default user objects. This implementation invokes createVertexUserObject(Object)and passes the return value to createGroup(Object).

Returns:
Returns a new group with a default user object.

createGroup

public org.jgraph.graph.GraphCell createGroup(Object userObj)
Returns a new DefaultGraphCell containing the specified user object. This implementation uses createAttributeMap()to create the map that holds the attributes for the new vertex, and configureVertex(GraphCell)to configure the vertex.

Parameters:
userObj - The user object that the group should contain.
Returns:
Returns a new group.

addPorts

protected void addPorts(MutableTreeNode parent,
                        Point2D[] offsets)
Adds ports to parent using offsets as the port relative offsets. The method uses createPortUserObject(Object), createPort(MutableTreeNode, Object)and configurePort(GraphCell, Point2D)to create the ports and their user objects, configure them and add them to the parent.

Parameters:
parent - The parent to add the ports to.
offsets - The points defining the port locations.

createPort

public org.jgraph.graph.GraphCell createPort(MutableTreeNode parent,
                                             Object userObject)
Creates a port containing the specified user object and adds it to parent.

Parameters:
userObject - The user object that the port should contain.
Returns:
Returns a new port.

configurePort

public void configurePort(org.jgraph.graph.GraphCell port,
                          Point2D offset)
Hook for subclassers to configure the specified port using the offset as the relative location.

Parameters:
port - The port to be configured.
offset - The relative offset of the port.

createEdge

public org.jgraph.graph.DefaultEdge createEdge()
Hook for subclassers to construct edgges with default user objects. This implementation invokes createEdgeUserObject(Object)and passes the return value to createEdge(Object).

Returns:
Returns a new edge with a default user object.

createEdge

public org.jgraph.graph.DefaultEdge createEdge(Object userObj)
Returns a new DefaultEdge containing the specified user object. This implementation uses createAttributeMap()to create the map that holds the attributes for the new edge and configureEdge(GraphCell)to configure the edge.

Parameters:
userObj - The user object that the edge should contain.
Returns:
Returns a new edge.

configureEdge

protected void configureEdge(org.jgraph.graph.GraphCell edge)
Hook for subclassers to configure the specified edge. This implementation sets the defaultEdgeFont,defaultEndDecorationand defaultBeginDecoration.

Parameters:
edge - The edge to be configured.

createEdgeUserObject

protected Object createEdgeUserObject(Object value)
Hook for subclassers to create a user object for edges that contains the specified value. This implementation calls createVertexUserObject(Object).

Parameters:
value - The value that the user object should contain.
Returns:
Returns a new user object containing value.

createPortUserObject

protected Object createPortUserObject(Object value)
Hook for subclassers to create a user object for ports that contains the specified value. This implementation calls createVertexUserObject(Object).

Parameters:
value - The value that the user object should contain.
Returns:
Returns a new user object containing value.

createVertexUserObject

protected Object createVertexUserObject(Object value)
Returns a new JGraphpadBusinessObjectfor the specified value. This implementation replaces all null values with an empty JGraphpadRichTextValue.

Parameters:
value - The value that the user object should contain.
Returns:
Returns a new user object containing value.
See Also:
JGraphpadBusinessObject

createAttributeMap

protected org.jgraph.graph.AttributeMap createAttributeMap()
Hook for subclassers to construct attribute map for cells. This implementation returns a new instance of AttributeMap.

Returns:
Returns a new attribute map.

isImage

public static boolean isImage(String filename)
Returns true if the specified filename has an image extension, namely one in ImageIO.getReaderFormatNames().

Parameters:
filename - The filename to be checked.
Returns:
Returns true if the filename is an image file.

center

public static void center(Window wnd)
Centers the specified window on the screen, taking into account the current size of the window.

Parameters:
wnd - The window to be centered.

main

public static void main(String[] args)
Constructs and displays a new application window.

Parameters:
args - The command line arguments to pass to the application.

JGraphpad Pro
v6.0.5.0


Copyright (C) 2005 JGraph.com. All rights reserved.