biz.hammurapi.web.diagrameditor
Class DiagramEditorApplet

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byjavax.swing.JApplet
                      extended bybiz.hammurapi.web.diagrameditor.DiagramEditorApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable

public class DiagramEditorApplet
extends javax.swing.JApplet

Diagram editor applet.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String APPTITLE
          Holds the application title for dialogs.
static java.lang.String ARG_JGOODIESLOOKANDFEEL
          Defines the look and feel argument name.
static java.lang.String ARG_SYSTEMLOOKANDFEEL
          Defines the look and feel argument name.
static java.lang.String ARG_VERSION
          Defines the look and feel argument name.
static java.lang.String CREATE_ID
           
 int defaultBeginDecoration
          Defines the default end and begin decorations for edges.
 java.awt.Color defaultBorderColor
          Defines the default border color.
 java.awt.geom.Rectangle2D defaultBounds
          Defines the default vertex bounds.
 java.awt.Font defaultEdgeFont
          Defines the default edge font.
 int defaultEndDecoration
          Defines the default end and begin decorations for edges.
 java.lang.String[] defaultPlugins
          The class names for the defaut plugins.
 java.awt.geom.Point2D[] defaultPortLocations
          Defines the default port locations.
static java.lang.String IS_NEW
           
static java.lang.String KEY_EDGEPROTOTYPE
          Defines the key used to identify the edge prototype settings.
static java.lang.String KEY_GROUPPROTOTYPE
          Defines the key used to identify the group prototype settings.
static java.lang.String KEY_VERTEXPROTOTYPE
          Defines the key used to identify the vertex prototype settings.
static java.lang.String METHOD_CREATEGRADIENTCOMBO
          Defines the name of the createGradientCombo factory method.
static java.lang.String METHOD_CREATELINECOLORCOMBO
          Defines the name of the createGradientCombo factory method.
static java.lang.String METHOD_CREATESHAPECOMBO
          Defines the name of the createShapeCombo factory method.
static java.lang.String NAME_CIRCLETOOL
          Defines the name for the circleTool.
static java.lang.String NAME_CYLINDERTOOL
          Defines the name for the diamondTool.
static java.lang.String NAME_DIAMONDTOOL
          Defines the name for the diamondTool.
static java.lang.String NAME_EDGETOOL
          Defines the name for the edgeTool.
static java.lang.String NAME_HEAVYTOOL
          Defines the name for the imageTool.
static java.lang.String NAME_IMAGETOOL
          Defines the name for the imageTool.
static java.lang.String NAME_ORTHOGONALEDGETOOL
          Defines the name for the orthogonalEdgeTool.
static java.lang.String NAME_ROUNDEDTOOL
          Defines the name for the roundedTool.
static java.lang.String NAME_SELECTTOOL
          Defines the name for the selectTool.
static java.lang.String NAME_TEXTTOOL
          Defines the name for the textTool.
static java.lang.String NAME_TRIANGLETOOL
          Defines the name for the triangleTool.
static java.lang.String NAME_UICONFIG
          Defines the name for the ui XML document in the editor settings.
static java.lang.String NAME_VERTEXTOOL
          Defines the name for the vertexTool.
static java.lang.String PATH_DEFAULTSETTINGS
          Defines the path the the user settings file.
static java.lang.String PATH_UICONFIG
          Defines the path to the UI config file.
static java.lang.String VERSION
          Global static product identifier.
static java.lang.String VERSION_NUMBER
          Global static product identifier.
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DiagramEditorApplet()
           
 
Method Summary
protected  void addActions(com.jgraph.JGraphEditor editor, com.jgraph.editor.JGraphEditorKit kit)
          Adds the action bundles for JGraphpadEditAction, JGraphpadFileAction,JGraphpadViewAction, JGraphpadFormatActionand JGraphpadCellAction.
protected  void addPorts(javax.swing.tree.MutableTreeNode parent, java.awt.geom.Point2D[] offsets)
          Adds ports to parent using offsets as the port relative offsets.
protected  void addTools(com.jgraph.JGraphEditor editor, com.jgraph.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.
protected  void configureEdge(org.jgraph.graph.GraphCell edge)
          Hook for subclassers to configure the specified edge.
protected  void configureFactory(com.jgraph.JGraphEditor editor, com.jgraph.editor.JGraphEditorFactory factory)
          Hook for subclassers to configure new editor factories.
protected  void configureGraph(com.jgraph.JGraphEditor editor, org.jgraph.JGraph graph)
          Hook for subclassers to configure a new graph.
protected  void configureKit(com.jgraph.JGraphEditor editor, com.jgraph.editor.JGraphEditorKit kit)
          Boilerplate method for configuring new editor kits.
protected  void configureModel(com.jgraph.editor.JGraphEditorModel model)
          Hook for subclassers to configure new document models.
 void configurePort(org.jgraph.graph.GraphCell port, java.awt.geom.Point2D offset)
          Hook for subclassers to configure the specified port using the offset as the relative location.
protected  void configureVertex(org.jgraph.graph.GraphCell vertex)
          Hook for subclassers to configure the specified vertex.
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(java.lang.Object userObj)
          Returns a new DefaultEdge containing the specified user object.
protected  com.jgraph.pad.tool.JGraphpadEdgeTool createEdgeTool(java.lang.String name, java.lang.Object defaultValue, org.jgraph.graph.Edge.Routing routing)
          Helper method to create and return a new edge tool.
protected  java.lang.Object createEdgeUserObject(java.lang.Object value)
          Hook for subclassers to create a user object for edges that contains the specified value.
protected  com.jgraph.editor.JGraphEditorFactory createFactory(com.jgraph.JGraphEditor editor)
          Constructs a default factory for new editors.
protected  org.jgraph.JGraph createGraph(com.jgraph.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(java.lang.Object userObj)
          Returns a new DefaultGraphCell containing the specified user object.
protected  void createPlugins(com.jgraph.JGraphEditor editor)
          Hook for subclassers to create plugins for a new editor.
 org.jgraph.graph.GraphCell createPort(javax.swing.tree.MutableTreeNode parent, java.lang.Object userObject)
          Creates a port containing the specified user object and adds it to parent.
protected  java.lang.Object createPortUserObject(java.lang.Object value)
          Hook for subclassers to create a user object for ports that contains the specified value.
protected  com.jgraph.editor.JGraphEditorSettings createSettings(java.util.Map args)
          Constructs the editor settings.
 org.jgraph.graph.GraphCell createVertex()
          Hook for subclassers to construct vertices with default user objects.
 org.jgraph.graph.GraphCell createVertex(java.lang.Object userObj)
          Returns a new DefaultGraphCell containing the specified user object.
protected  com.jgraph.pad.tool.JGraphpadVertexTool createVertexTool(java.lang.String name, java.lang.Object defaultValue, int shape, javax.swing.ImageIcon icon)
          Invokes createVertexTool(String, Object, int, ImageIcon, boolean) with post editing set to false.
protected  com.jgraph.pad.tool.JGraphpadVertexTool createVertexTool(java.lang.String name, java.lang.Object defaultValue, int shape, javax.swing.ImageIcon icon, boolean postEdit)
          Helper method to create and return a new vertex tool.
protected  java.lang.Object createVertexUserObject(java.lang.Object value)
          Returns a new JGraphpadBusinessObjectfor the specified value.
 void destroy()
           
 java.lang.String getFileDescription()
           
 java.lang.String getFileName()
           
static boolean isImage(java.lang.String filename)
          Returns true if the specified filename has an image extension, namely one in ImageIO.getReaderFormatNames().
static void main(java.lang.String[] args)
          Constructs and displays a new application window.
 void setFileDescription(java.lang.String text)
           
 void setFileName(java.lang.String text)
           
 void start()
           
 void stop()
           
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IS_NEW

public static final java.lang.String IS_NEW
See Also:
Constant Field Values

CREATE_ID

public static final java.lang.String CREATE_ID
See Also:
Constant Field Values

VERSION_NUMBER

public static final java.lang.String VERSION_NUMBER
Global static product identifier.

See Also:
Constant Field Values

APPTITLE

public static final java.lang.String APPTITLE
Holds the application title for dialogs.

See Also:
Constant Field Values

VERSION

public static final java.lang.String VERSION
Global static product identifier.

See Also:
Constant Field Values

ARG_SYSTEMLOOKANDFEEL

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

See Also:
Constant Field Values

ARG_JGOODIESLOOKANDFEEL

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

See Also:
Constant Field Values

ARG_VERSION

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

See Also:
Constant Field Values

PATH_UICONFIG

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

See Also:
Constant Field Values

PATH_DEFAULTSETTINGS

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

See Also:
Constant Field Values

NAME_UICONFIG

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

See Also:
Constant Field Values

KEY_GROUPPROTOTYPE

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

See Also:
Constant Field Values

KEY_VERTEXPROTOTYPE

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

See Also:
Constant Field Values

KEY_EDGEPROTOTYPE

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

See Also:
Constant Field Values

NAME_SELECTTOOL

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

See Also:
Constant Field Values

NAME_TEXTTOOL

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

See Also:
Constant Field Values

NAME_VERTEXTOOL

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

See Also:
Constant Field Values

NAME_ROUNDEDTOOL

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

See Also:
Constant Field Values

NAME_CIRCLETOOL

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

See Also:
Constant Field Values

NAME_DIAMONDTOOL

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

See Also:
Constant Field Values

NAME_TRIANGLETOOL

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

See Also:
Constant Field Values

NAME_CYLINDERTOOL

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

See Also:
Constant Field Values

NAME_IMAGETOOL

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

See Also:
Constant Field Values

NAME_HEAVYTOOL

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

See Also:
Constant Field Values

NAME_EDGETOOL

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

See Also:
Constant Field Values

NAME_ORTHOGONALEDGETOOL

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

See Also:
Constant Field Values

METHOD_CREATESHAPECOMBO

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

See Also:
Constant Field Values

METHOD_CREATEGRADIENTCOMBO

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

See Also:
Constant Field Values

METHOD_CREATELINECOLORCOMBO

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

See Also:
Constant Field Values

defaultPlugins

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


defaultPortLocations

public java.awt.geom.Point2D[] defaultPortLocations
Defines the default port locations.


defaultBounds

public java.awt.geom.Rectangle2D defaultBounds
Defines the default vertex bounds.


defaultBorderColor

public java.awt.Color defaultBorderColor
Defines the default border color.


defaultEdgeFont

public java.awt.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.

Constructor Detail

DiagramEditorApplet

public DiagramEditorApplet()
Method Detail

createSettings

protected com.jgraph.editor.JGraphEditorSettings createSettings(java.util.Map args)
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.

configureModel

protected void configureModel(com.jgraph.editor.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.

configureKit

protected void configureKit(com.jgraph.JGraphEditor editor,
                            com.jgraph.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(com.jgraph.JGraphEditor editor,
                          com.jgraph.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(com.jgraph.JGraphEditor editor,
                        com.jgraph.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 com.jgraph.pad.tool.JGraphpadVertexTool createVertexTool(java.lang.String name,
                                                                   java.lang.Object defaultValue,
                                                                   int shape,
                                                                   javax.swing.ImageIcon icon)
Invokes createVertexTool(String, Object, int, ImageIcon, boolean) with post editing set to false.


createVertexTool

protected com.jgraph.pad.tool.JGraphpadVertexTool createVertexTool(java.lang.String name,
                                                                   java.lang.Object defaultValue,
                                                                   int shape,
                                                                   javax.swing.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 com.jgraph.pad.tool.JGraphpadEdgeTool createEdgeTool(java.lang.String name,
                                                               java.lang.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 com.jgraph.editor.JGraphEditorFactory createFactory(com.jgraph.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(com.jgraph.JGraphEditor editor,
                                com.jgraph.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(com.jgraph.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(com.jgraph.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(com.jgraph.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(java.lang.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(java.lang.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(javax.swing.tree.MutableTreeNode parent,
                        java.awt.geom.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(javax.swing.tree.MutableTreeNode parent,
                                             java.lang.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,
                          java.awt.geom.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(java.lang.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 java.lang.Object createEdgeUserObject(java.lang.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 java.lang.Object createPortUserObject(java.lang.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 java.lang.Object createVertexUserObject(java.lang.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(java.lang.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.

main

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

Throws:
java.lang.Exception

start

public void start()

stop

public void stop()

destroy

public void destroy()

getFileName

public java.lang.String getFileName()

getFileDescription

public java.lang.String getFileDescription()

setFileName

public void setFileName(java.lang.String text)

setFileDescription

public void setFileDescription(java.lang.String text)


Copyright © 2006 Hammurapi Group. All Rights Reserved.