Class 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. This class fires the following events: mxEvent.ROOT fires if the root in the model has changed. This event has no properties. mxEvent.ALIGN_CELLS fires between begin- and endUpdate in alignCells. The cells and align properties contain the respective arguments that were passed to alignCells. mxEvent.FLIP_EDGE fires between begin- and endUpdate in flipEdge. The edge property contains the edge passed to flipEdge. mxEvent.ORDER_CELLS fires between begin- and endUpdate in orderCells. The cells and back properties contain the respective arguments that were passed to orderCells. mxEvent.CELLS_ORDERED fires between begin- and endUpdate in cellsOrdered. The cells and back arguments contain the respective arguments that were passed to cellsOrdered. mxEvent.GROUP_CELLS fires between begin- and endUpdate in groupCells. The group, cells and border arguments contain the respective arguments that were passed to groupCells. mxEvent.UNGROUP_CELLS fires between begin- and endUpdate in ungroupCells. The cells property contains the array of cells that was passed to ungroupCells. mxEvent.REMOVE_CELLS_FROM_PARENT fires between begin- and endUpdate in removeCellsFromParent. The cells property contains the array of cells that was passed to removeCellsFromParent. mxEvent.ADD_CELLS fires between begin- and endUpdate in addCells. The cells, parent, index, source and target properties contain the respective arguments that were passed to addCells. mxEvent.CELLS_ADDED fires between begin- and endUpdate in cellsAdded. The cells, parent, index, source, target and absolute properties contain the respective arguments that were passed to cellsAdded. mxEvent.REMOVE_CELLS fires between begin- and endUpdate in removeCells. The cells and includeEdges arguments contain the respective arguments that were passed to removeCells. mxEvent.CELLS_REMOVED fires between begin- and endUpdate in cellsRemoved. The cells argument contains the array of cells that was removed. mxEvent.SPLIT_EDGE fires between begin- and endUpdate in splitEdge. The edge property contains the edge to be splitted, the cells, newEdge, dx and dy properties contain the respective arguments that were passed to splitEdge. mxEvent.TOGGLE_CELLS fires between begin- and endUpdate in toggleCells. The show, cells and includeEdges properties contain the respective arguments that were passed to toggleCells. mxEvent.FOLD_CELLS fires between begin- and endUpdate in foldCells. The collapse, cells and recurse properties contain the respective arguments that were passed to foldCells. mxEvent.CELLS_FOLDED fires between begin- and endUpdate in cellsFolded. The collapse, cells and recurse properties contain the respective arguments that were passed to cellsFolded. mxEvent.UPDATE_CELL_SIZE fires between begin- and endUpdate in updateCellSize. The cell and ignoreChildren properties contain the respective arguments that were passed to updateCellSize. mxEvent.RESIZE_CELLS fires between begin- and endUpdate in resizeCells. The cells and bounds properties contain the respective arguments that were passed to resizeCells. mxEvent.CELLS_RESIZED fires between begin- and endUpdate in cellsResized. The cells and bounds properties contain the respective arguments that were passed to cellsResized. mxEvent.MOVE_CELLS fires between begin- and endUpdate in moveCells. The cells, dx, dy, clone, target and location properties contain the respective arguments that were passed to moveCells. mxEvent.CELLS_MOVED fires between begin- and endUpdate in cellsMoved. The cells, dx, dy and disconnect properties contain the respective arguments that were passed to cellsMoved. mxEvent.CONNECT_CELL fires between begin- and endUpdate in connectCell. The edge, terminal and source properties contain the respective arguments that were passed to connectCell. mxEvent.CELL_CONNECTED fires between begin- and endUpdate in cellConnected. The edge, terminal and source properties contain the respective arguments that were passed to cellConnected. mxEvent.REPAINT fires if a repaint was requested by calling repaint. The region property contains the optional mxRectangle that was passed to repaint to define the dirty region.
  • Field Details

    • VERSION

      public static final String VERSION
      Holds the version number of this release. Current version is 4.2.2.
      See Also:
    • 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.
    • selectionModel

      protected mxGraphSelectionModel selectionModel
      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.
    • portsEnabled

      protected boolean portsEnabled
      Specifies if ports are enabled. This is used in to update the respective style. 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.
    • cellsLocked

      protected boolean cellsLocked
      Specifies the return value for isCell(s)Locked. Default is false.
    • cellsEditable

      protected boolean cellsEditable
      Specifies the return value for isCell(s)Editable. Default is true.
    • cellsResizable

      protected boolean cellsResizable
      Specifies the return value for isCell(s)Sizable. Default is true.
    • cellsMovable

      protected boolean cellsMovable
      Specifies the return value for isCell(s)Movable. Default is true.
    • cellsBendable

      protected boolean cellsBendable
      Specifies the return value for isCell(s)Bendable. Default is true.
    • cellsSelectable

      protected boolean cellsSelectable
      Specifies the return value for isCell(s)Selectable. Default is true.
    • cellsDeletable

      protected boolean cellsDeletable
      Specifies the return value for isCell(s)Deletable. Default is true.
    • cellsCloneable

      protected boolean cellsCloneable
      Specifies the return value for isCell(s)Cloneable. Default is true.
    • cellsDisconnectable

      protected boolean cellsDisconnectable
      Specifies the return value for isCellDisconntableFromTerminal. Default is true.
    • labelsClipped

      protected boolean labelsClipped
      Specifies the return value for isLabel(s)Clipped. Default is false.
    • 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 true.
    • splitEnabled

      protected boolean splitEnabled
      Specifies if dropping onto edges should be enabled. Default is true.
    • autoSizeCells

      protected boolean autoSizeCells
      Specifies if the graph should automatically update the cell size after an edit. This is used in isAutoSizeCell. Default is false.
    • 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.
    • minimumGraphSize

      protected mxRectangle minimumGraphSize
      mxRectangle that specifies the minimum size of the graph canvas inside the scrollpane.
    • 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.
    • 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.
    • allowNegativeCoordinates

      protected boolean allowNegativeCoordinates
      Specifies if negative coordinates for vertices are allowed. Default is true.
    • constrainChildren

      protected boolean constrainChildren
      Specifies the return value for isConstrainChildren. Default is true.
    • extendParents

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

      protected boolean extendParentsOnAdd
      Specifies if parents should be extended according to the switch if cells are added. Default is true.
    • resetViewOnRootChange

      protected boolean resetViewOnRootChange
      Specifies if the scale and translate should be reset if the root changes in the model. 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.
    • resetEdgesOnConnect

      protected boolean resetEdgesOnConnect
      Specifies if edge control points should be reset after the the edge has been reconnected. Default is true.
    • 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.
    • changesRepaintThreshold

      protected int changesRepaintThreshold
      Specifies the maximum number of changes that should be processed to find the dirty region. If the number of changes is larger, then the complete grah is repainted. A value of zero will always compute the dirty region for any number of changes. Default is 1000.
    • autoOrigin

      protected boolean autoOrigin
      Specifies if the origin should be automatically updated.
    • origin

      protected mxPoint origin
      Holds the current automatic origin.
    • imageBundles

      protected static List<mxImageBundle> imageBundles
      Holds the list of bundles.
    • fullRepaintHandler

      protected mxEventSource.mxIEventListener fullRepaintHandler
      Fires repaint events for full repaints.
    • updateOriginHandler

      protected mxEventSource.mxIEventListener updateOriginHandler
      Fires repaint events for full repaints.
    • graphModelChangeHandler

      protected mxEventSource.mxIEventListener graphModelChangeHandler
      Fires repaint events for model changes.
  • Constructor Details

    • 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 Details

    • createSelectionModel

      protected mxGraphSelectionModel createSelectionModel()
      Constructs a new selection model to be used in this graph.
    • createStylesheet

      protected mxStylesheet createStylesheet()
      Constructs a new stylesheet to be used in this graph.
    • createGraphView

      protected mxGraphView createGraphView()
      Constructs a new view to be used in this graph.
    • 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 value)
      Sets the graph model that contains the data, and fires an mxEvent.CHANGE followed by an mxEvent.REPAINT event.
      Parameters:
      value - Model that contains the graph data
    • 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 value)
      Sets the view that contains the cell states.
      Parameters:
      value - View that contains the cell states
    • getStylesheet

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

      public void setStylesheet(mxStylesheet value)
      Sets the stylesheet that provides the style.
      Parameters:
      value - Stylesheet that provides the style.
    • addTopmostVerticesAndEdges

      public void addTopmostVerticesAndEdges(Object cell, List<Object> cells)
      Returns the cells to be selected for the given list of changes.
    • getSelectionCellsForChanges

      public Object[] getSelectionCellsForChanges(List<mxUndoableEdit.mxUndoableChange> changes)
      Returns the cells to be selected for the given list of changes.
    • graphModelChanged

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

      protected void updateSelection()
      Function: updateSelection Removes selection cells that are not in the model from the selection.
    • updateOrigin

      protected void updateOrigin()
      Extends the canvas by doing another validation with a shifted global translation if the bounds of the graph are below (0,0). The first validation is required to compute the bounds of the graph while the second validation is required to apply the new translate.
    • processChanges

      public mxRectangle processChanges(List<mxUndoableEdit.mxUndoableChange> changes, boolean invalidate, boolean ignoreDirty)
      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(mxUndoableEdit.mxUndoableChange change, boolean invalidate, boolean ignoreDirty)
      Processes the given change and invalidates the respective cached data in . This fires a event if the root has changed in the model.
    • removeStateForCell

      protected void removeStateForCell(Object cell)
      Removes all cached information for the given cell and its descendants. This is called when a cell was removed from the model.
      Parameters:
      cell - Cell that was removed from the model.
    • getCellStyle

      public Map<String,Object> 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.
    • postProcessCellStyle

      protected Map<String,Object> postProcessCellStyle(Map<String,Object> style)
      Tries to resolve the value for the image style in the image bundles and turns short data URIs as defined in mxImageBundle to data URIs as defined in RFC 2397 of the IETF.
    • setCellStyle

      public Object[] 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 Object[] 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 Object 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 Object[] 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 Object[] 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 Object[] 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 Object[] 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 Object[] 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 Object[] 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 Object[] 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 Object[] 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.
    • addImageBundle

      public void addImageBundle(mxImageBundle bundle)
      Adds the specified bundle.
    • removeImageBundle

      public void removeImageBundle(mxImageBundle bundle)
      Removes the specified bundle.
    • getImageFromBundles

      public String getImageFromBundles(String key)
      Searches all bundles for the specified key and returns the value for the first match or null if the key is not found.
    • getImageBundles

      public List<mxImageBundle> getImageBundles()
      Returns the image bundles
    • getImageBundles

      public void getImageBundles(List<mxImageBundle> value)
      Returns the image bundles
    • alignCells

      public Object[] 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 Object[] 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 Object[] 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.
    • flipEdge

      public Object flipEdge(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.
    • orderCells

      public Object[] orderCells(boolean back)
      Moves the selection cells to the front or back. This is a shortcut method.
      Parameters:
      back - Specifies if the cells should be moved to back.
    • orderCells

      public Object[] orderCells(boolean back, Object[] cells)
      Moves the given cells to the front or back. The change is carried out using cellsOrdered. This method fires mxEvent.ORDER_CELLS while the transaction is in progress.
      Parameters:
      back - Specifies if the cells should be moved to back.
      cells - Array of cells whose order should be changed. If null is specified then the selection cells are used.
    • cellsOrdered

      public void cellsOrdered(Object[] cells, boolean back)
      Moves the given cells to the front or back. This method fires mxEvent.CELLS_ORDERED while the transaction is in progress.
      Parameters:
      cells - Array of cells whose order should be changed.
      back - Specifies if the cells should be moved to back.
    • groupCells

      public Object groupCells()
      Groups the selection cells. This is a shortcut method.
      Returns:
      Returns the new group.
    • groupCells

      public Object groupCells(Object group)
      Groups the selection cells and adds them to the given group. This is a shortcut method.
      Returns:
      Returns the new group.
    • groupCells

      public Object groupCells(Object group, double border)
      Groups the selection cells and adds them to the given group. This is a shortcut method.
      Returns:
      Returns the new group.
    • groupCells

      public Object groupCells(Object group, double border, Object[] cells)
      Adds the cells into the given group. The change is carried out using cellsAdded, cellsMoved and cellsResized. This method fires mxEvent.GROUP_CELLS while the transaction is in progress. Returns the new group. A group is only created if there is at least one entry in the given array of cells.
      Parameters:
      group - Cell that represents the target group. If null is specified then a new group is created using createGroupCell.
      border - Integer that specifies the border between the child area and the group bounds.
      cells - Optional array of cells to be grouped. If null is specified then the selection cells are used.
    • getCellsForGroup

      public Object[] getCellsForGroup(Object[] cells)
      Returns the cells with the same parent as the first cell in the given array.
    • getBoundsForGroup

      public mxRectangle getBoundsForGroup(Object group, Object[] children, double border)
      Returns the bounds to be used for the given group and children. This implementation computes the bounding box of the geometries of all vertices in the given children array. Edges are ignored. If the group cell is a swimlane the title region is added to the bounds.
    • 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. The children are just for informational purpose, they will be added to the returned group later. Note that the returned group should have a geometry. The coordinates of which are later overridden.
      Parameters:
      cells -
      Returns:
      Returns a new group cell.
    • ungroupCells

      public Object[] ungroupCells()
      Ungroups the selection cells. This is a shortcut method.
    • ungroupCells

      public Object[] ungroupCells(Object[] cells)
      Ungroups the given cells by moving the children the children to their parents parent and removing the empty groups.
      Parameters:
      cells - Array of cells to be ungrouped. If null is specified then the selection cells are used.
      Returns:
      Returns the children that have been removed from the groups.
    • removeCellsFromParent

      public Object[] removeCellsFromParent()
      Removes the selection cells from their parents and adds them to the default parent returned by getDefaultParent.
    • removeCellsFromParent

      public Object[] removeCellsFromParent(Object[] cells)
      Removes the specified cells from their parents and adds them to the default parent.
      Parameters:
      cells - Array of cells to be removed from their parents.
      Returns:
      Returns the cells that were removed from their parents.
    • updateGroupBounds

      public Object[] updateGroupBounds()
      Updates the bounds of the given array of groups so that it includes all child vertices.
    • updateGroupBounds

      public Object[] updateGroupBounds(Object[] cells)
      Updates the bounds of the given array of groups so that it includes all child vertices.
      Parameters:
      cells - The groups whose bounds should be updated.
    • updateGroupBounds

      public Object[] updateGroupBounds(Object[] cells, int border)
      Updates the bounds of the given array of groups so that it includes all child vertices.
      Parameters:
      cells - The groups whose bounds should be updated.
      border - The border to be added in the group.
    • updateGroupBounds

      public Object[] updateGroupBounds(Object[] cells, int border, boolean moveParent)
      Updates the bounds of the given array of groups so that it includes all child vertices.
      Parameters:
      cells - The groups whose bounds should be updated.
      border - The border to be added in the group.
      moveParent - Specifies if the group should be moved.
    • cloneCells

      public Object[] cloneCells(Object[] cells)
      Clones all cells in the given array. To clone all children in a cell and add them to another graph: graph2.addCells(graph.cloneCells(new Object[] { parent })); To clone all children in a graph layer if graph g1 and put them into the default parent (typically default layer) of another graph g2, the following code is used: g2.addCells(g1.cloneCells(g1.cloneCells(g1.getChildCells(g1.getDefaultParent()));
    • cloneCells

      public Object[] cloneCells(Object[] cells, boolean allowInvalidEdges)
      Returns the clones for the given cells. The clones are created recursively using invalid input: '<'mxGraphModel.cloneCells>. 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. If a cloned edge is invalid and allowInvalidEdges is false, then a null pointer will be at this position in the returned array. Use getCloneableCells on the input array to only clone the cells where isCellCloneable returns true.
      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.
    • insertVertex

      public Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative)
      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.
      relative - Specifies if the geometry should be relative.
      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.
    • createVertex

      public Object createVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative)
      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.
      relative - Specifies if the geometry should be relative.
      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. This implementation does not set the source and target of the edge, these are set when the edge is added to the model.
      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 parent, Object source, Object target, Integer index)
      Adds the edge to the parent and connects it to the given source and target terminals. This is a shortcut method.
      Parameters:
      edge - Edge 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.
      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 edge that was added.
    • addCell

      public Object addCell(Object cell)
      Adds the cell to the default parent. This is a shortcut method.
      Parameters:
      cell - Cell to be inserted.
      Returns:
      Returns the cell that was added.
    • addCell

      public Object addCell(Object cell, Object parent)
      Adds the cell to the parent. This is a shortcut method.
      Parameters:
      cell - Cell tobe inserted.
      parent - Object that represents the new parent. If no parent is given then the default parent is used.
      Returns:
      Returns the cell that was added.
    • addCell

      public Object addCell(Object cell, Object parent, Integer index, Object source, Object target)
      Adds the cell to the parent and connects it to the given source and target terminals. This is a shortcut method.
      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 was added.
    • addCells

      public Object[] addCells(Object[] cells)
      Adds the cells to the default parent. This is a shortcut method.
      Parameters:
      cells - Array of cells to be inserted.
      Returns:
      Returns the cells that were added.
    • addCells

      public Object[] addCells(Object[] cells, Object parent)
      Adds the cells to the parent. This is a shortcut method.
      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 were added.
    • addCells

      public Object[] addCells(Object[] cells, Object parent, Integer index)
      Adds the cells to the parent at the given index. This is a shortcut method.
      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 were added.
    • addCells

      public Object[] addCells(Object[] cells, Object parent, Integer index, Object source, Object target)
      Adds the cells to the parent at the given index, connecting each cell to the optional source and target terminal. The change is carried out using cellsAdded. This method fires mxEvent.ADD_CELLS while the transaction is in progress.
      Parameters:
      cells - Array of cells to be added.
      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.
      source - Optional source terminal for all inserted cells.
      target - Optional target terminal for all inserted cells.
      Returns:
      Returns the cells that were added.
    • cellsAdded

      public void cellsAdded(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute)
      Adds the specified cells to the given parent. This method fires mxEvent.CELLS_ADDED while the transaction is in progress.
    • cellsAdded

      public void cellsAdded(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute, boolean constrain)
      Adds the specified cells to the given parent. This method fires mxEvent.CELLS_ADDED while the transaction is in progress.
    • removeCells

      public Object[] removeCells()
      Removes the selection cells from the graph.
      Returns:
      Returns the cells that have been removed.
    • removeCells

      public Object[] removeCells(Object[] cells)
      Removes the given cells from the graph.
      Parameters:
      cells - Array of cells to remove.
      Returns:
      Returns the cells that have been removed.
    • removeCells

      public Object[] removeCells(Object[] cells, boolean includeEdges)
      Removes the given cells from the graph including all connected edges if includeEdges is true. The change is carried out using cellsRemoved. This method fires mxEvent.REMOVE_CELLS while the transaction is in progress.
      Parameters:
      cells - Array of cells to remove. If null is specified then the selection cells which are deletable are used.
      includeEdges - Specifies if all connected edges should be removed as well.
    • cellsRemoved

      public void cellsRemoved(Object[] cells)
      Removes the given cells from the model. This method fires mxEvent.CELLS_REMOVED while the transaction is in progress.
      Parameters:
      cells - Array of cells to remove.
    • splitEdge

      public Object splitEdge(Object edge, Object[] cells)
    • splitEdge

      public Object splitEdge(Object edge, Object[] cells, double dx, double dy)
    • splitEdge

      public Object splitEdge(Object edge, Object[] cells, Object newEdge, double dx, double dy)
      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 mxEvent.SPLIT_EDGE while the transaction is in progress.
      Parameters:
      edge - Object that represents the edge to be splitted.
      cells - Array that contains the cells to insert into the edge.
      newEdge - Object that represents the edge to be inserted.
      Returns:
      Returns the new edge that has been inserted.
    • toggleCells

      public Object[] toggleCells(boolean show)
      Sets the visible state of the selection cells. This is a shortcut method.
      Parameters:
      show - Boolean that specifies the visible state to be assigned.
      Returns:
      Returns the cells whose visible state was changed.
    • toggleCells

      public Object[] toggleCells(boolean show, Object[] cells)
      Sets the visible state of the specified cells. This is a shortcut method.
      Parameters:
      show - Boolean that specifies the visible state to be assigned.
      cells - Array of cells whose visible state should be changed.
      Returns:
      Returns the cells whose visible state was changed.
    • toggleCells

      public Object[] toggleCells(boolean show, Object[] cells, boolean includeEdges)
      Sets the visible state of the specified cells and all connected edges if includeEdges is true. The change is carried out using cellsToggled. This method fires mxEvent.TOGGLE_CELLS while the transaction is in progress.
      Parameters:
      show - Boolean that specifies the visible state to be assigned.
      cells - Array of cells whose visible state should be changed. If null is specified then the selection cells are used.
      Returns:
      Returns the cells whose visible state was changed.
    • cellsToggled

      public void cellsToggled(Object[] cells, boolean show)
      Sets the visible state of the specified cells.
      Parameters:
      cells - Array of cells whose visible state should be changed.
      show - Boolean that specifies the visible state to be assigned.
    • foldCells

      public Object[] foldCells(boolean collapse)
      Sets the collapsed state of the selection cells without recursion. This is a shortcut method.
      Parameters:
      collapse - Boolean that specifies the collapsed state to be assigned.
      Returns:
      Returns the cells whose collapsed state was changed.
    • foldCells

      public Object[] foldCells(boolean collapse, boolean recurse)
      Sets the collapsed state of the selection cells. This is a shortcut method.
      Parameters:
      collapse - Boolean that specifies the collapsed state to be assigned.
      recurse - Boolean that specifies if the collapsed state should be assigned to all descendants.
      Returns:
      Returns the cells whose collapsed state was changed.
    • foldCells

      public Object[] foldCells(boolean collapse, boolean recurse, Object[] cells)
      Invokes foldCells with checkFoldable set to false.
    • foldCells

      public Object[] foldCells(boolean collapse, boolean recurse, Object[] cells, boolean checkFoldable)
      Sets the collapsed state of the specified cells and all descendants if recurse is true. The change is carried out using cellsFolded. This method fires mxEvent.FOLD_CELLS while the transaction is in progress. Returns the cells whose collapsed state was changed.
      Parameters:
      collapse - Boolean indicating the collapsed state to be assigned.
      recurse - Boolean indicating if the collapsed state of all descendants should be set.
      cells - Array of cells whose collapsed state should be set. If null is specified then the foldable selection cells are used.
      checkFoldable - Boolean indicating of isCellFoldable should be checked. Default is false.
    • cellsFolded

      public void cellsFolded(Object[] cells, boolean collapse, boolean recurse)
      Invokes cellsFoldable with checkFoldable set to false.
    • cellsFolded

      public void cellsFolded(Object[] cells, boolean collapse, boolean recurse, boolean checkFoldable)
      Sets the collapsed state of the specified cells. This method fires mxEvent.CELLS_FOLDED while the transaction is in progress. Returns the cells whose collapsed state was changed.
      Parameters:
      cells - Array of cells whose collapsed state should be set.
      collapse - Boolean indicating the collapsed state to be assigned.
      recurse - Boolean indicating if the collapsed state of all descendants should be set.
      checkFoldable - Boolean indicating of isCellFoldable should be checked. Default is false.
    • swapBounds

      public void swapBounds(Object cell, boolean willCollapse)
      Swaps the alternate and the actual bounds in the geometry of the given cell invoking updateAlternateBounds before carrying out the swap.
      Parameters:
      cell - 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 geo, 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 collapseToPreferredSize 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 - Cell for which the geometry is being udpated.
      geo - Geometry for which the alternate bounds should be updated.
      willCollapse - Boolean indicating if the cell is going to be collapsed.
    • addAllEdges

      public Object[] addAllEdges(Object[] cells)
      Returns an array with the given cells and all edges that are connected to a cell or one of its descendants.
    • getAllEdges

      public Object[] getAllEdges(Object[] cells)
      Returns all edges connected to the given cells or their descendants.
    • updateCellSize

      public Object updateCellSize(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.
    • updateCellSize

      public Object updateCellSize(Object cell, boolean ignoreChildren)
      Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size. This function fires mxEvent.UPDATE_CELL_SIZE.
      Parameters:
      cell - Cell for which the size should be changed.
    • cellSizeUpdated

      public void cellSizeUpdated(Object cell, boolean ignoreChildren)
      Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.
      Parameters:
      cell - Cell for which the size should be changed.
    • 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.
    • resizeCell

      public Object resizeCell(Object cell, mxRectangle bounds)
      Sets the bounds of the given cell using resizeCells. Returns the cell which was passed to the function.
      Parameters:
      cell - whose bounds should be changed.
      bounds - that represents the new bounds.
    • resizeCells

      public Object[] resizeCells(Object[] cells, mxRectangle[] bounds)
      Sets the bounds of the given cells and fires a mxEvent.RESIZE_CELLS event. while the transaction is in progress. Returns the cells which have been passed to the function.
      Parameters:
      cells - Array of cells whose bounds should be changed.
      bounds - Array of rectangles that represents the new bounds.
    • cellsResized

      public void cellsResized(Object[] cells, mxRectangle[] bounds)
      Sets the bounds of the given cells and fires a invalid input: '<'mxEvent.CELLS_RESIZED> event. If extendParents is true, then the parent is extended if a child size is changed so that it overlaps with the parent.
      Parameters:
      cells - Array of whose bounds should be changed.
      bounds - Array of that represents the new bounds.
    • 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.
    • moveCells

      public Object[] moveCells(Object[] cells, double dx, double dy)
      Moves the cells by the given amount. This is a shortcut method.
    • moveCells

      public Object[] moveCells(Object[] cells, double dx, double dy, boolean clone)
      Moves or clones the cells and moves the cells or clones by the given amount. This is a shortcut method.
    • moveCells

      public Object[] moveCells(Object[] cells, double dx, double dy, boolean clone, Object target, Point location)
      Moves or clones the specified cells and moves the cells or clones by the given amount, adding them to the optional target cell. The location is the position of the mouse pointer as the mouse was released. The change is carried out using cellsMoved. This method fires mxEvent.MOVE_CELLS while the transaction is in progress.
      Parameters:
      cells - Array of cells to be moved, cloned or added to the target.
      dx - Integer that specifies the x-coordinate of the vector.
      dy - Integer that specifies the y-coordinate of the vector.
      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.
      Returns:
      Returns the cells that were moved.
    • cellsMoved

      public void cellsMoved(Object[] cells, double dx, double dy, boolean disconnect, boolean constrain)
      Moves the specified cells by the given vector, disconnecting the cells using disconnectGraph if disconnect is true. This method fires mxEvent.CELLS_MOVED while the transaction is in progress.
    • translateCell

      public void translateCell(Object cell, double dx, double dy)
      Translates the geometry of the given cell and stores the new, translated geometry in the model as an atomic change.
    • getCellContainmentArea

      public mxRectangle getCellContainmentArea(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 value)
      Parameters:
      value - the maximumGraphBounds to set
    • constrainChild

      public void constrainChild(Object cell)
      Keeps the given cell inside the bounds returned by getCellContainmentArea for its parent, according to the rules defined by getOverlap and isConstrainChild. This modifies the cell's geometry in-place and does not clone it.
      Parameters:
      cell - Cell which should be constrained.
    • 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.
    • resetEdge

      public Object resetEdge(Object edge)
      Resets the control points of the given edge.
    • getAllConnectionConstraints

      public mxConnectionConstraint[] getAllConnectionConstraints(mxCellState terminal, boolean source)
      Returns an array of all constraints for the given terminal.
      Parameters:
      terminal - Cell state that represents the terminal.
      source - Specifies if the terminal is the source or target.
    • getConnectionConstraint

      public mxConnectionConstraint getConnectionConstraint(mxCellState edge, mxCellState terminal, boolean source)
      Returns an connection constraint that describes the given connection point. This result can then be passed to getConnectionPoint.
      Parameters:
      edge - Cell state that represents the edge.
      terminal - Cell state that represents the terminal.
      source - Boolean indicating if the terminal is the source or target.
    • setConnectionConstraint

      public void setConnectionConstraint(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint)
      Sets the connection constraint that describes the given connection point. If no constraint is given then nothing is changed. To remove an existing constraint from the given edge, use an empty constraint instead.
      Parameters:
      edge - Cell that represents the edge.
      terminal - Cell that represents the terminal.
      source - Boolean indicating if the terminal is the source or target.
      constraint - Optional connection constraint to be used for this connection.
    • getConnectionPoint

      public mxPoint getConnectionPoint(mxCellState vertex, mxConnectionConstraint constraint)
      Sets the connection constraint that describes the given connection point. If no constraint is given then nothing is changed. To remove an existing constraint from the given edge, use an empty constraint instead.
      Parameters:
      vertex - Cell state that represents the vertex.
      constraint - Connection constraint that represents the connection point constraint as returned by getConnectionConstraint.
    • connectCell

      public Object connectCell(Object edge, Object terminal, boolean source)
      Connects the specified end of the given edge to the given terminal using cellConnected and fires mxEvent.CONNECT_CELL while the transaction is in progress.
    • connectCell

      public Object connectCell(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint)
      Connects the specified end of the given edge to the given terminal using cellConnected and fires mxEvent.CONNECT_CELL while the transaction is in progress.
      Parameters:
      edge - Edge whose terminal should be updated.
      terminal - New terminal to be used.
      source - Specifies if the new terminal is the source or target.
      constraint - Optional constraint to be used for this connection.
      Returns:
      Returns the update edge.
    • cellConnected

      public void cellConnected(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint)
      Sets the new terminal for the given edge and resets the edge points if isResetEdgesOnConnect returns true. This method fires invalid input: '<'mxEvent.CELL_CONNECTED> while the transaction is in progress.
      Parameters:
      edge - Edge whose terminal should be updated.
      terminal - New terminal to be used.
      source - Specifies if the new terminal is the source or target.
      constraint - Constraint to be used for this connection.
    • disconnectGraph

      public void disconnectGraph(Object[] cells)
      Disconnects the given edges from the terminals which are not in the given array.
      Parameters:
      cells - Array of to be disconnected.
    • getCurrentRoot

      public Object getCurrentRoot()
      Returns the current root of the displayed cell hierarchy. This is a shortcut to invalid input: '<'mxGraphView.currentRoot> 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 - Cell that represents the root of the view.
      Returns:
      Returns the translation of the graph for the given root cell.
    • isPort

      public boolean isPort(Object cell)
      Returns true if the given cell is a "port", that is, when connecting to it, the cell returned by getTerminalForPort should be used as the terminal and the port should be referenced by the ID in either the mxConstants.STYLE_SOURCE_PORT or the or the mxConstants.STYLE_TARGET_PORT. Note that a port should not be movable. This implementation always returns false. A typical implementation of this method looks as follows: public boolean isPort(Object cell) { mxGeometry geo = getCellGeometry(cell); return (geo != null) ? geo.isRelative() : false; }
      Parameters:
      cell - Cell that represents the port.
      Returns:
      Returns true if the cell is a port.
    • getTerminalForPort

      public Object getTerminalForPort(Object cell, boolean source)
      Returns the terminal to be used for a given port. This implementation always returns the parent cell.
      Parameters:
      cell - Cell that represents the port.
      source - If the cell is the source or target port.
      Returns:
      Returns the terminal to be used for the given port.
    • 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.
    • getGraphBounds

      public mxRectangle getGraphBounds()
      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.
    • getBoundingBoxFromGeometry

      public mxRectangle getBoundingBoxFromGeometry(Object[] cells)
      Returns the bounding box for the geometries of the vertices in the given array of cells.
    • 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.
    • repaint

      public void repaint(mxRectangle region)
      Fires a repaint event. The optional region is the rectangle that needs to be repainted.
    • 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.
    • 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.
    • isCellVisible

      public boolean isCellVisible(Object cell)
      Returns true if the given cell is visible in this graph. This implementation uses invalid input: '<'mxGraphModel.isVisible>. 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 invalid input: '<'mxGraphModel.isCollapsed>. 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.
    • isCellConnectable

      public boolean isCellConnectable(Object cell)
      Returns true if the given cell is connectable in this graph. This implementation uses invalid input: '<'mxGraphModel.isConnectable>. Subclassers can override this to implement specific connectable states for cells in only one graph, that is, without affecting the connectable state of the cell in the model.
      Parameters:
      cell - Cell whose connectable state should be returned.
      Returns:
      Returns the connectable state of the cell.
    • isOrthogonal

      public boolean isOrthogonal(mxCellState edge)
      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.
    • 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.
    • setMultiplicities

      public void setMultiplicities(mxMultiplicity[] value)
    • 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.
    • 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<Object,Object> 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 value)
      Parameters:
      value - the labelsVisible to set
    • setHtmlLabels

      public void setHtmlLabels(boolean value)
      Parameters:
      value - 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.
    • cellLabelChanged

      public void cellLabelChanged(Object cell, Object value, boolean autoSize)
      Sets the new label for a cell. If autoSize is true then will be called.
      Parameters:
      cell - Cell whose label should be changed.
      value - New label to be assigned.
      autoSize - Specifies if cellSizeUpdated should be called.
    • 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 invalid input: '<'mxConstants.STYLE_IMAGE> 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 value)
      Sets the value of .
      Parameters:
      value - 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 value)
      Sets the default style used for loops.
      Parameters:
      value - 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.
    • isCellLocked

      public boolean isCellLocked(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 cellsLocked is false.
      Parameters:
      cell - Cell whose locked state should be returned.
      Returns:
      Returns true if the given cell is locked.
    • isCellsLocked

      public boolean isCellsLocked()
      Returns cellsLocked, the default return value for isCellLocked.
    • setCellsLocked

      public void setCellsLocked(boolean value)
      Sets cellsLocked, the default return value for isCellLocked and fires a property change event for cellsLocked.
    • isCellEditable

      public boolean isCellEditable(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.
    • isCellsEditable

      public boolean isCellsEditable()
      Returns true if editing is allowed in this graph.
      Returns:
      Returns true if the graph is editable.
    • setCellsEditable

      public void setCellsEditable(boolean value)
      Sets if the graph is editable.
    • isCellResizable

      public boolean isCellResizable(Object cell)
      Returns true if the given cell is resizable. This implementation returns cellsSizable for all cells.
      Parameters:
      cell - Cell whose resizable state should be returned.
      Returns:
      Returns true if the cell is sizable.
    • isCellsResizable

      public boolean isCellsResizable()
      Returns true if the given cell is resizable. This implementation return sizable.
    • setCellsResizable

      public void setCellsResizable(boolean value)
      Sets if the graph is resizable.
    • getMovableCells

      public Object[] getMovableCells(Object[] cells)
      Returns the cells which are movable in the given array of cells.
    • isCellMovable

      public boolean isCellMovable(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.
    • isCellsMovable

      public boolean isCellsMovable()
      Returns cellsMovable.
    • setCellsMovable

      public void setCellsMovable(boolean value)
      Sets cellsMovable.
    • isTerminalPointMovable

      public boolean isTerminalPointMovable(Object cell, boolean source)
      Function: isTerminalPointMovable Returns true if the given terminal point is movable. This is independent from isCellConnectable and isCellDisconnectable and controls if terminal points can be moved in the graph if the edge is not connected. Note that it is required for this to return true to connect unconnected edges. This implementation returns true.
      Parameters:
      cell - Cell whose terminal point should be moved.
      source - Boolean indicating if the source or target terminal should be moved.
    • isCellBendable

      public boolean isCellBendable(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.
    • isCellsBendable

      public boolean isCellsBendable()
      Returns cellsBendable.
    • setCellsBendable

      public void setCellsBendable(boolean value)
      Sets cellsBendable.
    • isCellSelectable

      public boolean isCellSelectable(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.
    • isCellsSelectable

      public boolean isCellsSelectable()
      Returns cellsSelectable.
    • setCellsSelectable

      public void setCellsSelectable(boolean value)
      Sets cellsSelectable.
    • getDeletableCells

      public Object[] getDeletableCells(Object[] cells)
      Returns the cells which are movable in the given array of cells.
    • isCellDeletable

      public boolean isCellDeletable(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.
    • isCellsDeletable

      public boolean isCellsDeletable()
      Returns cellsDeletable.
    • setCellsDeletable

      public void setCellsDeletable(boolean value)
      Sets cellsDeletable.
    • getCloneableCells

      public Object[] getCloneableCells(Object[] cells)
      Returns the cells which are movable in the given array of cells.
    • isCellCloneable

      public boolean isCellCloneable(Object cell)
      Returns the constant true. This does not use the cloneable field to return a value for a given cell, it is simply a hook for subclassers to disallow cloning of individual cells.
    • isCellsCloneable

      public boolean isCellsCloneable()
      Returns cellsCloneable.
    • setCellsCloneable

      public void setCellsCloneable(boolean value)
      Specifies if the graph should allow cloning of cells by holding down the control key while cells are being moved. This implementation updates cellsCloneable.
      Parameters:
      value - Boolean indicating if the graph should be cloneable.
    • isCellDisconnectable

      public boolean isCellDisconnectable(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.
    • isCellsDisconnectable

      public boolean isCellsDisconnectable()
      Returns cellsDisconnectable.
    • setCellsDisconnectable

      public void setCellsDisconnectable(boolean value)
      Sets cellsDisconnectable.
      Parameters:
      value - Boolean indicating if the graph should allow disconnecting of edges.
    • isLabelClipped

      public boolean isLabelClipped(Object cell)
      Returns true if the overflow portion of labels should be hidden. If this returns true then vertex labels will be clipped to the size of the vertices. This implementation returns true if invalid input: '<'mxConstants.STYLE_OVERFLOW> in the style of the given cell is "hidden".
      Parameters:
      cell - Cell whose label should be clipped.
      Returns:
      Returns true if the cell label should be clipped.
    • isLabelsClipped

      public boolean isLabelsClipped()
      Returns labelsClipped.
    • setLabelsClipped

      public void setLabelsClipped(boolean value)
      Sets labelsClipped.
    • 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.
    • isVertexLabelsMovable

      public boolean isVertexLabelsMovable()
      Returns vertexLabelsMovable.
    • setVertexLabelsMovable

      public void setVertexLabelsMovable(boolean value)
      Sets vertexLabelsMovable.
    • isEdgeLabelsMovable

      public boolean isEdgeLabelsMovable()
      Returns edgeLabelsMovable.
    • setEdgeLabelsMovable

      public void setEdgeLabelsMovable(boolean value)
      Returns edgeLabelsMovable.
    • isEnabled

      public boolean isEnabled()
      Returns true if the graph is .
      Returns:
      Returns true if the graph is enabled.
    • setEnabled

      public void setEnabled(boolean value)
      Specifies if the graph should allow any interactions. This implementation updates .
      Parameters:
      value - Boolean indicating if the graph should be enabled.
    • isDropEnabled

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

      public void setDropEnabled(boolean value)
      Sets dropEnabled.
    • isSplitEnabled

      public boolean isSplitEnabled()
      Affects the return values of isValidDropTarget to allow for edges as drop targets. The splitEdge method is called in mxGraphHandler if mxGraphComponent.isSplitEvent returns true for a given configuration.
    • setSplitEnabled

      public void setSplitEnabled(boolean value)
      Sets splitEnabled.
    • isMultigraph

      public boolean isMultigraph()
      Returns multigraph.
    • setMultigraph

      public void setMultigraph(boolean value)
      Sets multigraph.
    • isSwimlaneNesting

      public boolean isSwimlaneNesting()
      Returns swimlaneNesting.
    • setSwimlaneNesting

      public void setSwimlaneNesting(boolean value)
      Sets swimlaneNesting.
    • isAllowDanglingEdges

      public boolean isAllowDanglingEdges()
      Returns allowDanglingEdges
    • setAllowDanglingEdges

      public void setAllowDanglingEdges(boolean value)
      Sets allowDanglingEdges.
    • isCloneInvalidEdges

      public boolean isCloneInvalidEdges()
      Returns cloneInvalidEdges.
    • setCloneInvalidEdges

      public void setCloneInvalidEdges(boolean value)
      Sets cloneInvalidEdge.
    • isDisconnectOnMove

      public boolean isDisconnectOnMove()
      Returns disconnectOnMove
    • setDisconnectOnMove

      public void setDisconnectOnMove(boolean value)
      Sets disconnectOnMove.
    • isAllowLoops

      public boolean isAllowLoops()
      Returns allowLoops.
    • setAllowLoops

      public void setAllowLoops(boolean value)
      Sets allowLoops.
    • isConnectableEdges

      public boolean isConnectableEdges()
      Returns connectableEdges.
    • setConnectableEdges

      public void setConnectableEdges(boolean value)
      Sets connetableEdges.
    • isResetEdgesOnMove

      public boolean isResetEdgesOnMove()
      Returns resetEdgesOnMove.
    • setResetEdgesOnMove

      public void setResetEdgesOnMove(boolean value)
      Sets resetEdgesOnMove.
    • isResetViewOnRootChange

      public boolean isResetViewOnRootChange()
      Returns resetViewOnRootChange.
    • setResetViewOnRootChange

      public void setResetViewOnRootChange(boolean value)
      Sets resetEdgesOnResize.
    • isResetEdgesOnResize

      public boolean isResetEdgesOnResize()
      Returns resetEdgesOnResize.
    • setResetEdgesOnResize

      public void setResetEdgesOnResize(boolean value)
      Sets resetEdgesOnResize.
    • isResetEdgesOnConnect

      public boolean isResetEdgesOnConnect()
      Returns resetEdgesOnConnect.
    • setResetEdgesOnConnect

      public void setResetEdgesOnConnect(boolean value)
      Sets resetEdgesOnConnect.
    • isAutoSizeCell

      public boolean isAutoSizeCell(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 or checks if the cell style does specify mxConstants.STYLE_AUTOSIZE to be 1.
      Parameters:
      cell - Cell that should be resized.
      Returns:
      Returns true if the size of the given cell should be updated.
    • isAutoSizeCells

      public boolean isAutoSizeCells()
      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.
    • setAutoSizeCells

      public void setAutoSizeCells(boolean value)
      Specifies if cell sizes should be automatically updated after a label change. This implementation sets autoSize to the given parameter.
      Parameters:
      value - Boolean indicating if cells should be resized automatically.
    • isExtendParent

      public boolean isExtendParent(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 ExtendParents if cell is not an edge.
      Parameters:
      cell - Cell that has been resized.
    • isExtendParents

      public boolean isExtendParents()
      Returns extendParents.
    • setExtendParents

      public void setExtendParents(boolean value)
      Sets extendParents.
    • isExtendParentsOnAdd

      public boolean isExtendParentsOnAdd()
      Returns extendParentsOnAdd.
    • setExtendParentsOnAdd

      public void setExtendParentsOnAdd(boolean value)
      Sets extendParentsOnAdd.
    • isConstrainChild

      public boolean isConstrainChild(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 false for all children of edges and isConstrainChildren() otherwise.
    • isConstrainChildren

      public boolean isConstrainChildren()
      Returns constrainChildren.
      Returns:
      the keepInsideParentOnMove
    • setConstrainChildren

      public void setConstrainChildren(boolean value)
      Parameters:
      value - the constrainChildren to set
    • isAutoOrigin

      public boolean isAutoOrigin()
      Returns autoOrigin.
    • setAutoOrigin

      public void setAutoOrigin(boolean value)
      Parameters:
      value - the autoOrigin to set
    • getOrigin

      public mxPoint getOrigin()
      Returns origin.
    • setOrigin

      public void setOrigin(mxPoint value)
      Parameters:
      value - the origin to set
    • getChangesRepaintThreshold

      public int getChangesRepaintThreshold()
      Returns:
      Returns changesRepaintThreshold.
    • setChangesRepaintThreshold

      public void setChangesRepaintThreshold(int value)
      Parameters:
      value - the changesRepaintThreshold to set
    • isAllowNegativeCoordinates

      public boolean isAllowNegativeCoordinates()
      Returns isAllowNegativeCoordinates.
      Returns:
      the allowNegativeCoordinates
    • setAllowNegativeCoordinates

      public void setAllowNegativeCoordinates(boolean value)
      Parameters:
      value - the allowNegativeCoordinates to set
    • isCollapseToPreferredSize

      public boolean isCollapseToPreferredSize()
      Returns collapseToPreferredSize.
      Returns:
      the collapseToPreferredSize
    • setCollapseToPreferredSize

      public void setCollapseToPreferredSize(boolean value)
      Parameters:
      value - the collapseToPreferredSize to set
    • isKeepEdgesInForeground

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

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

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

      public void setKeepEdgesInBackground(boolean value)
      Parameters:
      value - the keepEdgesInBackground to set
    • 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.
    • getMinimumGraphSize

      public mxRectangle getMinimumGraphSize()
      Returns the minimum size of the diagram.
      Returns:
      Returns the minimum container size.
    • setMinimumGraphSize

      public void setMinimumGraphSize(mxRectangle value)
      Parameters:
      value - the minimumGraphSize 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.
    • getDefaultOverlap

      public double getDefaultOverlap()
      Gets defaultOverlap.
    • setDefaultOverlap

      public void setDefaultOverlap(double value)
      Sets defaultOverlap.
    • 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.
    • getFoldableCells

      public Object[] getFoldableCells(Object[] cells, boolean collapse)
      Returns the cells which are movable in the given array of cells.
    • isCellFoldable

      public boolean isCellFoldable(Object cell, boolean collapse)
      Returns true if the given cell is expandable. This implementation returns true if the cell has at least one child and its style does not specify mxConstants.STYLE_FOLDABLE to be 0.
      Parameters:
      cell - whose expandable state should be returned.
      Returns:
      Returns true if the given cell is expandable.
    • isGridEnabled

      public boolean isGridEnabled()
      Returns true if the grid is enabled.
      Returns:
      Returns the enabled state of the grid.
    • setGridEnabled

      public void setGridEnabled(boolean value)
      Sets if the grid is enabled.
      Parameters:
      value - Specifies if the grid should be enabled.
    • isPortsEnabled

      public boolean isPortsEnabled()
      Returns true if ports are enabled.
      Returns:
      Returns the enabled state of the ports.
    • setPortsEnabled

      public void setPortsEnabled(boolean value)
      Sets if ports are enabled.
      Parameters:
      value - Specifies if the ports should be enabled.
    • getGridSize

      public int getGridSize()
      Returns the grid size.
      Returns:
      Returns the grid size
    • setGridSize

      public void setGridSize(int value)
      Sets the grid size and fires a property change event for gridSize.
      Parameters:
      value - New grid size to be used.
    • getAlternateEdgeStyle

      public String getAlternateEdgeStyle()
      Returns alternateEdgeStyle.
    • setAlternateEdgeStyle

      public void setAlternateEdgeStyle(String value)
      Sets alternateEdgeStyle.
    • isValidDropTarget

      public boolean isValidDropTarget(Object cell, Object[] cells)
      Returns true if the given cell is a valid drop target for the specified cells. This returns true if the cell is a swimlane, has children and is not collapsed, or if splitEnabled is true and isSplitTarget returns true for the given arguments
      Parameters:
      cell - Object that represents the possible drop target.
      cells - Objects that are going to be dropped.
      Returns:
      Returns true if the cell is a valid drop target for the given cells.
    • isSplitTarget

      public boolean isSplitTarget(Object target, Object[] cells)
      Returns true if split is enabled and the given edge may be splitted into two edges with the given cell as a new terminal between the two.
      Parameters:
      target - Object that represents the edge to be splitted.
      cells - Array of cells to add into the given edge.
      Returns:
      Returns true if the given edge may be splitted by the given cell.
    • getDropTarget

      public Object getDropTarget(Object[] cells, Point pt, Object cell)
      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 swimlaneNesting 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 isDropEnabled returns true.
    • 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.
    • setDefaultParent

      public void setDefaultParent(Object value)
      Sets the default parent to be returned by getDefaultParent. Set this to null to return the first child of the root in getDefaultParent.
    • 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.
    • getConnections

      public Object[] getConnections(Object cell, Object parent, boolean recurse)
      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. If specified the opposite end of any edge must be a direct child of that parent in order for the 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.
    • getEdges

      public Object[] getEdges(Object cell, Object parent, boolean incoming, boolean outgoing, boolean includeLoops, boolean recurse)
      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. If specified the opposite end of any edge must be a child of that parent in order for the edge to be returned. The recurse parameter specifies whether or not it must be the direct child or the parent just be an ancestral parent.
      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.
      recurse - Specifies if the parent specified only need be an ancestral parent, true, or the direct parent, false
      Returns:
      Returns the edges connected to the given cell.
    • isValidAncestor

      public boolean isValidAncestor(Object cell, Object parent, boolean recurse)
      Returns whether or not the specified parent is a valid ancestor of the specified cell, either direct or indirectly based on whether ancestor recursion is enabled.
      Parameters:
      cell - the possible child cell
      parent - the possible parent cell
      recurse - whether or not to recurse the child ancestors
      Returns:
      whether or not the specified parent is a valid ancestor of the specified cell, either direct or indirectly based on whether ancestor recursion is enabled.
    • 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 target terminals should be included in the result.
      Returns:
      Returns the cells at the opposite 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 List<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:
      List of tree roots in parent.
    • findTreeRoots

      public List<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:
      List of tree roots in parent.
    • findTreeRoots

      public List<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:
      List of tree roots in parent.
    • traverse

      public void traverse(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor)
      Traverses the tree starting at the given vertex. Here is how to use this method for a given vertex (root) which is typically the root of a tree: graph.traverse(root, true, new mxICellVisitor() { public boolean visit(Object vertex, Object edge) { System.out.println("edge="+graph.convertValueToString(edge)+ " vertex="+graph.convertValueToString(vertex)); return true; } });
      Parameters:
      vertex -
      directed -
      visitor -
    • traverse

      public void traverse(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor, Object edge, Set<Object> 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.
    • getSelectionModel

      public mxGraphSelectionModel getSelectionModel()
    • getSelectionCount

      public int getSelectionCount()
    • isCellSelected

      public boolean isCellSelected(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<Object> cells)
      Parameters:
      cells -
    • addSelectionCell

      public void addSelectionCell(Object cell)
    • addSelectionCells

      public void addSelectionCells(Object[] cells)
    • removeSelectionCell

      public void removeSelectionCell(Object cell)
    • removeSelectionCells

      public void removeSelectionCells(Object[] cells)
    • selectNextCell

      public void selectNextCell()
      Selects the next cell.
    • selectPreviousCell

      public void selectPreviousCell()
      Selects the previous cell.
    • selectParentCell

      public void selectParentCell()
      Selects the parent cell.
    • selectChildCell

      public void selectChildCell()
      Selects the first child cell.
    • selectCell

      public void selectCell(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 .
    • drawGraph

      public void drawGraph(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.
    • drawState

      public void drawState(mxICanvas canvas, mxCellState state, boolean drawLabel)
      Draws the cell state with the given label onto the 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.
      state - State of the cell to be drawn.
      drawLabel - Indicates if the label should be drawn.
    • cellDrawn

      protected void cellDrawn(mxICanvas canvas, mxCellState state, 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:
    • addPropertyChangeListener

      public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Parameters:
      propertyName -
      listener -
      See Also:
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      Parameters:
      listener -
      See Also:
    • removePropertyChangeListener

      public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Parameters:
      propertyName -
      listener -
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • main

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