JGraph X 0.15.0.3


com.mxgraph.view
Class mxGraph

java.lang.Object
  extended by com.mxgraph.util.mxEventSource
      extended by com.mxgraph.view.mxGraph

public class mxGraph
extends mxEventSource

Implements a graph object that allows to create diagrams from a graph model and stylesheet.

Images

To create an image from a graph, use the following code for a given XML document (doc) and File (file): Image img = mxCellRenderer.createBufferedImage( graph, null, 1, Color.WHITE, false, null); ImageIO.write(img, "png", file); If the XML is given as a string rather than a document, the document can be obtained using mxUtils.parse.


Nested Class Summary
static interface mxGraph.mxICellVisitor
           
 
Nested classes/interfaces inherited from class com.mxgraph.util.mxEventSource
mxEventSource.mxEventListener, mxEventSource.mxIEventSource
 
Field Summary
protected  boolean allowDanglingEdges
          Specifies if edges with disconnected terminals are allowed in the graph.
protected  boolean allowLoops
          Specifies if loops (aka self-references) are allowed.
protected  String alternateEdgeStyle
          Specifies the alternate edge style to be used if the main control point on an edge is being doubleclicked.
protected  boolean autoLayout
          Specifies if automatic layout should be carried out if a non-null value is returned from getLayout.
protected  boolean autoSize
          Specifies if the graph should automatically update the cell size after an edit.
protected  boolean bendable
          Specifies the return value for isBendable.
protected  int border
          Border to be added to the bottom and right side when the container is being resized after the graph has been changed.
protected  boolean bubbleLayout
          Specifies if parent layouts should be executed when children have been layouted.
protected  PropertyChangeSupport changeSupport
          Property change event handling.
protected  boolean cloneable
          Specifies the return value for isCloneable.
protected  boolean cloneInvalidEdges
          Specifies if edges that are cloned should be validated and only inserted if they are valid.
protected  mxImage collapsedImage
          Specifies the mxImage to indicate a collapsed state.
protected  boolean collapseToPreferredSize
          Specifies if the cell size should be changed to the preferred size when a cell is first collapsed.
protected  boolean connectableEdges
          Specifies if edges are connectable.
protected  mxEdgeStyle.mxEdgeStyleFunction defaultLoopStyle
          Specifies the default style for loops.
protected  double defaultOverlap
          Value returned by getOverlap if isAllowOverlapParent returns true for the given cell.
protected  Object defaultParent
          Specifies the default parent to be used to insert new cells.
protected  boolean deletable
          Specifies the return value for isDeletable.
protected  boolean disconnectable
          Specifies the return value for isDisconntable.
protected  boolean disconnectOnMove
          Specifies if edges should be disconnected from their terminals when they are moved.
protected  boolean dropEnabled
          Specifies the return value for isDropEnabled.
protected  boolean edgeLabelsMovable
          Specifies the return value for edges in isLabelMovable.
protected  boolean editable
          Specifies the return value for isEditable.
protected  boolean enabled
          Specifies the return value for isEnabled.
static String EVENT_ADD
           
static String EVENT_AFTER_ADD
           
static String EVENT_AFTER_COLLAPSE
           
static String EVENT_AFTER_CONNECT
           
static String EVENT_AFTER_DISCONNECT
           
static String EVENT_AFTER_EXPAND
           
static String EVENT_AFTER_HIDE
           
static String EVENT_AFTER_LAYOUT
           
static String EVENT_AFTER_MOVE
           
static String EVENT_AFTER_REMOVE
           
static String EVENT_AFTER_RESIZE
           
static String EVENT_AFTER_SHOW
           
static String EVENT_AFTER_UPDATESIZE
           
static String EVENT_BEFORE_ADD
           
static String EVENT_BEFORE_COLLAPSE
           
static String EVENT_BEFORE_CONNECT
           
static String EVENT_BEFORE_DISCONNECT
           
static String EVENT_BEFORE_EXPAND
           
static String EVENT_BEFORE_HIDE
           
static String EVENT_BEFORE_LAYOUT
           
static String EVENT_BEFORE_MOVE
           
static String EVENT_BEFORE_REMOVE
           
static String EVENT_BEFORE_RESIZE
           
static String EVENT_BEFORE_SHOW
           
static String EVENT_BEFORE_UPDATESIZE
           
static String EVENT_CLONE
           
static String EVENT_COLLAPSE
           
static String EVENT_CONNECT
           
static String EVENT_DISCONNECT
           
static String EVENT_EXPAND
           
static String EVENT_FLIP
           
static String EVENT_HIDE
           
static String EVENT_INDEX_CHANGED
           
static String EVENT_LAYOUT
           
static String EVENT_MOVE
           
static String EVENT_REMOVE
           
static String EVENT_REPAINT
           
static String EVENT_RESIZE
           
static String EVENT_SHOW
           
static String EVENT_UPDATESIZE
           
protected  mxImage expandedImage
          Specifies the mxImage to indicate a expanded state.
protected  boolean extendParentOnResize
          Specifies if a parent should contain the child bounds after a resize of the child.
protected  mxEventSource.mxEventListener fullRepaintHandler
          Fires repaint events for full repaints.
protected  mxEventSource.mxEventListener graphModelChangeHandler
          Fires repaint events for model changes.
protected  boolean gridEnabled
          Specifies if the grid is enabled.
protected  int gridSize
          Specifies the grid size.
protected  boolean htmlLabels
          Specifies the return value for isHtmlLabel.
protected  boolean keepEdgesInBackground
          Specifies if edges should appear in the background regardless of their order in the model.
protected  boolean keepEdgesInForeground
          Specifies if edges should appear in the foreground regardless of their order in the model.
protected  boolean keepInsideParentOnMove
          Specifies the return value for isKeepInsideParentOnMove.
protected  boolean labelsVisible
          Specifies if labels should be visible.
protected  boolean locked
          Specifies the return value for isLocked.
protected  mxRectangle maximumContainerSize
          mxRectangle that specifies the maximum size of the container if resizeContainer is true.
protected  mxRectangle maximumGraphBounds
           that specifies the area in which all cells in the diagram should be placed.
protected  mxRectangle minimumContainerSize
          mxRectangle that specifies the minimum size of the container if resizeContainer is true.
protected  mxIGraphModel model
          Holds the model that contains the cells to be displayed.
protected  boolean movable
          Specifies the return value for isMovable.
protected  boolean multigraph
          Specifies if multiple edges in the same direction between the same pair of vertices are allowed.
protected  mxMultiplicity[] multiplicities
          Specifies the multiplicities to be used for validation of the graph.
protected  boolean resetEdgesOnMove
          Specifies if edge control points should be reset after the move of a connected cell.
protected  boolean resetEdgesOnResize
          Specifies if loops (aka self-references) are allowed.
protected  boolean selectable
          Specifies the return value for isSelectable.
protected  mxSelectionModel selection
          Holds the that models the current selection.
protected  boolean shiftDownwards
          Specifies if the cells below a resized cell should be shifted downwards.
protected  boolean shiftRightwards
          Specifies if the cells to the right of a resized cell should be shifted rightwards.
protected  boolean sizable
          Specifies the return value for isSizable.
protected  mxStylesheet stylesheet
          Holds the stylesheet that defines the appearance of the cells.
protected  boolean swimlaneNesting
          Specifies if nesting of swimlanes is allowed.
static String VERSION
          Holds the version number of this release.
protected  boolean vertexLabelsMovable
          Specifies the return value for vertices in isLabelMovable.
protected  mxGraphView view
          Holds the view that caches the cell states.
protected  mxImage warningImage
          Specifies the mxImage for the image to be used to display a warning overlay.
 
Fields inherited from class com.mxgraph.util.mxEventSource
EMPTY_ARRAY, eventListeners, eventsEnabled, source
 
Constructor Summary
mxGraph()
          Constructs a new graph with an empty mxGraphModel.
mxGraph(mxIGraphModel model)
          Constructs a new graph for the specified model.
mxGraph(mxIGraphModel model, mxStylesheet stylesheet)
          Constructs a new graph for the specified model.
mxGraph(mxStylesheet stylesheet)
          Constructs a new graph for the specified model.
 
Method Summary
 Object addCell(Object cell)
          Adds the given cell to the children of the default parent.
 Object addCell(Object cell, Object parent)
          Adds the given cell to the children of the given parent.
 Object addCell(Object cell, Object parent, Integer index, Object source, Object target)
          Adds the given cell to the children of the given parent at the given index.
 Object[] addCells(Object[] cells)
          Adds the given cells to the children of the default parent.
 Object[] addCells(Object[] cells, Object parent)
          Adds the given cells to the children of the given parent.
 Object[] addCells(Object[] cells, Object parent, Integer index)
          Adds the given cells to the children of the given parent starting at the given index and fires an add event.
 Object addEdge(Object edge, Object source, Object target)
          Adds the given edge to the model.
 Object addEdge(Object edge, Object parent, Object source, Object target, Integer index)
          Adds the given edge to the children of the given parent at the given index.
 Object addGroup(Object group, Object[] cells)
           
 Object addGroup(Object group, Object[] cells, double border)
          Sets the bounds of the given group to cover the area of the given cells and adds the given border around the area.
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
           
 void alignCells(String align)
          Aligns the selection cells vertically or horizontally according to the given alignment.
 void alignCells(String align, Object[] cells)
          Aligns the given cells vertically or horizontally according to the given alignment.
 void alignCells(String align, Object[] cells, Object param)
          Aligns the given cells vertically or horizontally according to the given alignment using the optional parameter as the coordinate.
 void cascadeResize(Object cell)
          Shifts the cells returned by after the resize of the given cell.
protected  void cellDrawn(Object cell, Object element, Object labelElement)
          Called when a cell has been painted as the specified object, typically a DOM node that represents the given cell graphically in a document.
protected  void cellRemoved(Object cell, boolean clearSelection)
          Removes all cached information for the given cell and its descendants and clears the cells selection state is isClearSelection is true.
 void cellsMoved(Object[] cells, Point location)
          Called from to invoke the hook in the automatic layout of each modified cell's parent.
 void clearSelection()
           
 Object[] cloneCells(Object[] cells)
          Returns the clones for the given cells.
 void collapse()
           
 void collapse(Object[] cells)
          Collapses the given cells or the selection cells if no cells are specified and fires a event.
 void collapse(Object[] cells, boolean recurse)
          Collapses the given cells or the selection cells if no cells are specified and fires a event.
 void connect(Object edge, Object terminal, boolean isSource)
          Assigns the given edge the new source or target terminal depending on isSource and fires a event.
 String convertValueToString(Object cell)
          Returns the textual representation for the given cell.
 Object createEdge(Object parent, String id, Object value, Object source, Object target, String style)
          Hook method that creates the new edge for insertEdge.
 Object createGroupCell(Object[] cells)
          Hook for creating the group cell to hold the given array of if no group cell was given to the function.
 Object createVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style)
          Hook method that creates the new vertex for insertVertex.
 void disconnect(Object[] cells)
          Disconnects the given edges from the terminals which are not in the given array.
 void draw(mxICanvas canvas)
          Draws the graph onto the given canvas.
 void drawCell(mxICanvas canvas, Object cell)
          Draws the given cell and its descendants onto the specified canvas.
 void drawStateWithLabel(mxICanvas canvas, mxCellState state, String label)
          Draws the given cell and label onto the specified canvas.
 void enterGroup()
           
 void enterGroup(Object cell)
          Uses the given cell as the root of the displayed cell hierarchy.
 void exitGroup()
          Changes the current root to the next valid root in the displayed cell hierarchy.
 void expand()
           
 void expand(Object[] cells)
          Expands the given cells or the selection cells if no cells are specified and fires an event.
 void expand(Object[] cells, boolean recurse)
          Expands the given cells or the selection cells if no cells are specified and fires an event.
 void extendParent(Object cell)
          Resizes the parents recursively so that they contain the complete area of the resized child cell.
 Object[] findTreeRoots(Object parent)
          Returns all visible children in the given parent which do not have incoming edges.
 Object[] findTreeRoots(Object parent, boolean isolate)
          Returns all visible children in the given parent which do not have incoming edges.
 Object[] findTreeRoots(Object parent, boolean isolate, boolean invert)
          Returns all visible children in the given parent which do not have incoming edges.
 Object flip(Object edge)
          Called when the main control point of the edge is double-clicked.
 String getAlternateEdgeStyle()
           
 int getBorder()
          Returns the value of .
 mxRectangle getBoundingBox(Object cell)
          Returns the bounds of the given cell.
 mxRectangle getBoundingBox(Object cell, boolean includeEdges)
          Returns the bounding box of the given cell including all connected edges if includeEdge is true.
 mxRectangle getBoundingBox(Object cell, boolean includeEdges, boolean includeDescendants)
          Returns the bounding box of the given cell including all connected edges if includeEdge is true.
 mxRectangle getBounds()
          Returns the bounds of the visible graph.
 mxRectangle getBoundsForCells(Object[] cells, boolean includeEdges, boolean includeDescendants, boolean boundingBox)
          Returns the bounds for the given cells.
 mxRectangle getCellBounds(Object cell)
          Returns the bounds of the given cell.
 mxRectangle getCellBounds(Object cell, boolean includeEdges)
          Returns the bounds of the given cell including all connected edges if includeEdge is true.
 mxRectangle getCellBounds(Object cell, boolean includeEdges, boolean includeDescendants)
          Returns the bounds of the given cell including all connected edges if includeEdge is true.
 mxRectangle getCellBounds(Object cell, boolean includeEdges, boolean includeDescendants, boolean boundingBox)
          Returns the bounds of the given cell including all connected edges if includeEdge is true.
 mxGeometry getCellGeometry(Object cell)
          Returns the geometry for the given cell.
 Object[] getCellsBeyond(double x0, double y0, Object parent, boolean rightHalfpane, boolean bottomHalfpane)
          Returns the children of the given parent that are contained in the halfpane from the given point (x0, y0) rightwards and downwards depending on rightHalfpane and bottomHalfpane.
 Object[] getCellsToShift(mxCellState state)
          Returns the cells to shift after a resize of the specified .
 Hashtable getCellStyle(Object cell)
          Returns an array of key, value pairs representing the cell style for the given cell.
 String getCellValidationError(Object cell)
          Checks all multiplicities that cannot be enforced while the graph is being modified, namely, all multiplicities that require a minimum of 1 edge.
 Object[] getChildCells(Object parent)
          Returns the visible children of the given parent.
 Object[] getChildCells(Object parent, boolean vertices, boolean edges)
          Returns the visible child vertices or edges in the given parent.
 Object[] getChildEdges(Object parent)
          Returns the visible child edges of the given parent.
 mxPoint getChildOffsetForCell(Object cell)
          Returns the offset to be used for the cells inside the given cell.
 Object[] getChildVertices(Object parent)
          Returns the visible child vertices of the given parent.
 Object[] getConnections(Object cell)
          Returns all visible edges connected to the given cell without loops.
 Object[] getConnections(Object cell, Object parent)
          Returns all visible edges connected to the given cell without loops.
 mxRectangle getContentArea(Object cell)
          Returns the mxRectangle inside which a cell is to be kept.
 Object getCurrentRoot()
          Returns the current root of the displayed cell hierarchy.
 mxEdgeStyle.mxEdgeStyleFunction getDefaultLoopStyle()
          Returns the default edge style used for loops.
 Object getDefaultParent()
          Returns the first child of the root in the model, that is, the first or default layer of the diagram.
 Object getDropTarget(Object[] cells, Point pt, Object cell)
          Function: getDropTarget Returns the given cell if it is a drop target for the given cells or the nearest ancestor that may be used as a drop target for the given cells.
 Object[] getEdges(Object cell)
          Returns all visible edges connected to the given cell including loops.
 Object[] getEdges(Object cell, Object parent)
          Returns all visible edges connected to the given cell including loops.
 Object[] getEdges(Object cell, Object parent, boolean incoming, boolean outgoing, boolean includeLoops)
          Returns the incoming and/or outgoing edges for the given cell.
 Object[] getEdgesBetween(Object source, Object target)
          Returns the edges between the given source and target.
 Object[] getEdgesBetween(Object source, Object target, boolean directed)
          Returns the edges between the given source and target.
 String getEdgeValidationError(Object edge, Object source, Object target)
          Returns the validation error message to be displayed when inserting or changing an edges' connectivity.
 int getGridSize()
          Returns the grid size.
 String getImage(mxCellState state)
          Returns the image URL for the given cell state.
 Object[] getIncomingEdges(Object cell)
          Returns all incoming visible edges connected to the given cell without loops.
 Object[] getIncomingEdges(Object cell, Object parent)
          Returns the visible incoming edges for the given cell.
 String getLabel(Object cell)
          Returns a string or DOM node that represents the label for the given cell.
 mxIGraphLayout getLayout(Object cell)
          /** Returns the layout to be used to arrange the children of the given cell.
protected  String getLinkForCell(Object cell)
          Returns the hyperlink to be used for the given cell.
 mxRectangle getMaximumContainerSize()
          Returns the maximum size of the diagram.
 mxRectangle getMaximumGraphBounds()
           
 mxRectangle getMinimumContainerSize()
          Returns the minimum size of the diagram.
 mxIGraphModel getModel()
          Returns the graph model that contains the graph data.
 mxMultiplicity[] getMultiplicities()
           
 Object[] getOpposites(Object[] edges, Object terminal)
          Returns all distinct visible opposite cells of the terminal on the given edges.
 Object[] getOpposites(Object[] edges, Object terminal, boolean sources, boolean targets)
          Returns all distincts visible opposite cells for the specified terminal on the given edges.
 Object[] getOutgoingEdges(Object cell)
          Returns all outgoing visible edges connected to the given cell without loops.
 Object[] getOutgoingEdges(Object cell, Object parent)
          Returns the visible outgoing edges for the given cell.
 double getOverlap(Object cell)
          Returns a decimal number representing the amount of the width and height of the given cell that is allowed to overlap its parent.
 mxRectangle getPaintBounds(Object[] cells)
          Returns the bounding box of the given cells and their descendants.
 Object[] getParents(Object[] cells)
          Returns an array that represents the set (no duplicates) of all parents for the given array of mxCells.
 mxRectangle getPreferredSizeForCell(Object cell)
          Returns the preferred width and height of the given as an .
 mxSelectionModel getSelection()
           
 Object getSelectionCell()
           
 Object[] getSelectionCells()
           
 int getSelectionCount()
           
 mxRectangle getStartSize(Object swimlane)
          Returns the start size of the given swimlane, that is, the width or height of the part that contains the title, depending on the horizontal style.
 mxStylesheet getStylesheet()
          Returns the stylesheet that provides the style.
protected  String getTargetForCell(Object cell)
          Returns the hyperlink to be used for the given cell.
 String getToolTipForCell(Object cell)
          Returns the tooltip to be used for the given cell.
 mxPoint getTranslateForRoot(Object cell)
          Returns the translation to be used if the given cell is the root cell as an .
 mxGraphView getView()
          Returns the view that contains the cell states.
 mxRectangle graphModelChanged(mxIGraphModel sender, List changes)
          Called when the graph model changes.
 Object group()
           
 Object group(Object group)
           
 Object group(Object group, double border)
           
 Object group(Object group, double border, Object[] tmp)
          Puts the selection cells into the given group using border around the children and the group bounds.
 Object groupCells(Object parent, Object group, Object[] cells, double dx, double dy)
          Adds the group into the given parent and the given cells into the group.
 Object[] hide()
          Hides the seletion cells.
 Object[] hide(Object[] cells, boolean includeEdges)
          Hides the given cells.
 Object[] hideEdges(Object cell, boolean recurse)
           
 void home()
          Uses the root of the model as the root of the displayed cell hierarchy and selects the previous root.
 Object insertEdge(Object parent, String id, Object value, Object source, Object target)
          Creates and adds a new edge with an empty style.
 Object insertEdge(Object parent, String id, Object value, Object source, Object target, String style)
          Adds a new edge into the given parent using value as the user object and the given source and target as the terminals of the new edge.
 Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height)
          Creates and adds a new vertex with an empty style.
 Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style)
          Adds a new vertex into the given parent using value as the user object and the given coordinates as the geometry of the new vertex.
 boolean isAllowDanglingEdges()
           
 boolean isAllowLoops()
           
 boolean isAllowOverlapParent(Object cell)
          Returns true if the given cell is allowed to be placed outside of the parents area.
 boolean isAutoLayout(Object cell)
          Returns true if the associated layout for the given cell should be executed automatically whenever a child was changed.
 boolean isBendable(Object cell)
          Returns true if the given cell is bendable.
 boolean isBubbleLayout()
          Returns true if a layout should bubble, that is, if the parent layout should be executed whenever a cell layout (layout of the children of a cell) has been executed.
 boolean isCellCloneable(Object cell)
          Returns true if the given cell is visible.
 boolean isCellCollapsed(Object cell)
          Returns true if the given cell is collapsed in this graph.
 boolean isCellVisible(Object cell)
          Returns true if the given cell is visible in this graph.
 boolean isCloneable()
          Returns true if the graph is , that is, if it allows cloning of cells by using control-drag.
 boolean isCloneInvalidEdges()
           
 boolean isCollapsable(Object cell)
          Returns true if the given cell is collapsable.
 boolean isConnectableEdges()
           
 boolean isDeletable(Object cell)
          Returns true if the given cell is movable.
 boolean isDisconnectable(Object cell, Object terminal, boolean source)
          Returns true if the given cell is disconnectable from the source or target terminal.
 boolean isDisconnectOnMove()
           
 boolean isDropEnabled()
          Returns true if the graph allows drop into other cells.
 boolean isEdgeLabelsMovable()
           
 boolean isEdgeValid(Object edge, Object source, Object target)
          Checks if the return value of getEdgeValidationError for the given arguments is null.
 boolean isEditable()
          Returns true if editing is allowed in this graph.
 boolean isEditable(Object cell)
          Returns true if the given cell is movable.
 boolean isEnabled()
          Returns true if the graph is .
 boolean isExpandable(Object cell)
          Returns true if the given cell is expandable.
 boolean isExtendParentOnResize(Object cell)
          Returns true if the parent of the given cell should be extended if the child has been resized so that it overlaps the parent.
 boolean isGridEnabled()
          Returns true if the grid is enabled.
 boolean isHtmlLabel(Object cell)
          Returns true if the label must be rendered as HTML markup.
 boolean isHtmlLabels()
           
 boolean isKeepEdgesInBackground()
           
 boolean isKeepEdgesInForeground()
           
 boolean isKeepInsideParentOnMove(Object cell)
          Returns true if the given cell should be kept inside the bounds of its parent according to the rules defined by getOverlap and isAllowOverlapParent.
 boolean isLabelMovable(Object cell)
          Returns true if the given edges's label is moveable.
 boolean isLabelsVisible()
           
 boolean isLocked(Object cell)
          Returns true if the given cell may not be moved, sized, bended, disconnected, edited or selected.
 boolean isLoop(mxCellState state)
          Returns true if the given cell state is a loop.
 boolean isMovable(Object cell)
          Returns true if the given cell is movable.
 boolean isMultigraph()
           
 boolean isOrthogonal(mxCellState edge, mxCellState vertex)
          Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments.
 boolean isParentDropTarget(Object target, Object[] cells)
          Returns true if the given target is a valid parent for the specified cells.
 boolean isResetEdgesOnMove()
           
 boolean isResetEdgesOnResize()
           
 boolean isSelectable(Object cell)
          Returns true if the given cell is selectable.
 boolean isSelected(Object cell)
           
 boolean isSelectionEmpty()
           
 boolean isShiftable(Object cell)
          Returns true if the cell requires shifting of all cells beyond the top right corner after a resize.
 boolean isShiftDownwards()
           
 boolean isShiftRightwards()
           
 boolean isSizable(Object cell)
          Returns true if the given cell is sizable.
 boolean isSplitDropTarget(Object edge, Object cell)
          Returns true if the given edge may be splitted into two edges with the given cell as a new terminal between the two.
 boolean isSwimlane(Object cell)
          Returns true if the given cell is a swimlane.
 boolean isSwimlaneNesting()
           
 boolean isUpdateSize(Object cell)
          Returns true if the size of the given cell should automatically be updated after a change of the label.
 boolean isValidConnection(Object source, Object target)
          Returns true if the given target cell is a valid target for source.
 boolean isValidDropTarget(Object cell, Object[] cells)
          Returns true if the given cell is a valid drop target for the specified cells.
 boolean isValidRoot(Object cell)
          Returns true if the given cell is a valid root for the cell display hierarchy.
 boolean isValidSource(Object cell)
          Returns true if the given cell is a valid source for new connections.
 boolean isValidTarget(Object cell)
          Returns isValidSource for the given cell.
 boolean isVertexLabelsMovable()
           
 void keepInside(Object[] cells)
          Keeps the given cells inside the bounds returned by for their respective parents, according to the rules defined by and if returns true.
 Object[] layout(Object[] cells)
           
 Object[] layoutAfterAdd(Object parent, Object[] cells)
          Called from add and addCell with the parent and the new child cells.
 Object[] layoutAfterCollapsedState(Object[] cells, boolean collapsed)
          Called from with the cells and the new collapsed state.
 Object[] layoutAfterConnect(Object edge, Object terminal, boolean isSource)
          Called from with the edge and terminal that have been connected.
 Object[] layoutAfterMove(Object[] parents, Object[] cells, Object target)
          Called from with the old and new parents and the cells that have been moved.
 Object[] layoutAfterRemove(Object[] parents, Object[] cells, boolean hide, boolean show)
          Called from with the previous parents of the removed, hidden or shown cells and the cells.
 Object[] layoutAfterResize(Object[] parents, Object[] cells)
          Called from with the cells have been resized.
 Object[] layoutAfterSplit(Object parent, Object edge, Object cell, Object newEdge)
          Called from with the parent, the old edge, cell and new edge.
static void main(String[] args)
          Prints the version number on the console.
 Object[] move(Object[] cells, double dx, double dy)
           
 Object[] move(Object[] cells, double dx, double dy, boolean clone)
           
 Object[] move(Object[] cells, double dx, double dy, boolean clone, Object target, Point location)
          Moves the given cells by the given vector (dx, dy) and clones the cells if clone is true.
 void moveInto(Object[] cells, Object target)
           
 void moveInto(Object[] cells, Object target, Point location)
          Appends the given cells to the children of the given target and fires a move event.
 mxRectangle processChange(Object change, boolean invalidate)
          Processes the given change and invalidates the respective cached data in .
 mxRectangle processChanges(List changes, boolean invalidate)
          Processes the changes and returns the minimal rectangle to be repainted in the buffer.
 void refresh()
          Clears all cell states or the states for the hierarchy starting at the given cell and validates the graph.
 Object[] remove()
          Removes the selection cells from the graph.
 Object[] remove(Object[] cells)
          Removes the given cells from the graph.
 Object[] remove(Object[] cells, boolean includeEdges)
          Removes the given cells from the graph.
 Object[] remove(Object[] cells, boolean includeEdges, boolean isHide, boolean isShow)
          Removes, shows or hides the given cells including the connected edges if includeEdges is true.
 Object[] removeEdges(Object cell, boolean recurse)
           
 Object[] removeEdges(Object cell, boolean recurse, boolean isHide, boolean isShow)
          Removes, shows or hides the edges connected to the given cell recursively.
 void removeFromParent()
          Removes the selection cells from their parents and adds them to the default parent returned by getDefaultParent.
 void removeFromParent(Object[] cells)
          Removes the specified cells from their parents and adds them to the default parent returned by getDefaultParent.
 void removePropertyChangeListener(PropertyChangeListener listener)
           
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
           
 void repaint()
          Fires a repaint event.
 void resetEdges(Object[] cells)
          Resets the control points of the edges that are connected to the given cells if not both ends of the edge are in the given cells array.
 void resize(Object cell, mxRectangle bounds)
          Sets the bounds of the given cell using .
 void resizeCells(Object[] cells, mxRectangle[] boundsArray)
          Sets the bounds of the given cells, cascades the resize using and fires a event.
 void select(boolean isNext, boolean isParent, boolean isChild)
          Selects the next, parent, first child or previous cell, if all arguments are false.
 void selectAll()
           
 void selectAll(Object parent)
          Selects all children of the given parent cell or the children of the default parent if no parent is specified.
 void selectCells(boolean vertices, boolean edges)
          Selects all vertices and/or edges depending on the given boolean arguments recursively, starting at the default parent.
 void selectCells(boolean vertices, boolean edges, Object parent)
          Selects all vertices and/or edges depending on the given boolean arguments recursively, starting at the given parent or the default parent if no parent is specified.
 void selectCellsForChanges(List changes)
           
 void selectChild()
          Selects the first child cell.
 void selectEdges()
          Selects all vertices inside the default parent.
 void selectEdges(Object parent)
          Selects all vertices inside the given parent or the default parent if no parent is given.
 void selectNext()
          Selects the next cell.
 void selectParent()
          Selects the parent cell.
 void selectPrevious()
          Selects the previous cell.
 void selectVertices()
          Selects all vertices inside the default parent.
 void selectVertices(Object parent)
          Selects all vertices inside the given parent or the default parent if no parent is given.
 void setAllowDanglingEdges(boolean allowDanglingEdges)
           
 void setAllowLoops(boolean allowLoops)
           
 void setAlternateEdgeStyle(String alternateEdgeStyle)
           
 void setAutoLayout(boolean autoLayout)
           
 void setBendable(boolean bendable)
          Sets if the graph is bendable.
 void setBorder(int border)
          Sets the value of .
 void setBubbleLayout(boolean bubbleLayout)
          Returns true if a layout should bubble, that is, if the parent layout should be executed whenever a cell layout (layout of the children of a cell) has been executed.
 void setCellStyle(String style)
          Sets the style of the selection cells to the given value.
 void setCellStyle(String style, Object[] cells)
          Sets the style of the specified cells.
 void setCellStyleFlags(String key, int flag, boolean value)
          Sets or toggles the given bit for the given key in the styles of the selection cells.
 void setCellStyleFlags(String key, int flag, Boolean value, Object[] cells)
          Sets or toggles the given bit for the given key in the styles of the specified cells.
 void setCellStyles(String key, String value)
          Sets the key to value in the styles of the selection cells.
 void setCellStyles(String key, String value, Object[] cells)
          Sets the key to value in the styles of the given cells.
 void setCloneable(boolean cloneable)
          Specifies if the graph should allow cloning of cells by holding down the control key while cells are being moved.
 void setCloneInvalidEdges(boolean cloneInvalidEdges)
           
 void setCollapsedState(boolean collapsed)
           
 void setCollapsedState(Object[] cells, boolean collapsed)
          Sets the collapsed state of the given cells or the selection cells if no cells are specified and fires a beforeCollapse, collapse and afterCollapse or beforeExpand, expand and afterExpand event.
 void setCollapsedState(Object[] cells, boolean collapsed, boolean recurse)
          Sets the collapsed state of the given cells or the selection cells if no cells are specified and fires a beforeCollapse, collapse and afterCollapse or beforeExpand, expand and afterExpand event.
 void setConnectableEdges(boolean connectableEdges)
           
 void setDefaultLoopStyle(mxEdgeStyle.mxEdgeStyleFunction loopStyle)
          Sets the default style used for loops.
 void setDeletable(boolean deletable)
          Specifies if the graph should allow deleting of cells.
 void setDisconnectable(boolean disconnectable)
          Specifies if the graph should allow disconnecting of edges.
 void setDisconnectOnMove(boolean disconnectOnMove)
           
 void setDropEnabled(boolean dropEnabled)
           
 void setEdgeLabelsMovable(boolean movable)
           
 void setEditable(boolean editable)
          Sets if the graph is editable.
 void setEnabled(boolean enabled)
          Specifies if the graph should allow any interactions.
 void setExtendParentOnResize(boolean extendParentOnResize)
           
 void setGridEnabled(boolean gridEnabled)
          Sets if the grid is enabled.
 void setGridSize(int gridSize)
          Sets the grid size and fires a property change event for gridSize.
 void setHtmlLabels(boolean htmlLabels)
           
 void setIndexForCells(Object[] cells, Integer index)
          Reinserts the given cells into their parent at the given index.
 void setKeepEdgesInBackground(boolean keepEdgesInBackground)
           
 void setKeepEdgesInForeground(boolean keepEdgesInForeground)
           
 void setKeepInsideParentOnMove(boolean keepInsideParentOnMove)
           
 void setLabelsVisible(boolean labelsVisible)
           
 void setLocked(boolean locked)
          Sets if any cell may be moved, sized, bended, disconnected, edited or selected.
 void setMaximumContainerSize(mxRectangle maximumContainerSize)
           
 void setMaximumGraphBounds(mxRectangle maximumGraphBounds)
           
 void setMinimumContainerSize(mxRectangle minimumContainerSize)
           
 void setModel(mxIGraphModel model)
          Sets the graph model that contains the data, and fires an EVENT_MODE_CHANGED followed by an EVENT_REPAINT event.
 void setMovable(boolean movable)
           
 void setMultigraph(boolean multigraph)
           
 void setMultiplicities(mxMultiplicity[] multiplicities)
           
 void setResetEdgesOnMove(boolean resetEdgesOnMove)
           
 void setResetEdgesOnResize(boolean resetEdgesOnResize)
           
 void setSelectable(boolean selectable)
          Sets the seletable state of the graph.
 void setSelectionCell(Object cell)
           
 void setSelectionCells(Collection cells)
           
 void setSelectionCells(Object[] cells)
           
 void setShiftDownwards(boolean shiftDownwards)
           
 void setShiftRightwards(boolean shiftRightwards)
           
 void setSizable(boolean sizable)
          Sets if the graph is sizable.
 void setStylesheet(mxStylesheet stylesheet)
          Sets the stylesheet that provides the style.
 void setSwimlaneNesting(boolean swimlaneNesting)
           
 void setUpdateSize(boolean updateSize)
          Specifies if cell sizes should be automatically updated after a label change.
 void setVertexLabelsMovable(boolean movable)
           
 void setView(mxGraphView view)
          Sets the view that contains the cell states and fires an EVENT_VIEW_CHANGED event.
 Object[] show()
          Shows the seletion cells.
 Object[] show(Object[] cells, boolean includeEdges)
          Shows the given cells.
 Object[] showEdges(Object cell, boolean recurse)
           
 double snap(double value)
          Snaps the given numeric value to the grid if is true.
 Object splitEdge(Object edge, Object cell)
           
 Object splitEdge(Object edge, Object cell, Object newEdge)
          Splits the given edge by adding a newEdge between the previous source and the given cell and reconnecting the source of the given edge to the given cell.
 void swapBounds(Object cell, boolean willCollapse)
          Swaps the alternate and the actual bounds in the geometry of the given cell invoking before carrying out the swap.
 void toBack()
          Moves the selection cells to the background.
 void toBack(Object[] cells)
          Moves the given cells to the background.
 void toFront()
          Brings the selection cells to the front.
 void toFront(Object[] cells)
          Brings the given cells to the front.
 void toggleCellStyle(String key, boolean defaultValue, Object cell)
          Toggles the boolean value for the given key in the style of the given cell.
 void toggleCellStyleFlags(String key, int flag)
          Toggles the given bit for the given key in the styles of the selection cells.
 void toggleCellStyleFlags(String key, int flag, Object[] cells)
          Toggles the given bit for the given key in the styles of the specified cells.
 void toggleCellStyles(String key, boolean defaultValue)
          Toggles the boolean value for the given key in the style of the selection cells.
 void toggleCellStyles(String key, boolean defaultValue, Object[] cells)
          Toggles the boolean value for the given key in the style of the given cells.
 void traverse(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor)
           
 void traverse(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor, Object edge, Set visited)
          Traverses the (directed) graph invoking the given function for each visited vertex and edge.
 void ungroup()
           
 void ungroup(Object[] cells)
          Ungroups the given group cells and selects the children.
 void updateAlternateBounds(Object cell, mxGeometry g, boolean willCollapse)
          Updates or sets the alternate bounds in the given geometry for the given cell depending on whether the cell is going to be collapsed.
 Object updateSize(Object cell)
          Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.
 mxGeometry updateSwimlaneSize(Object swimlane, mxGeometry geometry, mxRectangle pSize)
          Updates the size of the given swimlane and returns the updated geometry to be used in the model.
 String validate()
          Validates the graph by validating each descendant of the given cell or the root of the model.
 String validate(Object cell, Hashtable context)
          Validates the graph by validating each descendant of the given cell or the root of the model.
 String validateCell(Object cell, Hashtable context)
          Hook method for subclassers to return an error message for the given cell and validation context.
 String validateEdge(Object edge, Object source, Object target)
          Hook method for subclassers to return an error message for the given edge and terminals.
 
Methods inherited from class com.mxgraph.util.mxEventSource
addListener, fireEvent, fireEvent, fireEvent, isEventsEnabled, removeListener, removeListener, setEventsEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
Holds the version number of this release. Current version is 0.15.0.3.

See Also:
Constant Field Values

EVENT_BEFORE_SHOW

public static String EVENT_BEFORE_SHOW

EVENT_BEFORE_HIDE

public static String EVENT_BEFORE_HIDE

EVENT_BEFORE_REMOVE

public static String EVENT_BEFORE_REMOVE

EVENT_SHOW

public static String EVENT_SHOW

EVENT_HIDE

public static String EVENT_HIDE

EVENT_REMOVE

public static String EVENT_REMOVE

EVENT_AFTER_SHOW

public static String EVENT_AFTER_SHOW

EVENT_AFTER_HIDE

public static String EVENT_AFTER_HIDE

EVENT_AFTER_REMOVE

public static String EVENT_AFTER_REMOVE

EVENT_BEFORE_MOVE

public static String EVENT_BEFORE_MOVE

EVENT_MOVE

public static String EVENT_MOVE

EVENT_CLONE

public static String EVENT_CLONE

EVENT_AFTER_MOVE

public static String EVENT_AFTER_MOVE

EVENT_BEFORE_ADD

public static String EVENT_BEFORE_ADD

EVENT_ADD

public static String EVENT_ADD

EVENT_AFTER_ADD

public static String EVENT_AFTER_ADD

EVENT_BEFORE_CONNECT

public static String EVENT_BEFORE_CONNECT

EVENT_CONNECT

public static String EVENT_CONNECT

EVENT_AFTER_CONNECT

public static String EVENT_AFTER_CONNECT

EVENT_BEFORE_DISCONNECT

public static String EVENT_BEFORE_DISCONNECT

EVENT_DISCONNECT

public static String EVENT_DISCONNECT

EVENT_AFTER_DISCONNECT

public static String EVENT_AFTER_DISCONNECT

EVENT_BEFORE_RESIZE

public static String EVENT_BEFORE_RESIZE

EVENT_RESIZE

public static String EVENT_RESIZE

EVENT_AFTER_RESIZE

public static String EVENT_AFTER_RESIZE

EVENT_BEFORE_COLLAPSE

public static String EVENT_BEFORE_COLLAPSE

EVENT_COLLAPSE

public static String EVENT_COLLAPSE

EVENT_AFTER_COLLAPSE

public static String EVENT_AFTER_COLLAPSE

EVENT_BEFORE_EXPAND

public static String EVENT_BEFORE_EXPAND

EVENT_EXPAND

public static String EVENT_EXPAND

EVENT_AFTER_EXPAND

public static String EVENT_AFTER_EXPAND

EVENT_BEFORE_LAYOUT

public static String EVENT_BEFORE_LAYOUT

EVENT_LAYOUT

public static String EVENT_LAYOUT

EVENT_AFTER_LAYOUT

public static String EVENT_AFTER_LAYOUT

EVENT_BEFORE_UPDATESIZE

public static String EVENT_BEFORE_UPDATESIZE

EVENT_UPDATESIZE

public static String EVENT_UPDATESIZE

EVENT_AFTER_UPDATESIZE

public static String EVENT_AFTER_UPDATESIZE

EVENT_FLIP

public static String EVENT_FLIP

EVENT_INDEX_CHANGED

public static String EVENT_INDEX_CHANGED

EVENT_REPAINT

public static String EVENT_REPAINT

changeSupport

protected PropertyChangeSupport changeSupport
Property change event handling.


model

protected mxIGraphModel model
Holds the model that contains the cells to be displayed.


view

protected mxGraphView view
Holds the view that caches the cell states.


stylesheet

protected mxStylesheet stylesheet
Holds the stylesheet that defines the appearance of the cells.


selection

protected mxSelectionModel selection
Holds the that models the current selection.


gridSize

protected int gridSize
Specifies the grid size. Default is 10.


gridEnabled

protected boolean gridEnabled
Specifies if the grid is enabled. Default is true.


defaultOverlap

protected double defaultOverlap
Value returned by getOverlap if isAllowOverlapParent returns true for the given cell. getOverlap is used in keepInside if isKeepInsideParentOnMove returns true. The value specifies the portion of the child which is allowed to overlap the parent.


defaultParent

protected Object defaultParent
Specifies the default parent to be used to insert new cells. This is used in getDefaultParent. Default is null.


alternateEdgeStyle

protected String alternateEdgeStyle
Specifies the alternate edge style to be used if the main control point on an edge is being doubleclicked. Default is null.


enabled

protected boolean enabled
Specifies the return value for isEnabled. Default is true.


locked

protected boolean locked
Specifies the return value for isLocked. Default is false.


cloneable

protected boolean cloneable
Specifies the return value for isCloneable. Default is true.


editable

protected boolean editable
Specifies the return value for isEditable. Default is true.


deletable

protected boolean deletable
Specifies the return value for isDeletable. Default is true.


movable

protected boolean movable
Specifies the return value for isMovable. Default is true.


edgeLabelsMovable

protected boolean edgeLabelsMovable
Specifies the return value for edges in isLabelMovable. Default is true.


vertexLabelsMovable

protected boolean vertexLabelsMovable
Specifies the return value for vertices in isLabelMovable. Default is false.


dropEnabled

protected boolean dropEnabled
Specifies the return value for isDropEnabled. Default is false.


sizable

protected boolean sizable
Specifies the return value for isSizable. Default is true.


bendable

protected boolean bendable
Specifies the return value for isBendable. Default is true.


disconnectable

protected boolean disconnectable
Specifies the return value for isDisconntable. Default is true.


selectable

protected boolean selectable
Specifies the return value for isSelectable. Default is true.


autoSize

protected boolean autoSize
Specifies if the graph should automatically update the cell size after an edit. This is used in isUpdateSize. Default is false.


autoLayout

protected boolean autoLayout
Specifies if automatic layout should be carried out if a non-null value is returned from getLayout. Default is true.


bubbleLayout

protected boolean bubbleLayout
Specifies if parent layouts should be executed when children have been layouted. Default is true.


maximumGraphBounds

protected mxRectangle maximumGraphBounds
that specifies the area in which all cells in the diagram should be placed. Uses in getMaximumGraphBounds. Use a width or height of 0 if you only want to give a upper, left corner.


minimumContainerSize

protected mxRectangle minimumContainerSize
mxRectangle that specifies the minimum size of the container if resizeContainer is true.


maximumContainerSize

protected mxRectangle maximumContainerSize
mxRectangle that specifies the maximum size of the container if resizeContainer is true.


border

protected int border
Border to be added to the bottom and right side when the container is being resized after the graph has been changed. Default is 0.


keepEdgesInForeground

protected boolean keepEdgesInForeground
Specifies if edges should appear in the foreground regardless of their order in the model. This has precendence over keepEdgeInBackground Default is false.


keepEdgesInBackground

protected boolean keepEdgesInBackground
Specifies if edges should appear in the background regardless of their order in the model. Default is false.


keepInsideParentOnMove

protected boolean keepInsideParentOnMove
Specifies the return value for isKeepInsideParentOnMove. Default is true.


extendParentOnResize

protected boolean extendParentOnResize
Specifies if a parent should contain the child bounds after a resize of the child. Default is true.


shiftDownwards

protected boolean shiftDownwards
Specifies if the cells below a resized cell should be shifted downwards. Default is false.


shiftRightwards

protected boolean shiftRightwards
Specifies if the cells to the right of a resized cell should be shifted rightwards. Default is false.


collapseToPreferredSize

protected boolean collapseToPreferredSize
Specifies if the cell size should be changed to the preferred size when a cell is first collapsed. Default is true.


resetEdgesOnResize

protected boolean resetEdgesOnResize
Specifies if loops (aka self-references) are allowed. Default is false.


resetEdgesOnMove

protected boolean resetEdgesOnMove
Specifies if edge control points should be reset after the move of a connected cell. Default is false.


allowLoops

protected boolean allowLoops
Specifies if loops (aka self-references) are allowed. Default is false.


multiplicities

protected mxMultiplicity[] multiplicities
Specifies the multiplicities to be used for validation of the graph.


defaultLoopStyle

protected mxEdgeStyle.mxEdgeStyleFunction defaultLoopStyle
Specifies the default style for loops.


multigraph

protected boolean multigraph
Specifies if multiple edges in the same direction between the same pair of vertices are allowed. Default is true.


connectableEdges

protected boolean connectableEdges
Specifies if edges are connectable. Default is false. This overrides the connectable field in edges.


allowDanglingEdges

protected boolean allowDanglingEdges
Specifies if edges with disconnected terminals are allowed in the graph. Default is false.


cloneInvalidEdges

protected boolean cloneInvalidEdges
Specifies if edges that are cloned should be validated and only inserted if they are valid. Default is true.


disconnectOnMove

protected boolean disconnectOnMove
Specifies if edges should be disconnected from their terminals when they are moved. Default is true.


labelsVisible

protected boolean labelsVisible
Specifies if labels should be visible. This is used in getLabel. Default is true.


htmlLabels

protected boolean htmlLabels
Specifies the return value for isHtmlLabel. Default is false.


swimlaneNesting

protected boolean swimlaneNesting
Specifies if nesting of swimlanes is allowed. Default is true.


collapsedImage

protected mxImage collapsedImage
Specifies the mxImage to indicate a collapsed state. Default value is mxClient.imageBasePath+'collapsed.gif'


expandedImage

protected mxImage expandedImage
Specifies the mxImage to indicate a expanded state. Default value is mxClient.imageBasePath+'expanded.gif'


warningImage

protected mxImage warningImage
Specifies the mxImage for the image to be used to display a warning overlay. See setWarning. Default value is mxClient.imageBasePath+'warning'


fullRepaintHandler

protected mxEventSource.mxEventListener fullRepaintHandler
Fires repaint events for full repaints.


graphModelChangeHandler

protected mxEventSource.mxEventListener graphModelChangeHandler
Fires repaint events for model changes.

Constructor Detail

mxGraph

public mxGraph()
Constructs a new graph with an empty mxGraphModel.


mxGraph

public mxGraph(mxIGraphModel model)
Constructs a new graph for the specified model. If no model is specified, then a new, empty mxGraphModel is used.

Parameters:
model - Model that contains the graph data

mxGraph

public mxGraph(mxStylesheet stylesheet)
Constructs a new graph for the specified model. If no model is specified, then a new, empty mxGraphModel is used.

Parameters:
stylesheet - The stylesheet to use for the graph.

mxGraph

public mxGraph(mxIGraphModel model,
               mxStylesheet stylesheet)
Constructs a new graph for the specified model. If no model is specified, then a new, empty mxGraphModel is used.

Parameters:
model - Model that contains the graph data
Method Detail

getModel

public mxIGraphModel getModel()
Returns the graph model that contains the graph data.

Returns:
Returns the model that contains the graph data

setModel

public void setModel(mxIGraphModel model)
Sets the graph model that contains the data, and fires an EVENT_MODE_CHANGED followed by an EVENT_REPAINT event.

Parameters:
model - Model that contains the graph data

getStylesheet

public mxStylesheet getStylesheet()
Returns the stylesheet that provides the style.

Returns:
Returns the stylesheet that provides the style.

setStylesheet

public void setStylesheet(mxStylesheet stylesheet)
Sets the stylesheet that provides the style.

Parameters:
stylesheet - Stylesheet that provides the style.

getView

public mxGraphView getView()
Returns the view that contains the cell states.

Returns:
Returns the view that contains the cell states

setView

public void setView(mxGraphView view)
Sets the view that contains the cell states and fires an EVENT_VIEW_CHANGED event.

Parameters:
view - View that contains the cell states

selectCellsForChanges

public void selectCellsForChanges(List changes)

graphModelChanged

public mxRectangle graphModelChanged(mxIGraphModel sender,
                                     List changes)
Called when the graph model changes. Invokes processChange on each item of the given array to update the view accordingly.


processChanges

public mxRectangle processChanges(List changes,
                                  boolean invalidate)
Processes the changes and returns the minimal rectangle to be repainted in the buffer. A return value of null means no repaint is required.


processChange

public mxRectangle processChange(Object change,
                                 boolean invalidate)
Processes the given change and invalidates the respective cached data in . This fires a event if the root has changed in the model.


cellRemoved

protected void cellRemoved(Object cell,
                           boolean clearSelection)
Removes all cached information for the given cell and its descendants and clears the cells selection state is isClearSelection is true. This is called when a cell has been removed from the model.


getCellStyle

public Hashtable getCellStyle(Object cell)
Returns an array of key, value pairs representing the cell style for the given cell. If no string is defined in the model that specifies the style, then the default style for the cell is returned or , if not style can be found.

Parameters:
cell - Cell whose style should be returned.
Returns:
Returns the style of the cell.

setCellStyle

public void setCellStyle(String style)
Sets the style of the selection cells to the given value.

Parameters:
style - String representing the new style of the cells.

setCellStyle

public void setCellStyle(String style,
                         Object[] cells)
Sets the style of the specified cells. If no cells are given, then the selection cells are changed.

Parameters:
style - String representing the new style of the cells.
cells - Optional array of to set the style for. Default is the selection cells.

toggleCellStyle

public void toggleCellStyle(String key,
                            boolean defaultValue,
                            Object cell)
Toggles the boolean value for the given key in the style of the given cell. If no cell is specified then the selection cell is used.

Parameters:
key - Key for the boolean value to be toggled.
defaultValue - Default boolean value if no value is defined.
cell - Cell whose style should be modified.

toggleCellStyles

public void toggleCellStyles(String key,
                             boolean defaultValue)
Toggles the boolean value for the given key in the style of the selection cells.

Parameters:
key - Key for the boolean value to be toggled.
defaultValue - Default boolean value if no value is defined.

toggleCellStyles

public void toggleCellStyles(String key,
                             boolean defaultValue,
                             Object[] cells)
Toggles the boolean value for the given key in the style of the given cells. If no cells are specified, then the selection cells are used. For example, this can be used to toggle mxConstants.STYLE_ROUNDED or any other style with a boolean value.

Parameters:
key - String representing the key of the boolean style to be toggled.
defaultValue - Default boolean value if no value is defined.
cells - Cells whose styles should be modified.

setCellStyles

public void setCellStyles(String key,
                          String value)
Sets the key to value in the styles of the selection cells.

Parameters:
key - String representing the key to be assigned.
value - String representing the new value for the key.

setCellStyles

public void setCellStyles(String key,
                          String value,
                          Object[] cells)
Sets the key to value in the styles of the given cells. This will modify the existing cell styles in-place and override any existing assignment for the given key. If no cells are specified, then the selection cells are changed. If no value is specified, then the respective key is removed from the styles.

Parameters:
key - String representing the key to be assigned.
value - String representing the new value for the key.
cells - Array of cells to change the style for.

toggleCellStyleFlags

public void toggleCellStyleFlags(String key,
                                 int flag)
Toggles the given bit for the given key in the styles of the selection cells.

Parameters:
key - String representing the key to toggle the flag in.
flag - Integer that represents the bit to be toggled.

toggleCellStyleFlags

public void toggleCellStyleFlags(String key,
                                 int flag,
                                 Object[] cells)
Toggles the given bit for the given key in the styles of the specified cells.

Parameters:
key - String representing the key to toggle the flag in.
flag - Integer that represents the bit to be toggled.
cells - Optional array of to change the style for. Default is the selection cells.

setCellStyleFlags

public void setCellStyleFlags(String key,
                              int flag,
                              boolean value)
Sets or toggles the given bit for the given key in the styles of the selection cells.

Parameters:
key - String representing the key to toggle the flag in.
flag - Integer that represents the bit to be toggled.
value - Boolean value to be used or null if the value should be toggled.

setCellStyleFlags

public void setCellStyleFlags(String key,
                              int flag,
                              Boolean value,
                              Object[] cells)
Sets or toggles the given bit for the given key in the styles of the specified cells.

Parameters:
key - String representing the key to toggle the flag in.
flag - Integer that represents the bit to be toggled.
value - Boolean value to be used or null if the value should be toggled.
cells - Optional array of cells to change the style for. If no cells are specified then the selection cells are used.

alignCells

public void alignCells(String align)
Aligns the selection cells vertically or horizontally according to the given alignment.

Parameters:
align - Specifies the alignment. Possible values are all constants in mxConstants with an ALIGN prefix.

alignCells

public void alignCells(String align,
                       Object[] cells)
Aligns the given cells vertically or horizontally according to the given alignment.

Parameters:
align - Specifies the alignment. Possible values are all constants in mxConstants with an ALIGN prefix.
cells - Array of cells to be aligned.

alignCells

public void alignCells(String align,
                       Object[] cells,
                       Object param)
Aligns the given cells vertically or horizontally according to the given alignment using the optional parameter as the coordinate.

Parameters:
align - Specifies the alignment. Possible values are all constants in mxConstants with an ALIGN prefix.
cells - Array of cells to be aligned.
param - Optional coordinate for the alignment.

flip

public Object flip(Object edge)
Called when the main control point of the edge is double-clicked. This implementation switches between null (default) and alternateEdgeStyle and resets the edges control points. Finally, a flip event is fired before endUpdate is called on the model.

Parameters:
edge - Cell that represents the edge to be flipped.
Returns:
Returns the edge that has been flipped.

toBack

public void toBack()
Moves the selection cells to the background.


toBack

public void toBack(Object[] cells)
Moves the given cells to the background. If no cells are given, then the selection cells are used.

Parameters:
cells - Array of cells to move to the background.

toFront

public void toFront()
Brings the selection cells to the front.


toFront

public void toFront(Object[] cells)
Brings the given cells to the front. If no cells are given, then the selection cells are used.

Parameters:
cells - Array of cells to bring to front.

setIndexForCells

public void setIndexForCells(Object[] cells,
                             Integer index)
Reinserts the given cells into their parent at the given index. If the given index is null then the cells are appended.

Parameters:
cells - Optional array of cells to be reinserted. Default is the selection cells.
index - Integer that specifies the new index or null to append.

cloneCells

public Object[] cloneCells(Object[] cells)
Returns the clones for the given cells. If the terminal of an edge is not in the given array, then the respective end is assigned a terminal point and the terminal is removed.

Parameters:
cells - Array of mxCells to be cloned.
Returns:
Returns the clones of the given cells.

insertVertex

public Object insertVertex(Object parent,
                           String id,
                           Object value,
                           double x,
                           double y,
                           double width,
                           double height)
Creates and adds a new vertex with an empty style.


insertVertex

public Object insertVertex(Object parent,
                           String id,
                           Object value,
                           double x,
                           double y,
                           double width,
                           double height,
                           String style)
Adds a new vertex into the given parent using value as the user object and the given coordinates as the geometry of the new vertex. The id and style are used for the respective properties of the new cell, which is returned.

Parameters:
parent - Cell that specifies the parent of the new vertex.
id - Optional string that defines the Id of the new vertex.
value - Object to be used as the user object.
x - Integer that defines the x coordinate of the vertex.
y - Integer that defines the y coordinate of the vertex.
width - Integer that defines the width of the vertex.
height - Integer that defines the height of the vertex.
style - Optional string that defines the cell style.
Returns:
Returns the new vertex that has been inserted.

createVertex

public Object createVertex(Object parent,
                           String id,
                           Object value,
                           double x,
                           double y,
                           double width,
                           double height,
                           String style)
Hook method that creates the new vertex for insertVertex.

Parameters:
parent - Cell that specifies the parent of the new vertex.
id - Optional string that defines the Id of the new vertex.
value - Object to be used as the user object.
x - Integer that defines the x coordinate of the vertex.
y - Integer that defines the y coordinate of the vertex.
width - Integer that defines the width of the vertex.
height - Integer that defines the height of the vertex.
style - Optional string that defines the cell style.
Returns:
Returns the new vertex to be inserted.

insertEdge

public Object insertEdge(Object parent,
                         String id,
                         Object value,
                         Object source,
                         Object target)
Creates and adds a new edge with an empty style.


insertEdge

public Object insertEdge(Object parent,
                         String id,
                         Object value,
                         Object source,
                         Object target,
                         String style)
Adds a new edge into the given parent using value as the user object and the given source and target as the terminals of the new edge. The Id and style are used for the respective properties of the new cell, which is returned.

Parameters:
parent - Cell that specifies the parent of the new edge.
id - Optional string that defines the Id of the new edge.
value - Object to be used as the user object.
source - Cell that defines the source of the edge.
target - Cell that defines the target of the edge.
style - Optional string that defines the cell style.
Returns:
Returns the new edge that has been inserted.

createEdge

public Object createEdge(Object parent,
                         String id,
                         Object value,
                         Object source,
                         Object target,
                         String style)
Hook method that creates the new edge for insertEdge.

Parameters:
parent - Cell that specifies the parent of the new edge.
id - Optional string that defines the Id of the new edge.
value - Object to be used as the user object.
source - Cell that defines the source of the edge.
target - Cell that defines the target of the edge.
style - Optional string that defines the cell style.
Returns:
Returns the new edge to be inserted.

addEdge

public Object addEdge(Object edge,
                      Object source,
                      Object target)
Adds the given edge to the model.


addEdge

public Object addEdge(Object edge,
                      Object parent,
                      Object source,
                      Object target,
                      Integer index)
Adds the given edge to the children of the given parent at the given index. If source and target are specified, then they will be used as the new source and target terminals and connect events will be fired for each end. Finally, a add event is fired for the inserted edge and the inserted edge is returned.

Parameters:
edge - Cell to be inserted into the given parent.
parent - Cell that represents the new parent. Default is defaultParent.
source - Optional Cell that represents the source terminal.
target - Optional Cell that represents the target terminal.
index - Optional index to insert the cells at. Default is to append.
Returns:
Returns the cell that has been inserted.

addCell

public Object addCell(Object cell)
Adds the given cell to the children of the default parent.

Parameters:
cell - Cell to be inserted into the default parent.
Returns:
Returns the cell that has been added.

addCell

public Object addCell(Object cell,
                      Object parent)
Adds the given cell to the children of the given parent.

Parameters:
cell - Cell to be inserted into the given parent.
Returns:
Returns the cell that has been added.

addCell

public Object addCell(Object cell,
                      Object parent,
                      Integer index,
                      Object source,
                      Object target)
Adds the given cell to the children of the given parent at the given index. If source and target are specified, then they will be used as the new source and target terminals and connect events will be fired for each end. Finally, a add event is fired for the inserted cell and layoutAfterAdd is called. After the display has been updated an afterAdd event is fired for the new cell.

Parameters:
cell - Cell to be inserted into the given parent.
parent - Object that represents the new parent. If no parent is given then the default parent is used.
index - Optional index to insert the cells at. Default is to append.
source - Optional cell that represents the source terminal.
target - Optional cell that represents the target terminal.
Returns:
Returns the cell that has been added.

addCells

public Object[] addCells(Object[] cells)
Adds the given cells to the children of the default parent.

Parameters:
cells - Array of cells to be inserted.
Returns:
Returns the cells that have been added.

addCells

public Object[] addCells(Object[] cells,
                         Object parent)
Adds the given cells to the children of the given parent.

Parameters:
cells - Array of cells to be inserted.
parent - Optional cell that represents the new parent. If no parent is specified then the default parent is used.
Returns:
Returns the cells that have been added.

addCells

public Object[] addCells(Object[] cells,
                         Object parent,
                         Integer index)
Adds the given cells to the children of the given parent starting at the given index and fires an add event. The automatic layout is called using layoutAfterAdd. After the display has been updated an afterAddd event is fired for the new cells.

Parameters:
cells - Array of cells to be inserted.
parent - Optional cell that represents the new parent. If no parent is specified then the default parent is used.
index - Optional index to insert the cells at. Default is to append.
Returns:
Returns the cells that have been added.

layoutAfterAdd

public Object[] layoutAfterAdd(Object parent,
                               Object[] cells)
Called from add and addCell with the parent and the new child cells. This invokes layout on the parent cell.

Parameters:
parent - Object that represents the parent of the new cells.
cells - Array of cells that have been added.

splitEdge

public Object splitEdge(Object edge,
                        Object cell)

splitEdge

public Object splitEdge(Object edge,
                        Object cell,
                        Object newEdge)
Splits the given edge by adding a newEdge between the previous source and the given cell and reconnecting the source of the given edge to the given cell. Fires the respective connect and add events and invokes layoutAfterSplit to carry out the automatic layout. After the display has been updated an afterAdd event is fired for the new edge.

Parameters:
edge - Object that represents the edge to be splitted.
cell - Object that represents the cell to insert into the edge.
newEdge - Object that represents the edge to be inserted.
Returns:
Returns the new edge that has been inserted.

layoutAfterSplit

public Object[] layoutAfterSplit(Object parent,
                                 Object edge,
                                 Object cell,
                                 Object newEdge)
Called from with the parent, the old edge, cell and new edge. This invokes on the parent cell.

Parameters:
parent - that represents the parent of the new edge.
edge - that represents the edge that has been split.
cell - that represents the old source of the edge.
newEdge - that represents the inserted edge.

remove

public Object[] remove()
Removes the selection cells from the graph.

Returns:
Returns the cells that have been removed.

remove

public Object[] remove(Object[] cells)
Removes the given cells from the graph.

Returns:
Returns the cells that have been removed.

remove

public Object[] remove(Object[] cells,
                       boolean includeEdges)
Removes the given cells from the graph. If includeEdges is true then all connected edges are removed as well.

Returns:
Returns all cells that have been removed.

hide

public Object[] hide()
Hides the seletion cells.

Returns:
Returns the cells that have been hidden.

hide

public Object[] hide(Object[] cells,
                     boolean includeEdges)
Hides the given cells. If includeEdges is true then all connected edges are hidden as well.

Returns:
Returns all cells that have been hidden.

show

public Object[] show()
Shows the seletion cells.

Returns:
Returns the cells that have been shown.

show

public Object[] show(Object[] cells,
                     boolean includeEdges)
Shows the given cells. If includeEdges is true then all connected edges are shown as well.

Returns:
Returns all cells that have been shown.

remove

public Object[] remove(Object[] cells,
                       boolean includeEdges,
                       boolean isHide,
                       boolean isShow)
Removes, shows or hides the given cells including the connected edges if includeEdges is true. If isShow is true, then the cells are shown, else if isHide is true, then the cells are hidden. Otherwise, the cells are removed. Fires a , or event depending on the action that has been carried out. After the display has been updated, a , or event is fired for the affected cells.


layoutAfterRemove

public Object[] layoutAfterRemove(Object[] parents,
                                  Object[] cells,
                                  boolean hide,
                                  boolean show)
Called from with the previous parents of the removed, hidden or shown cells and the cells. This invokes on the parent cells.

Parameters:
parents - Array of representing the old parents.
cells - Array of that have been removed.
hide - Boolean indicating if the cells were hidden.
show - Boolean indicating if the cells were shown.

removeEdges

public Object[] removeEdges(Object cell,
                            boolean recurse)

hideEdges

public Object[] hideEdges(Object cell,
                          boolean recurse)

showEdges

public Object[] showEdges(Object cell,
                          boolean recurse)

removeEdges

public Object[] removeEdges(Object cell,
                            boolean recurse,
                            boolean isHide,
                            boolean isShow)
Removes, shows or hides the edges connected to the given cell recursively. If isShow is true, then the edges are shown, else if isHide is true, then the edges are hidden. Otherwise, the edges are removed. Fires a , or event depending on the action that has been carried out. After the display has been updated, a , or event is fired for the affected cells.

Parameters:
cell -
recurse -

updateSize

public Object updateSize(Object cell)
Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size. This function fires beforeUpdateSize and afterUpdateSize events.

Parameters:
cell - for which the size should be changed.

updateSwimlaneSize

public mxGeometry updateSwimlaneSize(Object swimlane,
                                     mxGeometry geometry,
                                     mxRectangle pSize)
Updates the size of the given swimlane and returns the updated geometry to be used in the model.

Parameters:
swimlane - that represents the swimlane to be udpated.
geometry -
pSize -

getPreferredSizeForCell

public mxRectangle getPreferredSizeForCell(Object cell)
Returns the preferred width and height of the given as an .

Parameters:
cell - for which the preferred size should be returned.

resize

public void resize(Object cell,
                   mxRectangle bounds)
Sets the bounds of the given cell using .

Parameters:
cell - whose bounds should be changed.
bounds - that represents the new bounds.

resizeCells

public void resizeCells(Object[] cells,
                        mxRectangle[] boundsArray)
Sets the bounds of the given cells, cascades the resize using and fires a event. If is true, then the parent is extended if a child size is changed so that it overlaps with the parent. This invokes before the transaction is closed.

Parameters:
cells - Array of whose bounds should be changed.
boundsArray - Array of that represents the new bounds.

layoutAfterResize

public Object[] layoutAfterResize(Object[] parents,
                                  Object[] cells)
Called from with the cells have been resized. This invokes on the child and parent cells and returns the result of the call to .

Parameters:
parents - Array of representing the parents of the cells.
cells - Array of that have been resized and are not collapsed.

cascadeResize

public void cascadeResize(Object cell)
Shifts the cells returned by after the resize of the given cell. This implementation uses the fact that the cell state in the view still contains the previous bounds when this function is called.

Parameters:
cell - that has been resized.

extendParent

public void extendParent(Object cell)
Resizes the parents recursively so that they contain the complete area of the resized child cell.

Parameters:
cell - that has been resized.

getCellsToShift

public Object[] getCellsToShift(mxCellState state)
Returns the cells to shift after a resize of the specified .


move

public Object[] move(Object[] cells,
                     double dx,
                     double dy)

move

public Object[] move(Object[] cells,
                     double dx,
                     double dy,
                     boolean clone)

move

public Object[] move(Object[] cells,
                     double dx,
                     double dy,
                     boolean clone,
                     Object target,
                     Point location)
Moves the given cells by the given vector (dx, dy) and clones the cells if clone is true. If a target is given, then the cells are appended as children in the given target. If cells are cloned then a clone event is fired while the transaction is in progress and a afterMove event is fired after the display has been updated.

Parameters:
cells - Array of cells to be moved.
dx - Integer that specifies the x-coordinate of the move.
dy - Integer that specifies the y-coordinate of the move.
clone - Boolean indicating if the cells should be cloned.
target - Cell that represents the new parent of the cells.
location - Location where the mouse was released.

getContentArea

public mxRectangle getContentArea(Object cell)
Returns the mxRectangle inside which a cell is to be kept.


getMaximumGraphBounds

public mxRectangle getMaximumGraphBounds()
Returns:
the maximumGraphBounds

setMaximumGraphBounds

public void setMaximumGraphBounds(mxRectangle maximumGraphBounds)
Parameters:
maximumGraphBounds - the maximumGraphBounds to set

removeFromParent

public void removeFromParent()
Removes the selection cells from their parents and adds them to the default parent returned by getDefaultParent.


removeFromParent

public void removeFromParent(Object[] cells)
Removes the specified cells from their parents and adds them to the default parent returned by getDefaultParent.

Parameters:
cells - Array of to be removed from their parents.

moveInto

public void moveInto(Object[] cells,
                     Object target)

moveInto

public void moveInto(Object[] cells,
                     Object target,
                     Point location)
Appends the given cells to the children of the given target and fires a move event.

Parameters:
cells - Array of mxCells to be moved inside the target.
target - mxCell that represents the new parent.
location - Point where the mouse was released.

cellsMoved

public void cellsMoved(Object[] cells,
                       Point location)
Called from to invoke the hook in the automatic layout of each modified cell's parent. The event is used to define the x- and y-coordinates passed to the move function.


keepInside

public void keepInside(Object[] cells)
Keeps the given cells inside the bounds returned by for their respective parents, according to the rules defined by and if returns true.

Parameters:
cells - Array of mxCells which should be kept inside their parents.

resetEdges

public void resetEdges(Object[] cells)
Resets the control points of the edges that are connected to the given cells if not both ends of the edge are in the given cells array.

Parameters:
cells - Array of mxCells for which the connected edges should be reset.

layoutAfterMove

public Object[] layoutAfterMove(Object[] parents,
                                Object[] cells,
                                Object target)
Called from with the old and new parents and the cells that have been moved. This invokes on the modified parents.


connect

public void connect(Object edge,
                    Object terminal,
                    boolean isSource)
Assigns the given edge the new source or target terminal depending on isSource and fires a event.


layoutAfterConnect

public Object[] layoutAfterConnect(Object edge,
                                   Object terminal,
                                   boolean isSource)
Called from with the edge and terminal that have been connected. This invokes on the parent of the terminal.


disconnect

public void disconnect(Object[] cells)
Disconnects the given edges from the terminals which are not in the given array.

Parameters:
cells - Array of to be disconnected.

getBounds

public mxRectangle getBounds()
Returns the bounds of the visible graph.


getCellBounds

public mxRectangle getCellBounds(Object cell)
Returns the bounds of the given cell.


getCellBounds

public mxRectangle getCellBounds(Object cell,
                                 boolean includeEdges)
Returns the bounds of the given cell including all connected edges if includeEdge is true.


getCellBounds

public mxRectangle getCellBounds(Object cell,
                                 boolean includeEdges,
                                 boolean includeDescendants)
Returns the bounds of the given cell including all connected edges if includeEdge is true.


getBoundingBox

public mxRectangle getBoundingBox(Object cell)
Returns the bounds of the given cell.


getBoundingBox

public mxRectangle getBoundingBox(Object cell,
                                  boolean includeEdges)
Returns the bounding box of the given cell including all connected edges if includeEdge is true.


getBoundingBox

public mxRectangle getBoundingBox(Object cell,
                                  boolean includeEdges,
                                  boolean includeDescendants)
Returns the bounding box of the given cell including all connected edges if includeEdge is true.


getPaintBounds

public mxRectangle getPaintBounds(Object[] cells)
Returns the bounding box of the given cells and their descendants.


getBoundsForCells

public mxRectangle getBoundsForCells(Object[] cells,
                                     boolean includeEdges,
                                     boolean includeDescendants,
                                     boolean boundingBox)
Returns the bounds for the given cells.


getCellBounds

public mxRectangle getCellBounds(Object cell,
                                 boolean includeEdges,
                                 boolean includeDescendants,
                                 boolean boundingBox)
Returns the bounds of the given cell including all connected edges if includeEdge is true.


refresh

public void refresh()
Clears all cell states or the states for the hierarchy starting at the given cell and validates the graph.


repaint

public void repaint()
Fires a repaint event.


snap

public double snap(double value)
Snaps the given numeric value to the grid if is true.

Parameters:
value - Numeric value to be snapped to the grid.
Returns:
Returns the value aligned to the grid.

isCellVisible

public boolean isCellVisible(Object cell)
Returns true if the given cell is visible in this graph. This implementation uses . Subclassers can override this to implement specific visibility for cells in only one graph, that is, without affecting the visible state of the cell. When using dynamic filter expressions for cell visibility, then the graph should be revalidated after the filter expression has changed.

Parameters:
cell - Cell whose visible state should be returned.
Returns:
Returns the visible state of the cell.

isCellCollapsed

public boolean isCellCollapsed(Object cell)
Returns true if the given cell is collapsed in this graph. This implementation uses . Subclassers can override this to implement specific collapsed states for cells in only one graph, that is, without affecting the collapsed state of the cell. When using dynamic filter expressions for the collapsed state, then the graph should be revalidated after the filter expression has changed.

Parameters:
cell - Cell whose collapsed state should be returned.
Returns:
Returns the collapsed state of the cell.

isOrthogonal

public boolean isOrthogonal(mxCellState edge,
                            mxCellState vertex)
Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments.

Parameters:
edge - Cell state that represents the edge.
vertex - Cell state that represents the vertex.

isLoop

public boolean isLoop(mxCellState state)
Returns true if the given cell state is a loop.

Parameters:
state - that represents a potential loop.
Returns:
Returns true if the given cell is a loop.

collapse

public void collapse()

collapse

public void collapse(Object[] cells)
Collapses the given cells or the selection cells if no cells are specified and fires a event.

Parameters:
cells - Optional array of to be collapsed. Default is the selection cells.

collapse

public void collapse(Object[] cells,
                     boolean recurse)
Collapses the given cells or the selection cells if no cells are specified and fires a event.

Parameters:
cells - Optional array of to be collapsed. Default is the selection cells.
recurse - Boolean indicating if the collapsed state of all descendants should be set.

expand

public void expand()

expand

public void expand(Object[] cells)
Expands the given cells or the selection cells if no cells are specified and fires an event.

Parameters:
cells - Optional array of to be expanded. Default is the selection cells.

expand

public void expand(Object[] cells,
                   boolean recurse)
Expands the given cells or the selection cells if no cells are specified and fires an event.

Parameters:
cells - Optional array of to be expanded. Default is the selection cells.
recurse - Boolean indicating if the collapsed state of all descendants should be set.

setCollapsedState

public void setCollapsedState(boolean collapsed)
Parameters:
collapsed -

setCollapsedState

public void setCollapsedState(Object[] cells,
                              boolean collapsed)
Sets the collapsed state of the given cells or the selection cells if no cells are specified and fires a beforeCollapse, collapse and afterCollapse or beforeExpand, expand and afterExpand event.

Parameters:
cells - Optional array of cells whose collapsed state should be set. Default is the selection cells.
collapsed - Boolean indicating the collapsed state to be assigned.

setCollapsedState

public void setCollapsedState(Object[] cells,
                              boolean collapsed,
                              boolean recurse)
Sets the collapsed state of the given cells or the selection cells if no cells are specified and fires a beforeCollapse, collapse and afterCollapse or beforeExpand, expand and afterExpand event.

Parameters:
cells - Optional array of cells whose collapsed state should be set. Default is the selection cells.
collapsed - Boolean indicating the collapsed state to be assigned.
recurse - Boolean indicating if the collapsed state of all descendants should be set.

layoutAfterCollapsedState

public Object[] layoutAfterCollapsedState(Object[] cells,
                                          boolean collapsed)
Called from with the cells and the new collapsed state. This invokes on the parents of the cells.

Parameters:
cells - Array of that have been collapsed or expanded.
collapsed - Boolean indicating if the cells have been collapsed.
Returns:
Returns the cells that have been layouted.

swapBounds

public void swapBounds(Object cell,
                       boolean willCollapse)
Swaps the alternate and the actual bounds in the geometry of the given cell invoking before carrying out the swap.

Parameters:
cell - for which the bounds should be swapped.
willCollapse - Boolean indicating if the cell is going to be collapsed.

updateAlternateBounds

public void updateAlternateBounds(Object cell,
                                  mxGeometry g,
                                  boolean willCollapse)
Updates or sets the alternate bounds in the given geometry for the given cell depending on whether the cell is going to be collapsed. If no alternate bounds are defined in the geometry and is true, then the preferred size is used for the alternate bounds. The top, left corner is always kept at the same location.

Parameters:
cell - for which the geometry is being udpated.
g - for which the alternate bounds should be updated.
willCollapse - Boolean indicating if the cell is going to be collapsed.

getCellGeometry

public mxGeometry getCellGeometry(Object cell)
Returns the geometry for the given cell.

Parameters:
cell - Cell whose geometry should be returned.
Returns:
Returns the geometry of the cell.

getCurrentRoot

public Object getCurrentRoot()
Returns the current root of the displayed cell hierarchy. This is a shortcut to in .

Returns:
Returns the current root in the view.

getTranslateForRoot

public mxPoint getTranslateForRoot(Object cell)
Returns the translation to be used if the given cell is the root cell as an . This implementation returns null.

Parameters:
cell -
Returns:
Returns the translation of the graph for the given root cell.

getChildOffsetForCell

public mxPoint getChildOffsetForCell(Object cell)
Returns the offset to be used for the cells inside the given cell. The root and layer cells may be identified using mxGraphModel.isRoot and mxGraphModel.isLayer. This implementation returns null.

Parameters:
cell - Cell whose offset should be returned.
Returns:
Returns the child offset for the given cell.

enterGroup

public void enterGroup()

enterGroup

public void enterGroup(Object cell)
Uses the given cell as the root of the displayed cell hierarchy. If no cell is specified then the selection cell is used. The cell is only used if returns true.

Parameters:
cell -

exitGroup

public void exitGroup()
Changes the current root to the next valid root in the displayed cell hierarchy.


home

public void home()
Uses the root of the model as the root of the displayed cell hierarchy and selects the previous root.


isValidRoot

public boolean isValidRoot(Object cell)
Returns true if the given cell is a valid root for the cell display hierarchy. This implementation returns true for all non-null values.

Parameters:
cell - which should be checked as a possible root.
Returns:
Returns true if the given cell is a valid root.

group

public Object group()
Returns:
Returns the group that has been inserted.

group

public Object group(Object group)
Parameters:
group -
Returns:
Returns the group that has been inserted.

group

public Object group(Object group,
                    double border)
Parameters:
group -
border -

group

public Object group(Object group,
                    double border,
                    Object[] tmp)
Puts the selection cells into the given group using border around the children and the group bounds. Only the selection cells that have the same parent as the first selection cell are added to the group. If no group is specified then a new vertex is created with an empty string user object. Finally, the group is selected.

Parameters:
group - that represents the target group.
border - Optional integer that specifies the border between the child area and the group bounds.
tmp - Optional array of cells to be grouped.

createGroupCell

public Object createGroupCell(Object[] cells)
Hook for creating the group cell to hold the given array of if no group cell was given to the function.

Parameters:
cells -
Returns:
Returns a new group cell.

ungroup

public void ungroup()

ungroup

public void ungroup(Object[] cells)
Ungroups the given group cells and selects the children.

Parameters:
cells - Optional array of to be ungrouped. Default is the selection cells.

addGroup

public Object addGroup(Object group,
                       Object[] cells)
Parameters:
group -
cells -
Returns:
Returns the group cell that has been inserted.

addGroup

public Object addGroup(Object group,
                       Object[] cells,
                       double border)
Sets the bounds of the given group to cover the area of the given cells and adds the given border around the area. If the group is a swimlane, then the title area is also taken into account. Returns the given group if the area of the children is not null.

Parameters:
group - that represents the new parent group.
cells - Array of to be added into the group.
border - Optional border for the group area in pixels.
Returns:
Returns the group cell that has been inserted.

groupCells

public Object groupCells(Object parent,
                         Object group,
                         Object[] cells,
                         double dx,
                         double dy)
Adds the group into the given parent and the given cells into the group. The cells are translated by (dx, dy) before being added into the group.

Parameters:
parent - that represents the parent of the group.
group - that represents the group to be added.
cells - Array of to be translated and added into the group.
dx - X-coordinate of the translation to be applied.
dy - Y-coordinate of the translation to be applied.

getLayout

public mxIGraphLayout getLayout(Object cell)
/** Returns the layout to be used to arrange the children of the given cell. The default implementation of this function is empty. It may be overridden to specify a layout to be executed for the children of the given cell after a child has been added, removed, collapsed, expanded, moved or (dis)connected, or after the parent has been resized. The layout is only executed if returns true for a given cell.


isBubbleLayout

public boolean isBubbleLayout()
Returns true if a layout should bubble, that is, if the parent layout should be executed whenever a cell layout (layout of the children of a cell) has been executed. This implementation returns .

Returns:
Returns true if the layout should bubble up along the cell hierarchy.

setBubbleLayout

public void setBubbleLayout(boolean bubbleLayout)
Returns true if a layout should bubble, that is, if the parent layout should be executed whenever a cell layout (layout of the children of a cell) has been executed. This implementation returns .

Parameters:
bubbleLayout -

isAutoLayout

public boolean isAutoLayout(Object cell)
Returns true if the associated layout for the given cell should be executed automatically whenever a child was changed.

Parameters:
cell -
Returns:
Returns true if the children of the given cell should be layouted.

setAutoLayout

public void setAutoLayout(boolean autoLayout)
Parameters:
autoLayout -

getParents

public Object[] getParents(Object[] cells)
Returns an array that represents the set (no duplicates) of all parents for the given array of mxCells.


layout

public Object[] layout(Object[] cells)
Parameters:
cells -
Returns:
Returns the cells that have been layouted.

setMultiplicities

public void setMultiplicities(mxMultiplicity[] multiplicities)

getMultiplicities

public mxMultiplicity[] getMultiplicities()

isEdgeValid

public boolean isEdgeValid(Object edge,
                           Object source,
                           Object target)
Checks if the return value of getEdgeValidationError for the given arguments is null.

Parameters:
edge - Cell that represents the edge to validate.
source - Cell that represents the source terminal.
target - Cell that represents the target terminal.

getEdgeValidationError

public String getEdgeValidationError(Object edge,
                                     Object source,
                                     Object target)
Returns the validation error message to be displayed when inserting or changing an edges' connectivity. A return value of null means the edge is valid, a return value of '' means it's not valid, but do not display an error message. Any other (non-empty) string returned from this method is displayed as an error message when trying to connect an edge to a source and target. This implementation uses the multiplicities, as well as multigraph and allowDanglingEdges to generate validation errors.

Parameters:
edge - Cell that represents the edge to validate.
source - Cell that represents the source terminal.
target - Cell that represents the target terminal.

validateEdge

public String validateEdge(Object edge,
                           Object source,
                           Object target)
Hook method for subclassers to return an error message for the given edge and terminals. This implementation returns null.

Parameters:
edge - Cell that represents the edge to validate.
source - Cell that represents the source terminal.
target - Cell that represents the target terminal.

validate

public String validate()
Validates the graph by validating each descendant of the given cell or the root of the model. Context is an object that contains the validation state for the complete validation run. The validation errors are attached to their cells using . This function returns true if no validation errors exist in the graph.


validate

public String validate(Object cell,
                       Hashtable context)
Validates the graph by validating each descendant of the given cell or the root of the model. Context is an object that contains the validation state for the complete validation run. The validation errors are attached to their cells using . This function returns true if no validation errors exist in the graph.

Parameters:
cell - Cell to start the validation recursion.
context - Object that represents the global validation state.

getCellValidationError

public String getCellValidationError(Object cell)
Checks all multiplicities that cannot be enforced while the graph is being modified, namely, all multiplicities that require a minimum of 1 edge.

Parameters:
cell - Cell for which the multiplicities should be checked.

validateCell

public String validateCell(Object cell,
                           Hashtable context)
Hook method for subclassers to return an error message for the given cell and validation context. This implementation returns null.

Parameters:
cell - Cell that represents the cell to validate.
context - Hashtable that represents the global validation state.

isLabelsVisible

public boolean isLabelsVisible()
Returns:
the labelsVisible

setLabelsVisible

public void setLabelsVisible(boolean labelsVisible)
Parameters:
labelsVisible - the labelsVisible to set

setHtmlLabels

public void setHtmlLabels(boolean htmlLabels)
Parameters:
htmlLabels - the htmlLabels to set

isHtmlLabels

public boolean isHtmlLabels()

convertValueToString

public String convertValueToString(Object cell)
Returns the textual representation for the given cell.

Parameters:
cell - Cell to be converted to a string.
Returns:
Returns the textual representation of the cell.

getLabel

public String getLabel(Object cell)
Returns a string or DOM node that represents the label for the given cell. This implementation uses if is true. Otherwise it returns an empty string.

Parameters:
cell - whose label should be returned.
Returns:
Returns the label for the given cell.

isHtmlLabel

public boolean isHtmlLabel(Object cell)
Returns true if the label must be rendered as HTML markup. The default implementation returns .

Parameters:
cell - whose label should be displayed as HTML markup.
Returns:
Returns true if the given cell label is HTML markup.

getToolTipForCell

public String getToolTipForCell(Object cell)
Returns the tooltip to be used for the given cell.


getStartSize

public mxRectangle getStartSize(Object swimlane)
Returns the start size of the given swimlane, that is, the width or height of the part that contains the title, depending on the horizontal style. The return value is an with either width or height set as appropriate.

Parameters:
swimlane - whose start size should be returned.
Returns:
Returns the startsize for the given swimlane.

getImage

public String getImage(mxCellState state)
Returns the image URL for the given cell state. This implementation returns the value stored under in the cell style.

Parameters:
state -
Returns:
Returns the image associated with the given cell state.

getBorder

public int getBorder()
Returns the value of .

Returns:
Returns the border.

setBorder

public void setBorder(int border)
Sets the value of .

Parameters:
border - Positive integer that represents the border to be used.

getDefaultLoopStyle

public mxEdgeStyle.mxEdgeStyleFunction getDefaultLoopStyle()
Returns the default edge style used for loops.

Returns:
Returns the default loop style.

setDefaultLoopStyle

public void setDefaultLoopStyle(mxEdgeStyle.mxEdgeStyleFunction loopStyle)
Sets the default style used for loops.

Parameters:
loopStyle - Default style to be used for loops.

isSwimlane

public boolean isSwimlane(Object cell)
Returns true if the given cell is a swimlane. This implementation always returns false.

Parameters:
cell - Cell that should be checked.
Returns:
Returns true if the cell is a swimlane.

isEnabled

public boolean isEnabled()
Returns true if the graph is .

Returns:
Returns true if the graph is enabled.

setEnabled

public void setEnabled(boolean enabled)
Specifies if the graph should allow any interactions. This implementation updates .

Parameters:
enabled - Boolean indicating if the graph should be enabled.

isLocked

public boolean isLocked(Object cell)
Returns true if the given cell may not be moved, sized, bended, disconnected, edited or selected. This implementation returns true for all vertices with a relative geometry if is false.

Parameters:
cell - whose locked state should be returned.
Returns:
Returns true if the given cell is locked.

setLocked

public void setLocked(boolean locked)
Sets if any cell may be moved, sized, bended, disconnected, edited or selected.

Parameters:
locked - Boolean that defines the new value for .

isCellCloneable

public boolean isCellCloneable(Object cell)
Returns true if the given cell is visible. This implementation returns true if the visible state of the cell in the model is true.

Parameters:
cell - Cell whose visible state should be returned.
Returns:
Returns the visible state of the cell.

isCloneable

public boolean isCloneable()
Returns true if the graph is , that is, if it allows cloning of cells by using control-drag.

Returns:
Returns true if the graph allows cloning.

setCloneable

public void setCloneable(boolean cloneable)
Specifies if the graph should allow cloning of cells by holding down the control key while cells are being moved. This implementation updates .

Parameters:
cloneable - Boolean indicating if the graph should be cloneable.

setSwimlaneNesting

public void setSwimlaneNesting(boolean swimlaneNesting)

isSwimlaneNesting

public boolean isSwimlaneNesting()

isMultigraph

public boolean isMultigraph()
Returns:
the multigraph

setMultigraph

public void setMultigraph(boolean multigraph)
Parameters:
multigraph - the multigraph to set

isAllowDanglingEdges

public boolean isAllowDanglingEdges()
Returns:
the allowDanglingEdges

setAllowDanglingEdges

public void setAllowDanglingEdges(boolean allowDanglingEdges)
Parameters:
allowDanglingEdges - the allowDanglingEdges to set

isCloneInvalidEdges

public boolean isCloneInvalidEdges()
Returns:
the cloneInvalidEdges

setCloneInvalidEdges

public void setCloneInvalidEdges(boolean cloneInvalidEdges)
Parameters:
cloneInvalidEdges - the cloneInvalidEdges to set

isDisconnectOnMove

public boolean isDisconnectOnMove()
Returns:
the disconnectOnMove

setDisconnectOnMove

public void setDisconnectOnMove(boolean disconnectOnMove)
Parameters:
disconnectOnMove - the disconnectOnMove to set

isAllowLoops

public boolean isAllowLoops()
Returns:
the allowLoops

setAllowLoops

public void setAllowLoops(boolean allowLoops)
Parameters:
allowLoops - the allowLoops to set

isConnectableEdges

public boolean isConnectableEdges()
Returns:
the connectableEdges

setConnectableEdges

public void setConnectableEdges(boolean connectableEdges)
Parameters:
connectableEdges - the connectableEdges to set

isResetEdgesOnMove

public boolean isResetEdgesOnMove()
Returns:
the resetEdgesOnMove

setResetEdgesOnMove

public void setResetEdgesOnMove(boolean resetEdgesOnMove)
Parameters:
resetEdgesOnMove - the resetEdgesOnMove to set

isResetEdgesOnResize

public boolean isResetEdgesOnResize()
Returns:
the resetEdgesOnResize

setResetEdgesOnResize

public void setResetEdgesOnResize(boolean resetEdgesOnResize)
Parameters:
resetEdgesOnResize - the resetEdgesOnResize to set

isShiftDownwards

public boolean isShiftDownwards()
Returns:
the shiftDownwards

setShiftDownwards

public void setShiftDownwards(boolean shiftDownwards)
Parameters:
shiftDownwards - the shiftDownwards to set

isShiftRightwards

public boolean isShiftRightwards()
Returns:
the shiftRightwards

setShiftRightwards

public void setShiftRightwards(boolean shiftRightwards)
Parameters:
shiftRightwards - the shiftRightwards to set

isSelectable

public boolean isSelectable(Object cell)
Returns true if the given cell is selectable. This implementation returns .

Parameters:
cell - whose selectable state should be returned.
Returns:
Returns true if the given cell is selectable.

setSelectable

public void setSelectable(boolean selectable)
Sets the seletable state of the graph.

Parameters:
selectable - Boolean indicating if the graph should allow selection of cells.

isDeletable

public boolean isDeletable(Object cell)
Returns true if the given cell is movable. This implementation always returns true.

Parameters:
cell - Cell whose movable state should be returned.
Returns:
Returns true if the cell is movable.

setDeletable

public void setDeletable(boolean deletable)
Specifies if the graph should allow deleting of cells. This implementation updates .

Parameters:
deletable - Boolean indicating if the graph should allow deletion of cells.

isLabelMovable

public boolean isLabelMovable(Object cell)
Returns true if the given edges's label is moveable. This returns for all given cells if does not return true for the given cell.

Parameters:
cell - whose label should be moved.
Returns:
Returns true if the label of the given cell is movable.

setVertexLabelsMovable

public void setVertexLabelsMovable(boolean movable)
Parameters:
movable -

isVertexLabelsMovable

public boolean isVertexLabelsMovable()

setEdgeLabelsMovable

public void setEdgeLabelsMovable(boolean movable)
Parameters:
movable -

isEdgeLabelsMovable

public boolean isEdgeLabelsMovable()

isMovable

public boolean isMovable(Object cell)
Returns true if the given cell is movable. This implementation returns movable.

Parameters:
cell - Cell whose movable state should be returned.
Returns:
Returns true if the cell is movable.

setMovable

public void setMovable(boolean movable)

isDropEnabled

public boolean isDropEnabled()
Returns true if the graph allows drop into other cells.


setDropEnabled

public void setDropEnabled(boolean dropEnabled)

isSizable

public boolean isSizable(Object cell)
Returns true if the given cell is sizable. This implementation return sizable.

Parameters:
cell - Cell whose sizable state should be returned.
Returns:
Returns true if the cell is sizable.

setSizable

public void setSizable(boolean sizable)
Sets if the graph is sizable.


isEditable

public boolean isEditable(Object cell)
Returns true if the given cell is movable. This implementation returns editable.

Parameters:
cell - Cell whose editable state should be returned.
Returns:
Returns true if the cell is editable.

isEditable

public boolean isEditable()
Returns true if editing is allowed in this graph.

Returns:
Returns true if the graph is editable.

setEditable

public void setEditable(boolean editable)
Sets if the graph is editable.


isValidSource

public boolean isValidSource(Object cell)
Returns true if the given cell is a valid source for new connections. This implementation returns true for all non-null values and is called by is called by .

Parameters:
cell - Object that represents a possible source or null.
Returns:
Returns true if the given cell is a valid source terminal.

isValidTarget

public boolean isValidTarget(Object cell)
Returns isValidSource for the given cell. This is called by isValidConnection.

Parameters:
cell - Object that represents a possible target or null.
Returns:
Returns true if the given cell is a valid target.

isValidConnection

public boolean isValidConnection(Object source,
                                 Object target)
Returns true if the given target cell is a valid target for source. This is a boolean implementation for not allowing connections between certain pairs of vertices and is called by . This implementation returns true if returns true for the source and returns true for the target.

Parameters:
source - Object that represents the source cell.
target - Object that represents the target cell.
Returns:
Returns true if the the connection between the given terminals is valid.

isBendable

public boolean isBendable(Object cell)
Returns true if the given cell is bendable. This implementation returns bendable. This is used in mxElbowEdgeHandler to determine if the middle handle should be shown.

Parameters:
cell - Cell whose bendable state should be returned.
Returns:
Returns true if the cell is bendable.

setBendable

public void setBendable(boolean bendable)
Sets if the graph is bendable.


isDisconnectable

public boolean isDisconnectable(Object cell,
                                Object terminal,
                                boolean source)
Returns true if the given cell is disconnectable from the source or target terminal. This returns for all given cells if does not return true for the given cell.

Parameters:
cell - whose disconnectable state should be returned.
terminal - that represents the source or target terminal.
source - Boolean indicating if the source or target terminal is to be disconnected.
Returns:
Returns true if the given edge can be disconnected from the given terminal.

setDisconnectable

public void setDisconnectable(boolean disconnectable)
Specifies if the graph should allow disconnecting of edges. This implementation updates disconnectable.

Parameters:
disconnectable - Boolean indicating if the graph should allow disconnecting of edges.

setUpdateSize

public void setUpdateSize(boolean updateSize)
Specifies if cell sizes should be automatically updated after a label change. This implementation sets autoSize to the given parameter.

Parameters:
updateSize - Boolean indicating if cells should be resized automatically.

isUpdateSize

public boolean isUpdateSize(Object cell)
Returns true if the size of the given cell should automatically be updated after a change of the label. This implementation returns autoSize for all given cells.

Parameters:
cell - Cell that should be resized.
Returns:
Returns true if the size of the given cell should be updated.

isExtendParentOnResize

public boolean isExtendParentOnResize(Object cell)
Returns true if the parent of the given cell should be extended if the child has been resized so that it overlaps the parent. This implementation returns extendParentOnResize.

Parameters:
cell - Cell that has been resized.

setExtendParentOnResize

public void setExtendParentOnResize(boolean extendParentOnResize)

isKeepInsideParentOnMove

public boolean isKeepInsideParentOnMove(Object cell)
Returns true if the given cell should be kept inside the bounds of its parent according to the rules defined by getOverlap and isAllowOverlapParent. This implementation returns keepInsideParentOnMove for all given cells.

Returns:
the keepInsideParentOnMove

setKeepInsideParentOnMove

public void setKeepInsideParentOnMove(boolean keepInsideParentOnMove)
Parameters:
keepInsideParentOnMove - the keepInsideParentOnMove to set

isKeepEdgesInForeground

public boolean isKeepEdgesInForeground()
Returns:
Returns true if edges are rendered in the foreground.

setKeepEdgesInForeground

public void setKeepEdgesInForeground(boolean keepEdgesInForeground)
Parameters:
keepEdgesInForeground - the keepEdgesInForeground to set

isKeepEdgesInBackground

public boolean isKeepEdgesInBackground()
Returns:
Returns true if edges are rendered in the background.

setKeepEdgesInBackground

public void setKeepEdgesInBackground(boolean keepEdgesInBackground)
Parameters:
keepEdgesInBackground - the keepEdgesInBackground to set

getMinimumContainerSize

public mxRectangle getMinimumContainerSize()
Returns the minimum size of the diagram.

Returns:
Returns the minimum container size.

setMinimumContainerSize

public void setMinimumContainerSize(mxRectangle minimumContainerSize)
Parameters:
minimumContainerSize - the minimumContainerSize to set

getMaximumContainerSize

public mxRectangle getMaximumContainerSize()
Returns the maximum size of the diagram.

Returns:
Returns the maximum container size,

setMaximumContainerSize

public void setMaximumContainerSize(mxRectangle maximumContainerSize)
Parameters:
maximumContainerSize - the maximumContainerSize to set

getOverlap

public double getOverlap(Object cell)
Returns a decimal number representing the amount of the width and height of the given cell that is allowed to overlap its parent. A value of 0 means all children must stay inside the parent, 1 means the child is allowed to be placed outside of the parent such that it touches one of the parents sides. If returns false for the given cell, then this method returns 0.

Parameters:
cell -
Returns:
Returns the overlapping value for the given cell inside its parent.

isAllowOverlapParent

public boolean isAllowOverlapParent(Object cell)
Returns true if the given cell is allowed to be placed outside of the parents area.

Parameters:
cell -
Returns:
Returns true if the given cell may overlap its parent.

isShiftable

public boolean isShiftable(Object cell)
Returns true if the cell requires shifting of all cells beyond the top right corner after a resize.

Parameters:
cell - to be checked for shifting of neighbors.
Returns:
Returns true if the given cell is shiftable.

isExpandable

public boolean isExpandable(Object cell)
Returns true if the given cell is expandable. This implementation returns true if the cell has at least one child.

Parameters:
cell - whose expandable state should be returned.
Returns:
Returns true if the given cell is expandable.

isCollapsable

public boolean isCollapsable(Object cell)
Returns true if the given cell is collapsable. This implementation calls for the given cell and returns the value.

Parameters:
cell - whose collapsable state should be returned.
Returns:
Returns true if the given cell is collapsable.

isGridEnabled

public boolean isGridEnabled()
Returns true if the grid is enabled.

Returns:
Returns the enabled state of the grid.

setGridEnabled

public void setGridEnabled(boolean gridEnabled)
Sets if the grid is enabled.

Parameters:
gridEnabled - Specifies if the grid should be enabled.

getGridSize

public int getGridSize()
Returns the grid size.

Returns:
Returns the grid size

setGridSize

public void setGridSize(int gridSize)
Sets the grid size and fires a property change event for gridSize.

Parameters:
gridSize - New grid size to be used.

getAlternateEdgeStyle

public String getAlternateEdgeStyle()
Returns:
the tolerance

setAlternateEdgeStyle

public void setAlternateEdgeStyle(String alternateEdgeStyle)
Parameters:
alternateEdgeStyle - the alternateEdgeStyle to set

isValidDropTarget

public boolean isValidDropTarget(Object cell,
                                 Object[] cells)
Returns true if the given cell is a valid drop target for the specified cells. If the given cell is an edge, then is used, else is used to compute the return value.

Parameters:
cell - Object that represents the possible drop target.
cells -
Returns:
Returns true if the cell is a valid drop target for the given cells.

isSplitDropTarget

public boolean isSplitDropTarget(Object edge,
                                 Object cell)
Returns true if the given edge may be splitted into two edges with the given cell as a new terminal between the two.

Parameters:
edge - Object that represents the edge to be splitted.
cell - Object that represents the new terminal.
Returns:
Returns true if the given edge may be splitted by the given cell.

isParentDropTarget

public boolean isParentDropTarget(Object target,
                                  Object[] cells)
Returns true if the given target is a valid parent for the specified cells.

Parameters:
target - Object that represents the target cell.
cells -
Returns:
Returns true if the given target is a possible parent for the given cells.

getDropTarget

public Object getDropTarget(Object[] cells,
                            Point pt,
                            Object cell)
Function: getDropTarget Returns the given cell if it is a drop target for the given cells or the nearest ancestor that may be used as a drop target for the given cells. If the given array contains a swimlane and is false then this always returns null. If no cell is given, then the bottommost swimlane at the location of the given event is returned. This function should only be used if returns true. Parameters: cells - Array of which are to be dropped onto the target. evt - Mouseevent for the drag and drop. cell - that is under the mousepointer.


getDefaultParent

public Object getDefaultParent()
Returns the first child of the root in the model, that is, the first or default layer of the diagram.

Returns:
Returns the default parent for new cells.

getChildVertices

public Object[] getChildVertices(Object parent)
Returns the visible child vertices of the given parent.

Parameters:
parent - Cell whose children should be returned.

getChildEdges

public Object[] getChildEdges(Object parent)
Returns the visible child edges of the given parent.

Parameters:
parent - Cell whose children should be returned.

getChildCells

public Object[] getChildCells(Object parent)
Returns the visible children of the given parent.

Parameters:
parent - Cell whose children should be returned.

getChildCells

public Object[] getChildCells(Object parent,
                              boolean vertices,
                              boolean edges)
Returns the visible child vertices or edges in the given parent. If vertices and edges is false, then all children are returned.

Parameters:
parent - Cell whose children should be returned.
vertices - Specifies if child vertices should be returned.
edges - Specifies if child edges should be returned.
Returns:
Returns the child vertices and edges.

getConnections

public Object[] getConnections(Object cell)
Returns all visible edges connected to the given cell without loops.

Parameters:
cell - Cell whose connections should be returned.
Returns:
Returns the connected edges for the given cell.

getConnections

public Object[] getConnections(Object cell,
                               Object parent)
Returns all visible edges connected to the given cell without loops. If the optional parent argument is specified, then only child edges of the given parent are returned.

Parameters:
cell - Cell whose connections should be returned.
parent - Optional parent of the opposite end for a connection to be returned.
Returns:
Returns the connected edges for the given cell.

getIncomingEdges

public Object[] getIncomingEdges(Object cell)
Returns all incoming visible edges connected to the given cell without loops.

Parameters:
cell - Cell whose incoming edges should be returned.
Returns:
Returns the incoming edges of the given cell.

getIncomingEdges

public Object[] getIncomingEdges(Object cell,
                                 Object parent)
Returns the visible incoming edges for the given cell. If the optional parent argument is specified, then only child edges of the given parent are returned.

Parameters:
cell - Cell whose incoming edges should be returned.
parent - Optional parent of the opposite end for an edge to be returned.
Returns:
Returns the incoming edges of the given cell.

getOutgoingEdges

public Object[] getOutgoingEdges(Object cell)
Returns all outgoing visible edges connected to the given cell without loops.

Parameters:
cell - Cell whose outgoing edges should be returned.
Returns:
Returns the outgoing edges of the given cell.

getOutgoingEdges

public Object[] getOutgoingEdges(Object cell,
                                 Object parent)
Returns the visible outgoing edges for the given cell. If the optional parent argument is specified, then only child edges of the given parent are returned.

Parameters:
cell - Cell whose outgoing edges should be returned.
parent - Optional parent of the opposite end for an edge to be returned.
Returns:
Returns the outgoing edges of the given cell.

getEdges

public Object[] getEdges(Object cell)
Returns all visible edges connected to the given cell including loops.

Parameters:
cell - Cell whose edges should be returned.
Returns:
Returns the edges of the given cell.

getEdges

public Object[] getEdges(Object cell,
                         Object parent)
Returns all visible edges connected to the given cell including loops.

Parameters:
cell - Cell whose edges should be returned.
parent - Optional parent of the opposite end for an edge to be returned.
Returns:
Returns the edges of the given cell.

getEdges

public Object[] getEdges(Object cell,
                         Object parent,
                         boolean incoming,
                         boolean outgoing,
                         boolean includeLoops)
Returns the incoming and/or outgoing edges for the given cell. If the optional parent argument is specified, then only edges are returned where the opposite is in the given parent cell.

Parameters:
cell - Cell whose edges should be returned.
parent - Optional parent of the opposite end for an edge to be returned.
incoming - Specifies if incoming edges should be included in the result.
outgoing - Specifies if outgoing edges should be included in the result.
includeLoops - Specifies if loops should be included in the result.
Returns:
Returns the edges connected to the given cell.

getOpposites

public Object[] getOpposites(Object[] edges,
                             Object terminal)
Returns all distinct visible opposite cells of the terminal on the given edges.

Parameters:
edges -
terminal -
Returns:
Returns the terminals at the opposite ends of the given edges.

getOpposites

public Object[] getOpposites(Object[] edges,
                             Object terminal,
                             boolean sources,
                             boolean targets)
Returns all distincts visible opposite cells for the specified terminal on the given edges.

Parameters:
edges - Edges whose opposite terminals should be returned.
terminal - Terminal that specifies the end whose opposite should be returned.
sources - Specifies if source terminals should be included in the result.
targets - Specifies if targer terminals should be included in the result.
Returns:
Returns the cells at the oppsite ends of the given edges.

getEdgesBetween

public Object[] getEdgesBetween(Object source,
                                Object target)
Returns the edges between the given source and target. This takes into account collapsed and invisible cells and returns the connected edges as displayed on the screen.

Parameters:
source -
target -
Returns:
Returns all edges between the given terminals.

getEdgesBetween

public Object[] getEdgesBetween(Object source,
                                Object target,
                                boolean directed)
Returns the edges between the given source and target. This takes into account collapsed and invisible cells and returns the connected edges as displayed on the screen.

Parameters:
source -
target -
directed -
Returns:
Returns all edges between the given terminals.

getCellsBeyond

public Object[] getCellsBeyond(double x0,
                               double y0,
                               Object parent,
                               boolean rightHalfpane,
                               boolean bottomHalfpane)
Returns the children of the given parent that are contained in the halfpane from the given point (x0, y0) rightwards and downwards depending on rightHalfpane and bottomHalfpane.

Parameters:
x0 - X-coordinate of the origin.
y0 - Y-coordinate of the origin.
parent - whose children should be checked.
rightHalfpane - Boolean indicating if the cells in the right halfpane from the origin should be returned.
bottomHalfpane - Boolean indicating if the cells in the bottom halfpane from the origin should be returned.
Returns:
Returns the cells beyond the given halfpane.

findTreeRoots

public Object[] findTreeRoots(Object parent)
Returns all visible children in the given parent which do not have incoming edges. If the result is empty then the with the greatest difference between incoming and outgoing edges is returned. This takes into account edges that are being promoted to the given root due to invisible children or collapsed cells.

Parameters:
parent - Cell whose children should be checked.
Returns:
Array of tree roots in parent.

findTreeRoots

public Object[] findTreeRoots(Object parent,
                              boolean isolate)
Returns all visible children in the given parent which do not have incoming edges. If the result is empty then the children with the maximum difference between incoming and outgoing edges are returned. This takes into account edges that are being promoted to the given root due to invisible children or collapsed cells.

Parameters:
parent - Cell whose children should be checked.
isolate - Specifies if edges should be ignored if the opposite end is not a child of the given parent cell.
Returns:
Array of tree roots in parent.

findTreeRoots

public Object[] findTreeRoots(Object parent,
                              boolean isolate,
                              boolean invert)
Returns all visible children in the given parent which do not have incoming edges. If the result is empty then the children with the maximum difference between incoming and outgoing edges are returned. This takes into account edges that are being promoted to the given root due to invisible children or collapsed cells.

Parameters:
parent - Cell whose children should be checked.
isolate - Specifies if edges should be ignored if the opposite end is not a child of the given parent cell.
invert - Specifies if outgoing or incoming edges should be counted for a tree root. If false then outgoing edges will be counted.
Returns:
Array of tree roots in parent.

traverse

public void traverse(Object vertex,
                     boolean directed,
                     mxGraph.mxICellVisitor visitor)
Parameters:
vertex -
directed -
visitor -

traverse

public void traverse(Object vertex,
                     boolean directed,
                     mxGraph.mxICellVisitor visitor,
                     Object edge,
                     Set visited)
Traverses the (directed) graph invoking the given function for each visited vertex and edge. The function is invoked with the current vertex and the incoming edge as a parameter. This implementation makes sure each vertex is only visited once. The function may return false if the traversal should stop at the given vertex.

Parameters:
vertex - that represents the vertex where the traversal starts.
directed - Optional boolean indicating if edges should only be traversed from source to target. Default is true.
visitor - Visitor that takes the current vertex and the incoming edge. The traversal stops if the function returns false.
edge - Optional that represents the incoming edge. This is null for the first step of the traversal.
visited - Optional array of cell paths for the visited cells.

getSelection

public mxSelectionModel getSelection()

getSelectionCount

public int getSelectionCount()

isSelected

public boolean isSelected(Object cell)
Parameters:
cell -
Returns:
Returns true if the given cell is selected.

isSelectionEmpty

public boolean isSelectionEmpty()
Returns:
Returns true if the selection is empty.

clearSelection

public void clearSelection()

getSelectionCell

public Object getSelectionCell()
Returns:
Returns the selection cell.

setSelectionCell

public void setSelectionCell(Object cell)
Parameters:
cell -

getSelectionCells

public Object[] getSelectionCells()
Returns:
Returns the selection cells.

setSelectionCells

public void setSelectionCells(Object[] cells)

setSelectionCells

public void setSelectionCells(Collection cells)
Parameters:
cells -

selectNext

public void selectNext()
Selects the next cell.


selectPrevious

public void selectPrevious()
Selects the previous cell.


selectParent

public void selectParent()
Selects the parent cell.


selectChild

public void selectChild()
Selects the first child cell.


select

public void select(boolean isNext,
                   boolean isParent,
                   boolean isChild)
Selects the next, parent, first child or previous cell, if all arguments are false.

Parameters:
isNext -
isParent -
isChild -

selectVertices

public void selectVertices()
Selects all vertices inside the default parent.


selectVertices

public void selectVertices(Object parent)
Selects all vertices inside the given parent or the default parent if no parent is given.


selectEdges

public void selectEdges()
Selects all vertices inside the default parent.


selectEdges

public void selectEdges(Object parent)
Selects all vertices inside the given parent or the default parent if no parent is given.


selectCells

public void selectCells(boolean vertices,
                        boolean edges)
Selects all vertices and/or edges depending on the given boolean arguments recursively, starting at the default parent. Use selectAll to select all cells.

Parameters:
vertices - Boolean indicating if vertices should be selected.
edges - Boolean indicating if edges should be selected.

selectCells

public void selectCells(boolean vertices,
                        boolean edges,
                        Object parent)
Selects all vertices and/or edges depending on the given boolean arguments recursively, starting at the given parent or the default parent if no parent is specified. Use selectAll to select all cells.

Parameters:
vertices - Boolean indicating if vertices should be selected.
edges - Boolean indicating if edges should be selected.
parent - Optional cell that acts as the root of the recursion. Default is defaultParent.

selectAll

public void selectAll()

selectAll

public void selectAll(Object parent)
Selects all children of the given parent cell or the children of the default parent if no parent is specified. To select leaf vertices and/or edges use .

Parameters:
parent - Optional whose children should be selected. Default is .

draw

public void draw(mxICanvas canvas)
Draws the graph onto the given canvas.

Parameters:
canvas - Canvas onto which the graph should be drawn.

drawCell

public void drawCell(mxICanvas canvas,
                     Object cell)
Draws the given cell and its descendants onto the specified canvas.

Parameters:
canvas - Canvas onto which the cell should be drawn.
cell - Cell that should be drawn onto the canvas.

drawStateWithLabel

public void drawStateWithLabel(mxICanvas canvas,
                               mxCellState state,
                               String label)
Draws the given cell and label onto the specified canvas. No children or descendants are painted here. This method invokes cellDrawn after the cell, but not its descendants have been painted.

Parameters:
canvas - Canvas onto which the cell should be drawn.
cell - Cell that should be drawn onto the canvas.

cellDrawn

protected void cellDrawn(Object cell,
                         Object element,
                         Object labelElement)
Called when a cell has been painted as the specified object, typically a DOM node that represents the given cell graphically in a document.


getLinkForCell

protected String getLinkForCell(Object cell)
Returns the hyperlink to be used for the given cell.


getTargetForCell

protected String getTargetForCell(Object cell)
Returns the hyperlink to be used for the given cell.


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Parameters:
listener -
See Also:
PropertyChangeSupport.addPropertyChangeListener(java.beans.PropertyChangeListener)

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Parameters:
propertyName -
listener -
See Also:
PropertyChangeSupport.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Parameters:
listener -
See Also:
PropertyChangeSupport.removePropertyChangeListener(java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Parameters:
propertyName -
listener -
See Also:
PropertyChangeSupport.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

main

public static void main(String[] args)
Prints the version number on the console.


JGraph X 0.15.0.3


Copyright (c) 2008 Gaudenz Alder. All rights reserved.