|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jgraph.JGraphpad
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 |
public static final String VERSION_NUMBER
public static String APPTITLE
public static final String VERSION
public static boolean INNER_LIBRARIES
public static String ARG_SYSTEMLOOKANDFEEL
public static String ARG_JGOODIESLOOKANDFEEL
public static String ARG_VERSION
public static String PATH_UICONFIG
public static String PATH_SPLASHIMAGE
public static String PATH_DEFAULTLIBRARY
public static String PATH_DEFAULTSETTINGS
public static String PATH_USERSETTINGS
public static String NAME_SETTINGSFILE
public static String NAME_UICONFIG
public static String NAME_USERSETTINGS
public static String KEY_MAINWINDOW
public static String KEY_RECENTFILES
public static String KEY_GROUPPROTOTYPE
public static String KEY_VERTEXPROTOTYPE
public static String KEY_EDGEPROTOTYPE
public static final String NAME_SELECTTOOL
public static final String NAME_TEXTTOOL
public static final String NAME_VERTEXTOOL
public static final String NAME_ROUNDEDTOOL
public static final String NAME_CIRCLETOOL
public static final String NAME_DIAMONDTOOL
public static final String NAME_TRIANGLETOOL
public static final String NAME_CYLINDERTOOL
public static final String NAME_IMAGETOOL
public static final String NAME_HEAVYTOOL
public static final String NAME_EDGETOOL
public static final String NAME_ORTHOGONALEDGETOOL
public static final String METHOD_CREATESHAPECOMBO
public static final String METHOD_CREATEGRADIENTCOMBO
public static final String METHOD_CREATELINECOLORCOMBO
public String[] defaultPlugins
public Point2D[] defaultPortLocations
public Rectangle2D defaultBounds
public Color defaultBorderColor
public Font defaultEdgeFont
public int defaultEndDecoration
public int defaultBeginDecoration
public static final String USAGE
| Constructor Detail |
public JGraphpad()
| Method Detail |
protected void exit(int code)
public Window createApplication(List files,
Map args)
throws ParserConfigurationException,
SAXException,
IOException
files - The list of filenames passed to the Java command.args - The arguments to use for constructing the editor settings.
ParserConfigurationException
SAXException
IOException
protected Window createMainWindow(JGraphEditor editor,
String factoryMethod)
editor - The editor to create the main window for.factoryMethod - The name of the factory method to invoke.
JGraphEditorFactory.executeMethod(String, Node),
JGraphEditorKit.getAction(String),
center(Window)protected Window createSplashWindow()
protected JGraphEditor createEditor(Map args)
throws ParserConfigurationException,
SAXException,
IOException
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.
args - The arguments passed to createApplication.
IOException
SAXException
ParserConfigurationException
protected void configureEditor(JGraphEditor editor,
Map args)
throws ParserConfigurationException,
SAXException,
IOException
createPlugins(JGraphEditor)for the editor.
editor - The editor to be configured.args - The arguments passed to createApplication.
IOException
SAXException
ParserConfigurationExceptioncreateKit(JGraphEditor),
createFactory(JGraphEditor)
protected JGraphEditorSettings createSettings(Map args)
throws ParserConfigurationException,
SAXException,
IOException
configureSettings(JGraphEditorSettings)method.
args - The arguments passed to the command line.
ParserConfigurationException
SAXException
IOException
protected void configureSettings(JGraphEditorSettings settings)
throws MalformedURLException,
FileNotFoundException,
ParserConfigurationException,
SAXException,
IOException
PATH_UICONFIG) to
the
NAME_UICONFIGand user settings (PATH_USERSETTINGS)
to the NAME_USERSETTINGS.
settings - The editor settings to be configured.
IOException
SAXException
ParserConfigurationException
FileNotFoundException
MalformedURLExceptionJGraphEditorSettings.parse(InputStream),
JGraphEditorSettings.add(String, InputStream)protected JGraphEditorModel createModel()
JGraphEditorModeland passes it to
the configureModel(JGraphEditorModel)method.
protected void configureModel(JGraphEditorModel model)
JGraphpadDiagram,JGraphpadGraphModel,
com.jgraph.graph.ConnectionSet, JGraphpadGraphLayoutCache,
com.jgraph.graph.DefaultGraphCell, com.jgraph.graph.DefaultEdge,
com.jgraph.graph.DefaultPort,JGraphpadBusinessObject,
JGraphpadRichTextValueand JGraphpadShadowBorder.
model - The document model to be configured.protected JGraphEditorKit createKit(JGraphEditor editor)
JGraphEditorKitand passes it to
configureKit(JGraphEditor, JGraphEditorKit).
editor - The editor for which to create an editor kit.
protected void configureKit(JGraphEditor editor,
JGraphEditorKit kit)
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).
editor - The editor for which to configure the editor kit.kit - The new editor kit to be configured.
protected void addActions(JGraphEditor editor,
JGraphEditorKit kit)
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.
editor - The editor for which to create the actions.kit - The editor kit to add the actions to.configureKit(JGraphEditor, JGraphEditorKit),
JGraphEditorKit.addBundle(JGraphEditorAction.Bundle),
createVertex(),
createEdge()
protected void addTools(JGraphEditor editor,
JGraphEditorKit kit)
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.
editor - The editor for which to create the tools.kit - The editor kit to add the tools to.configureKit(JGraphEditor, JGraphEditorKit),
JGraphEditorKit.addTool(JGraphEditorTool),
createVertexTool(String, Object, int, ImageIcon),
#createEdgeTool(String, String, Edge.Routing)
protected JGraphpadVertexTool createVertexTool(String name,
Object defaultValue,
int shape,
ImageIcon icon)
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)
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.
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.
JGraphpadRichTextValue,
createVertexUserObject(Object),
createVertex(Object),
JGraphpadGraphConstants.setVertexShape(Map, int),
JGraphpadVertexTool
protected JGraphpadEdgeTool createEdgeTool(String name,
Object defaultValue,
org.jgraph.graph.Edge.Routing routing)
null, and returns a new JGraphpadEdgeTool with the
specified name.
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.
createEdgeUserObject(Object),
createEdge(Object),
GraphConstants.setRouting(Map, Edge.Routing),
JGraphpadEdgeToolprotected JGraphEditorFactory createFactory(JGraphEditor editor)
JGraphEditorFactory.createGraph(GraphLayoutCache) to call
createGraph(JGraphEditor, GraphLayoutCache) and configures the
factory using
configureFactory(JGraphEditor, JGraphEditorFactory).
editor - The editor for which to create an editor factory.
protected void configureFactory(JGraphEditor editor,
JGraphEditorFactory factory)
editor - The editor to create the factory methods for.factory - The factory to be configured.protected void createPlugins(JGraphEditor editor)
defaultPlugins. This method is
called from configureEditor(JGraphEditor, Map).
editor - The editor for which to create the plugins.
protected org.jgraph.JGraph createGraph(JGraphEditor editor,
org.jgraph.graph.GraphLayoutCache graphLayoutCache)
configureGraph(JGraphEditor, JGraph) to configure the new graph
instance.
createFactory(JGraphEditor)
protected void configureGraph(JGraphEditor editor,
org.jgraph.JGraph graph)
JGraphpadTransferHandler and JGraphpadMarqueeHandler to
the instance. (Note: createVertex() is used to create the
prototype cell for the transfer handler.)
graph - The graph to be configuredpublic org.jgraph.graph.GraphCell createVertex()
createVertexUserObject(Object)and
passes the return value to createVertex(Object).
public org.jgraph.graph.GraphCell createVertex(Object userObj)
createAttributeMap()to create the map that
holds the attributes for the new vertex, and
configureVertex(GraphCell)to configure the vertex.
userObj - The user object that the vertex should contain.
protected void configureVertex(org.jgraph.graph.GraphCell vertex)
defaultBorderColorand adds ports if the
vertex implements the MutableTreeNodeinterface.
vertex - The vertex to be configured.addPorts(MutableTreeNode, Point2D[])public org.jgraph.graph.GraphCell createGroup()
createVertexUserObject(Object)and passes
the return value to createGroup(Object).
public org.jgraph.graph.GraphCell createGroup(Object userObj)
createAttributeMap()to create the map that
holds the attributes for the new vertex, and
configureVertex(GraphCell)to configure the vertex.
userObj - The user object that the group should contain.
protected void addPorts(MutableTreeNode parent,
Point2D[] offsets)
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.
parent - The parent to add the ports to.offsets - The points defining the port locations.
public org.jgraph.graph.GraphCell createPort(MutableTreeNode parent,
Object userObject)
parent.
userObject - The user object that the port should contain.
public void configurePort(org.jgraph.graph.GraphCell port,
Point2D offset)
offset as the relative location.
port - The port to be configured.offset - The relative offset of the port.public org.jgraph.graph.DefaultEdge createEdge()
createEdgeUserObject(Object)and passes
the return value to createEdge(Object).
public org.jgraph.graph.DefaultEdge createEdge(Object userObj)
createAttributeMap()to create the map that
holds the attributes for the new edge and
configureEdge(GraphCell)to configure the edge.
userObj - The user object that the edge should contain.
protected void configureEdge(org.jgraph.graph.GraphCell edge)
defaultEdgeFont,defaultEndDecorationand
defaultBeginDecoration.
edge - The edge to be configured.protected Object createEdgeUserObject(Object value)
createVertexUserObject(Object).
value - The value that the user object should contain.
value.protected Object createPortUserObject(Object value)
createVertexUserObject(Object).
value - The value that the user object should contain.
value.protected Object createVertexUserObject(Object value)
JGraphpadBusinessObjectfor the specified value.
This implementation replaces all null values with an empty
JGraphpadRichTextValue.
value - The value that the user object should contain.
value.JGraphpadBusinessObjectprotected org.jgraph.graph.AttributeMap createAttributeMap()
AttributeMap.
public static boolean isImage(String filename)
ImageIO.getReaderFormatNames().
filename - The filename to be checked.
public static void center(Window wnd)
wnd - The window to be centered.public static void main(String[] args)
args - The command line arguments to pass to the application.
|
JGraphpad Pro
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||