| java.lang.Object com.jgraph.JGraphpad
All known Subclasses: com.jgraph.JGraphpadDemo,
JGraphpad | public class JGraphpad (Code) | | 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.
|
Constructor Summary | |
public | JGraphpad() Constructs JGraphpad as an applet. |
Method Summary | |
protected void | addActions(JGraphEditor editor, JGraphEditorKit kit) Adds the action bundles for
JGraphpadEditAction ,
JGraphpadFileAction ,
JGraphpadViewAction ,
JGraphpadFormatAction and
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 :
JGraphpad.NAME_SELECTTOOL ,
JGraphpad.NAME_VERTEXTOOL ,
JGraphpad.NAME_ROUNDEDTOOL ,
JGraphpad.NAME_CIRCLETOOL ,
JGraphpad.NAME_DIAMONDTOOL ,
JGraphpad.NAME_TRIANGLETOOL ,
JGraphpad.NAME_IMAGETOOL ,
JGraphpad.NAME_HEAVYTOOL ,
JGraphpad.NAME_EDGETOOL and
JGraphpad.NAME_ORTHOGONALEDGETOOL . | public static void | center(Window wnd) Centers the specified window on the screen, taking into account the
current size of the window. | protected void | configureEdge(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, 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. | public void | configurePort(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(GraphCell vertex) Hook for subclassers to configure the specified vertex. | public Window | createApplication(List files, Map args) Constructs a new editor application and returns its main window. | protected AttributeMap | createAttributeMap() Hook for subclassers to construct attribute map for cells. | public DefaultEdge | createEdge() Hook for subclassers to construct edgges with default user objects. | public DefaultEdge | createEdge(Object userObj) Returns a new DefaultEdge containing the specified user object. | protected JGraphpadEdgeTool | createEdgeTool(String name, Object defaultValue, 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
JGraphpad.configureEditor(JGraphEditor,Map) on the new instance. | protected JGraphEditorFactory | createFactory(JGraphEditor editor) Constructs a default factory for new editors. | protected JGraph | createGraph(JGraphEditor editor, 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. | public GraphCell | createGroup() Hook for subclassers to construct groups with default user objects. | public 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.
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. Parameters: factoryMethod - The name of the factory method to invoke. | 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. | public 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. | 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. | public GraphCell | createVertex() Hook for subclassers to construct vertices with default user objects. | public 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
JGraphpad.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
JGraphpadBusinessObject for the specified value.
This implementation replaces all null values with an empty
JGraphpadRichTextValue .
Parameters: value - The value that the user object should contain. | protected void | exit(int code) Hook for subclassers to implement the application exit method. | public static boolean | isImage(String filename) Returns true if the specified filename has an image extension, namely one
in
javax.imageio.ImageIO.getReaderFormatNames .
Parameters: filename - The filename to be checked. | public static void | main(String[] args) Constructs and displays a new application window. |
APPTITLE | public static String APPTITLE(Code) | | Holds the application title for dialogs.
|
ARG_JGOODIESLOOKANDFEEL | public static String ARG_JGOODIESLOOKANDFEEL(Code) | | Defines the look and feel argument name.
|
ARG_SYSTEMLOOKANDFEEL | public static String ARG_SYSTEMLOOKANDFEEL(Code) | | Defines the look and feel argument name.
|
ARG_VERSION | public static String ARG_VERSION(Code) | | Defines the look and feel argument name.
|
INNER_LIBRARIES | public static boolean INNER_LIBRARIES(Code) | | 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.
|
KEY_EDGEPROTOTYPE | public static String KEY_EDGEPROTOTYPE(Code) | | Defines the key used to identify the edge prototype settings.
|
KEY_GROUPPROTOTYPE | public static String KEY_GROUPPROTOTYPE(Code) | | Defines the key used to identify the group prototype settings.
|
KEY_MAINWINDOW | public static String KEY_MAINWINDOW(Code) | | Defines the key used to identify the main window settings.
|
KEY_RECENTFILES | public static String KEY_RECENTFILES(Code) | | Defines the key used to identify the recent files settings.
|
KEY_VERTEXPROTOTYPE | public static String KEY_VERTEXPROTOTYPE(Code) | | Defines the key used to identify the vertex prototype settings.
|
METHOD_CREATEGRADIENTCOMBO | final public static String METHOD_CREATEGRADIENTCOMBO(Code) | | Defines the name of the createGradientCombo factory method.
|
METHOD_CREATELINECOLORCOMBO | final public static String METHOD_CREATELINECOLORCOMBO(Code) | | Defines the name of the createGradientCombo factory method.
|
METHOD_CREATESHAPECOMBO | final public static String METHOD_CREATESHAPECOMBO(Code) | | Defines the name of the createShapeCombo factory method.
|
NAME_CIRCLETOOL | final public static String NAME_CIRCLETOOL(Code) | | Defines the name for the circleTool.
|
NAME_CYLINDERTOOL | final public static String NAME_CYLINDERTOOL(Code) | | Defines the name for the diamondTool.
|
NAME_DIAMONDTOOL | final public static String NAME_DIAMONDTOOL(Code) | | Defines the name for the diamondTool.
|
NAME_EDGETOOL | final public static String NAME_EDGETOOL(Code) | | Defines the name for the edgeTool.
|
NAME_HEAVYTOOL | final public static String NAME_HEAVYTOOL(Code) | | Defines the name for the imageTool.
|
NAME_IMAGETOOL | final public static String NAME_IMAGETOOL(Code) | | Defines the name for the imageTool.
|
NAME_ORTHOGONALEDGETOOL | final public static String NAME_ORTHOGONALEDGETOOL(Code) | | Defines the name for the orthogonalEdgeTool.
|
NAME_ROUNDEDTOOL | final public static String NAME_ROUNDEDTOOL(Code) | | Defines the name for the roundedTool.
|
NAME_SELECTTOOL | final public static String NAME_SELECTTOOL(Code) | | Defines the name for the selectTool.
|
NAME_SETTINGSFILE | public static String NAME_SETTINGSFILE(Code) | | Defines the filename for the settings file. Default is .jgraphpad.ini
|
NAME_TEXTTOOL | final public static String NAME_TEXTTOOL(Code) | | Defines the name for the textTool.
|
NAME_TRIANGLETOOL | final public static String NAME_TRIANGLETOOL(Code) | | Defines the name for the triangleTool.
|
NAME_UICONFIG | public static String NAME_UICONFIG(Code) | | Defines the name for the ui XML document in the editor settings.
|
NAME_USERSETTINGS | public static String NAME_USERSETTINGS(Code) | | Defines the name for the user properties in the editor settings.
|
NAME_VERTEXTOOL | final public static String NAME_VERTEXTOOL(Code) | | Defines the name for the vertexTool.
|
PATH_DEFAULTLIBRARY | public static String PATH_DEFAULTLIBRARY(Code) | | Defines the path to the UI config file.
|
PATH_DEFAULTSETTINGS | public static String PATH_DEFAULTSETTINGS(Code) | | Defines the path the the user settings file. This should also work with
URLs (untested).
|
PATH_SPLASHIMAGE | public static String PATH_SPLASHIMAGE(Code) | | Defines the path to the splash image file.
|
PATH_UICONFIG | public static String PATH_UICONFIG(Code) | | Defines the path to the UI config file.
|
PATH_USERSETTINGS | public static String PATH_USERSETTINGS(Code) | | Defines the path the the user settings file. This should also work with
URLs (untested).
|
USAGE | final public static String USAGE(Code) | | 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.
|
VERSION | final public static String VERSION(Code) | | Global static product identifier.
|
VERSION_NUMBER | final public static String VERSION_NUMBER(Code) | | Global static product identifier.
|
defaultBorderColor | public Color defaultBorderColor(Code) | | Defines the default border color.
|
defaultBounds | public Rectangle2D defaultBounds(Code) | | Defines the default vertex bounds.
|
defaultEdgeFont | public Font defaultEdgeFont(Code) | | Defines the default edge font.
|
defaultEndDecorationdefaultBeginDecoration | public int defaultEndDecorationdefaultBeginDecoration(Code) | | Defines the default end and begin decorations for edges.
|
defaultPlugins | public String[] defaultPlugins(Code) | | The class names for the defaut plugins.
|
defaultPortLocations | public Point2D[] defaultPortLocations(Code) | | Defines the default port locations.
|
JGraphpad | public JGraphpad()(Code) | | Constructs JGraphpad as an applet.
|
addTools | protected void addTools(JGraphEditor editor, JGraphEditorKit kit)(Code) | | Adds the following tools to kit :
JGraphpad.NAME_SELECTTOOL ,
JGraphpad.NAME_VERTEXTOOL ,
JGraphpad.NAME_ROUNDEDTOOL ,
JGraphpad.NAME_CIRCLETOOL ,
JGraphpad.NAME_DIAMONDTOOL ,
JGraphpad.NAME_TRIANGLETOOL ,
JGraphpad.NAME_IMAGETOOL ,
JGraphpad.NAME_HEAVYTOOL ,
JGraphpad.NAME_EDGETOOL and
JGraphpad.NAME_ORTHOGONALEDGETOOL . This method is called from
configureEditorKit.
Parameters: editor - The editor for which to create the tools. Parameters: kit - The editor kit to add the tools to. See Also: JGraphpad.configureKit(JGraphEditor,JGraphEditorKit) See Also: JGraphEditorKit.addTool(JGraphEditorTool) See Also: JGraphpad.createVertexTool(String,Object,int,ImageIcon) See Also: JGraphpad.createEdgeTool(String,String,Edge.Routing) |
center | public static void center(Window wnd)(Code) | | Centers the specified window on the screen, taking into account the
current size of the window.
Parameters: wnd - The window to be centered. |
configureFactory | protected void configureFactory(JGraphEditor editor, JGraphEditorFactory factory)(Code) | | 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. Parameters: factory - The factory to be configured. |
configureModel | protected void configureModel(JGraphEditorModel model)(Code) | | 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 ,
JGraphpadRichTextValue and
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. |
configurePort | public void configurePort(GraphCell port, Point2D offset)(Code) | | Hook for subclassers to configure the specified port using the
offset as the relative location.
Parameters: port - The port to be configured. Parameters: offset - The relative offset of the port. |
createApplication | public Window createApplication(List files, Map args) throws ParserConfigurationException, SAXException, IOException(Code) | | 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. Parameters: args - The arguments to use for constructing the editor settings. Returns a new application main window. |
createAttributeMap | protected AttributeMap createAttributeMap()(Code) | | Hook for subclassers to construct attribute map for cells. This
implementation returns a new instance of
AttributeMap .
Returns a new attribute map. |
createEdgeUserObject | protected Object createEdgeUserObject(Object value)(Code) | | Hook for subclassers to create a user object for edges that contains the
specified value. This implementation calls
JGraphpad.createVertexUserObject(Object) .
Parameters: value - The value that the user object should contain. Returns a new user object containing value . |
createPort | public GraphCell createPort(MutableTreeNode parent, Object userObject)(Code) | | Creates a port containing the specified user object and adds it to
parent .
Parameters: userObject - The user object that the port should contain. Returns a new port. |
createPortUserObject | protected Object createPortUserObject(Object value)(Code) | | Hook for subclassers to create a user object for ports that contains the
specified value. This implementation calls
JGraphpad.createVertexUserObject(Object) .
Parameters: value - The value that the user object should contain. Returns a new user object containing value . |
createSplashWindow | protected Window createSplashWindow()(Code) | | Constructs a splash window to be displayed during the construction of the
application.
Returns a reference to the displaying splash window. |
exit | protected void exit(int code)(Code) | | Hook for subclassers to implement the application exit method. This
implementation calls System.exit with the specified code.
|
isImage | public static boolean isImage(String filename)(Code) | | Returns true if the specified filename has an image extension, namely one
in
javax.imageio.ImageIO.getReaderFormatNames .
Parameters: filename - The filename to be checked. Returns true if the filename is an image file. |
main | public static void main(String[] args)(Code) | | Constructs and displays a new application window.
Parameters: args - The command line arguments to pass to the application. |
|
|