Package com.mxgraph.view
Class mxGraph
- java.lang.Object
-
- com.mxgraph.util.mxEventSource
-
- com.mxgraph.view.mxGraph
-
public class mxGraph extends mxEventSource
Implements a graph object that allows to create diagrams from a graph model and stylesheet.Images
To create an image from a graph, use the following code for a given XML document (doc) and File (file):Image img = mxCellRenderer.createBufferedImage( graph, null, 1, Color.WHITE, false, null); ImageIO.write(img, "png", file);
If the XML is given as a string rather than a document, the document can be obtained using mxUtils.parse. 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. Thecells
andalign
properties contain the respective arguments that were passed to alignCells. mxEvent.FLIP_EDGE fires between begin- and endUpdate in flipEdge. Theedge
property contains the edge passed to flipEdge. mxEvent.ORDER_CELLS fires between begin- and endUpdate in orderCells. Thecells
andback
properties contain the respective arguments that were passed to orderCells. mxEvent.CELLS_ORDERED fires between begin- and endUpdate in cellsOrdered. Thecells
andback
arguments contain the respective arguments that were passed to cellsOrdered. mxEvent.GROUP_CELLS fires between begin- and endUpdate in groupCells. Thegroup
,cells
andborder
arguments contain the respective arguments that were passed to groupCells. mxEvent.UNGROUP_CELLS fires between begin- and endUpdate in ungroupCells. Thecells
property contains the array of cells that was passed to ungroupCells. mxEvent.REMOVE_CELLS_FROM_PARENT fires between begin- and endUpdate in removeCellsFromParent. Thecells
property contains the array of cells that was passed to removeCellsFromParent. mxEvent.ADD_CELLS fires between begin- and endUpdate in addCells. Thecells
,parent
,index
,source
andtarget
properties contain the respective arguments that were passed to addCells. mxEvent.CELLS_ADDED fires between begin- and endUpdate in cellsAdded. Thecells
,parent
,index
,source
,target
andabsolute
properties contain the respective arguments that were passed to cellsAdded. mxEvent.REMOVE_CELLS fires between begin- and endUpdate in removeCells. Thecells
andincludeEdges
arguments contain the respective arguments that were passed to removeCells. mxEvent.CELLS_REMOVED fires between begin- and endUpdate in cellsRemoved. Thecells
argument contains the array of cells that was removed. mxEvent.SPLIT_EDGE fires between begin- and endUpdate in splitEdge. Theedge
property contains the edge to be splitted, thecells
,newEdge
,dx
anddy
properties contain the respective arguments that were passed to splitEdge. mxEvent.TOGGLE_CELLS fires between begin- and endUpdate in toggleCells. Theshow
,cells
andincludeEdges
properties contain the respective arguments that were passed to toggleCells. mxEvent.FOLD_CELLS fires between begin- and endUpdate in foldCells. Thecollapse
,cells
andrecurse
properties contain the respective arguments that were passed to foldCells. mxEvent.CELLS_FOLDED fires between begin- and endUpdate in cellsFolded. Thecollapse
,cells
andrecurse
properties contain the respective arguments that were passed to cellsFolded. mxEvent.UPDATE_CELL_SIZE fires between begin- and endUpdate in updateCellSize. Thecell
andignoreChildren
properties contain the respective arguments that were passed to updateCellSize. mxEvent.RESIZE_CELLS fires between begin- and endUpdate in resizeCells. Thecells
andbounds
properties contain the respective arguments that were passed to resizeCells. mxEvent.CELLS_RESIZED fires between begin- and endUpdate in cellsResized. Thecells
andbounds
properties contain the respective arguments that were passed to cellsResized. mxEvent.MOVE_CELLS fires between begin- and endUpdate in moveCells. Thecells
,dx
,dy
,clone
,target
andlocation
properties contain the respective arguments that were passed to moveCells. mxEvent.CELLS_MOVED fires between begin- and endUpdate in cellsMoved. Thecells
,dx
,dy
anddisconnect
properties contain the respective arguments that were passed to cellsMoved. mxEvent.CONNECT_CELL fires between begin- and endUpdate in connectCell. Theedge
,terminal
andsource
properties contain the respective arguments that were passed to connectCell. mxEvent.CELL_CONNECTED fires between begin- and endUpdate in cellConnected. Theedge
,terminal
andsource
properties contain the respective arguments that were passed to cellConnected. mxEvent.REPAINT fires if a repaint was requested by calling repaint. Theregion
property contains the optional mxRectangle that was passed to repaint to define the dirty region.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
mxGraph.mxICellVisitor
-
Nested classes/interfaces inherited from class com.mxgraph.util.mxEventSource
mxEventSource.mxIEventListener
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
allowDanglingEdges
Specifies if edges with disconnected terminals are allowed in the graph.protected boolean
allowLoops
Specifies if loops (aka self-references) are allowed.protected boolean
allowNegativeCoordinates
Specifies if negative coordinates for vertices are allowed.protected java.lang.String
alternateEdgeStyle
Specifies the alternate edge style to be used if the main control point on an edge is being doubleclicked.protected boolean
autoOrigin
Specifies if the origin should be automatically updated.protected boolean
autoSizeCells
Specifies if the graph should automatically update the cell size after an edit.protected int
border
Border to be added to the bottom and right side when the container is being resized after the graph has been changed.protected boolean
cellsBendable
Specifies the return value for isCell(s)Bendable.protected boolean
cellsCloneable
Specifies the return value for isCell(s)Cloneable.protected boolean
cellsDeletable
Specifies the return value for isCell(s)Deletable.protected boolean
cellsDisconnectable
Specifies the return value for isCellDisconntableFromTerminal.protected boolean
cellsEditable
Specifies the return value for isCell(s)Editable.protected boolean
cellsLocked
Specifies the return value for isCell(s)Locked.protected boolean
cellsMovable
Specifies the return value for isCell(s)Movable.protected boolean
cellsResizable
Specifies the return value for isCell(s)Sizable.protected boolean
cellsSelectable
Specifies the return value for isCell(s)Selectable.protected int
changesRepaintThreshold
Specifies the maximum number of changes that should be processed to find the dirty region.protected java.beans.PropertyChangeSupport
changeSupport
Property change event handling.protected boolean
cloneInvalidEdges
Specifies if edges that are cloned should be validated and only inserted if they are valid.protected boolean
collapseToPreferredSize
Specifies if the cell size should be changed to the preferred size when a cell is first collapsed.protected boolean
connectableEdges
Specifies if edges are connectable.protected boolean
constrainChildren
Specifies the return value for isConstrainChildren.protected mxEdgeStyle.mxEdgeStyleFunction
defaultLoopStyle
Specifies the default style for loops.protected double
defaultOverlap
Value returned by getOverlap if isAllowOverlapParent returns true for the given cell.protected java.lang.Object
defaultParent
Specifies the default parent to be used to insert new cells.protected boolean
disconnectOnMove
Specifies if edges should be disconnected from their terminals when they are moved.protected boolean
dropEnabled
Specifies the return value for isDropEnabled.protected boolean
edgeLabelsMovable
Specifies the return value for edges in isLabelMovable.protected boolean
enabled
Specifies the return value for isEnabled.protected boolean
extendParents
Specifies if a parent should contain the child bounds after a resize of the child.protected boolean
extendParentsOnAdd
Specifies if parents should be extended according to theswitch if cells are added. protected mxEventSource.mxIEventListener
fullRepaintHandler
Fires repaint events for full repaints.protected mxEventSource.mxIEventListener
graphModelChangeHandler
Fires repaint events for model changes.protected boolean
gridEnabled
Specifies if the grid is enabled.protected int
gridSize
Specifies the grid size.protected boolean
htmlLabels
Specifies the return value for isHtmlLabel.protected static java.util.List<mxImageBundle>
imageBundles
Holds the list of bundles.protected boolean
keepEdgesInBackground
Specifies if edges should appear in the background regardless of their order in the model.protected boolean
keepEdgesInForeground
Specifies if edges should appear in the foreground regardless of their order in the model.protected boolean
labelsClipped
Specifies the return value for isLabel(s)Clipped.protected boolean
labelsVisible
Specifies if labels should be visible.protected mxRectangle
maximumGraphBounds
that specifies the area in which all cells in the diagram should be placed. protected mxRectangle
minimumGraphSize
mxRectangle that specifies the minimum size of the graph canvas inside the scrollpane.protected mxIGraphModel
model
Holds the model that contains the cells to be displayed.protected boolean
multigraph
Specifies if multiple edges in the same direction between the same pair of vertices are allowed.protected mxMultiplicity[]
multiplicities
Specifies the multiplicities to be used for validation of the graph.protected mxPoint
origin
Holds the current automatic origin.protected boolean
portsEnabled
Specifies if ports are enabled.protected boolean
resetEdgesOnConnect
Specifies if edge control points should be reset after the the edge has been reconnected.protected boolean
resetEdgesOnMove
Specifies if edge control points should be reset after the move of a connected cell.protected boolean
resetEdgesOnResize
Specifies if loops (aka self-references) are allowed.protected boolean
resetViewOnRootChange
Specifies if the scale and translate should be reset if the root changes in the model.protected mxGraphSelectionModel
selectionModel
Holds thethat models the current selection. protected boolean
splitEnabled
Specifies if dropping onto edges should be enabled.protected mxStylesheet
stylesheet
Holds the stylesheet that defines the appearance of the cells.protected boolean
swimlaneNesting
Specifies if nesting of swimlanes is allowed.protected mxEventSource.mxIEventListener
updateOriginHandler
Fires repaint events for full repaints.static java.lang.String
VERSION
Holds the version number of this release.protected boolean
vertexLabelsMovable
Specifies the return value for vertices in isLabelMovable.protected mxGraphView
view
Holds the view that caches the cell states.-
Fields inherited from class com.mxgraph.util.mxEventSource
eventListeners, eventsEnabled, eventSource
-
-
Constructor Summary
Constructors Constructor Description mxGraph()
Constructs a new graph with an emptymxGraphModel
.mxGraph(mxIGraphModel model)
Constructs a new graph for the specified model.mxGraph(mxIGraphModel model, mxStylesheet stylesheet)
Constructs a new graph for the specified model.mxGraph(mxStylesheet stylesheet)
Constructs a new graph for the specified model.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object[]
addAllEdges(java.lang.Object[] cells)
Returns an array with the given cells and all edges that are connected to a cell or one of its descendants.java.lang.Object
addCell(java.lang.Object cell)
Adds the cell to the default parent.java.lang.Object
addCell(java.lang.Object cell, java.lang.Object parent)
Adds the cell to the parent.java.lang.Object
addCell(java.lang.Object cell, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.Object target)
Adds the cell to the parent and connects it to the given source and target terminals.java.lang.Object[]
addCells(java.lang.Object[] cells)
Adds the cells to the default parent.java.lang.Object[]
addCells(java.lang.Object[] cells, java.lang.Object parent)
Adds the cells to the parent.java.lang.Object[]
addCells(java.lang.Object[] cells, java.lang.Object parent, java.lang.Integer index)
Adds the cells to the parent at the given index.java.lang.Object[]
addCells(java.lang.Object[] cells, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.Object target)
Adds the cells to the parent at the given index, connecting each cell to the optional source and target terminal.java.lang.Object
addEdge(java.lang.Object edge, java.lang.Object parent, java.lang.Object source, java.lang.Object target, java.lang.Integer index)
Adds the edge to the parent and connects it to the given source and target terminals.void
addImageBundle(mxImageBundle bundle)
Adds the specified bundle.void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
void
addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
void
addSelectionCell(java.lang.Object cell)
void
addSelectionCells(java.lang.Object[] cells)
void
addTopmostVerticesAndEdges(java.lang.Object cell, java.util.List<java.lang.Object> cells)
Returns the cells to be selected for the given list of changes.java.lang.Object[]
alignCells(java.lang.String align)
Aligns the selection cells vertically or horizontally according to the given alignment.java.lang.Object[]
alignCells(java.lang.String align, java.lang.Object[] cells)
Aligns the given cells vertically or horizontally according to the given alignment.java.lang.Object[]
alignCells(java.lang.String align, java.lang.Object[] cells, java.lang.Object param)
Aligns the given cells vertically or horizontally according to the given alignment using the optional parameter as the coordinate.void
cellConnected(java.lang.Object edge, java.lang.Object terminal, boolean source, mxConnectionConstraint constraint)
Sets the new terminal for the given edge and resets the edge points if isResetEdgesOnConnect returns true.protected void
cellDrawn(mxICanvas canvas, mxCellState state, java.lang.Object element, java.lang.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.void
cellLabelChanged(java.lang.Object cell, java.lang.Object value, boolean autoSize)
Sets the new label for a cell.void
cellsAdded(java.lang.Object[] cells, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.Object target, boolean absolute)
Adds the specified cells to the given parent.void
cellsAdded(java.lang.Object[] cells, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.Object target, boolean absolute, boolean constrain)
Adds the specified cells to the given parent.void
cellsFolded(java.lang.Object[] cells, boolean collapse, boolean recurse)
Invokes cellsFoldable with checkFoldable set to false.void
cellsFolded(java.lang.Object[] cells, boolean collapse, boolean recurse, boolean checkFoldable)
Sets the collapsed state of the specified cells.void
cellSizeUpdated(java.lang.Object cell, boolean ignoreChildren)
Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.void
cellsMoved(java.lang.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.void
cellsOrdered(java.lang.Object[] cells, boolean back)
Moves the given cells to the front or back.void
cellsRemoved(java.lang.Object[] cells)
Removes the given cells from the model.void
cellsResized(java.lang.Object[] cells, mxRectangle[] bounds)
Sets the bounds of the given cells and fires aevent. void
cellsToggled(java.lang.Object[] cells, boolean show)
Sets the visible state of the specified cells.void
clearSelection()
java.lang.Object[]
cloneCells(java.lang.Object[] cells)
Clones all cells in the given array.java.lang.Object[]
cloneCells(java.lang.Object[] cells, boolean allowInvalidEdges)
Returns the clones for the given cells.java.lang.Object
connectCell(java.lang.Object edge, java.lang.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.java.lang.Object
connectCell(java.lang.Object edge, java.lang.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.void
constrainChild(java.lang.Object cell)
Keeps the given cell inside the bounds returned by getCellContainmentArea for its parent, according to the rules defined by getOverlap and isConstrainChild.java.lang.String
convertValueToString(java.lang.Object cell)
Returns the textual representation for the given cell.java.lang.Object
createEdge(java.lang.Object parent, java.lang.String id, java.lang.Object value, java.lang.Object source, java.lang.Object target, java.lang.String style)
Hook method that creates the new edge for insertEdge.protected mxGraphView
createGraphView()
Constructs a new view to be used in this graph.java.lang.Object
createGroupCell(java.lang.Object[] cells)
Hook for creating the group cell to hold the given array ofif no group cell was given to the function. protected mxGraphSelectionModel
createSelectionModel()
Constructs a new selection model to be used in this graph.protected mxStylesheet
createStylesheet()
Constructs a new stylesheet to be used in this graph.java.lang.Object
createVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.String style)
Hook method that creates the new vertex for insertVertex.java.lang.Object
createVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.String style, boolean relative)
Hook method that creates the new vertex for insertVertex.void
disconnectGraph(java.lang.Object[] cells)
Disconnects the given edges from the terminals which are not in the given array.void
drawCell(mxICanvas canvas, java.lang.Object cell)
Draws the given cell and its descendants onto the specified canvas.void
drawGraph(mxICanvas canvas)
Draws the graph onto the given canvas.void
drawState(mxICanvas canvas, mxCellState state, boolean drawLabel)
Draws the cell state with the given label onto the canvas.void
enterGroup()
void
enterGroup(java.lang.Object cell)
Uses the given cell as the root of the displayed cell hierarchy.void
exitGroup()
Changes the current root to the next valid root in the displayed cell hierarchy.void
extendParent(java.lang.Object cell)
Resizes the parents recursively so that they contain the complete area of the resized child cell.java.util.List<java.lang.Object>
findTreeRoots(java.lang.Object parent)
Returns all visible children in the given parent which do not have incoming edges.java.util.List<java.lang.Object>
findTreeRoots(java.lang.Object parent, boolean isolate)
Returns all visible children in the given parent which do not have incoming edges.java.util.List<java.lang.Object>
findTreeRoots(java.lang.Object parent, boolean isolate, boolean invert)
Returns all visible children in the given parent which do not have incoming edges.java.lang.Object
flipEdge(java.lang.Object edge)
Called when the main control point of the edge is double-clicked.java.lang.Object[]
foldCells(boolean collapse)
Sets the collapsed state of the selection cells without recursion.java.lang.Object[]
foldCells(boolean collapse, boolean recurse)
Sets the collapsed state of the selection cells.java.lang.Object[]
foldCells(boolean collapse, boolean recurse, java.lang.Object[] cells)
Invokes foldCells with checkFoldable set to false.java.lang.Object[]
foldCells(boolean collapse, boolean recurse, java.lang.Object[] cells, boolean checkFoldable)
Sets the collapsed state of the specified cells and all descendants if recurse is true.mxConnectionConstraint[]
getAllConnectionConstraints(mxCellState terminal, boolean source)
Returns an array of all constraints for the given terminal.java.lang.Object[]
getAllEdges(java.lang.Object[] cells)
Returns all edges connected to the given cells or their descendants.java.lang.String
getAlternateEdgeStyle()
Returns alternateEdgeStyle.int
getBorder()
Returns the value of. mxRectangle
getBoundingBox(java.lang.Object cell)
Returns the bounds of the given cell.mxRectangle
getBoundingBox(java.lang.Object cell, boolean includeEdges)
Returns the bounding box of the given cell including all connected edges if includeEdge is true.mxRectangle
getBoundingBox(java.lang.Object cell, boolean includeEdges, boolean includeDescendants)
Returns the bounding box of the given cell including all connected edges if includeEdge is true.mxRectangle
getBoundingBoxFromGeometry(java.lang.Object[] cells)
Returns the bounding box for the geometries of the vertices in the given array of cells.mxRectangle
getBoundsForCells(java.lang.Object[] cells, boolean includeEdges, boolean includeDescendants, boolean boundingBox)
Returns the bounds for the given cells.mxRectangle
getBoundsForGroup(java.lang.Object group, java.lang.Object[] children, double border)
Returns the bounds to be used for the given group and children.mxRectangle
getCellBounds(java.lang.Object cell)
Returns the bounds of the given cell.mxRectangle
getCellBounds(java.lang.Object cell, boolean includeEdges)
Returns the bounds of the given cell including all connected edges if includeEdge is true.mxRectangle
getCellBounds(java.lang.Object cell, boolean includeEdges, boolean includeDescendants)
Returns the bounds of the given cell including all connected edges if includeEdge is true.mxRectangle
getCellBounds(java.lang.Object cell, boolean includeEdges, boolean includeDescendants, boolean boundingBox)
Returns the bounds of the given cell including all connected edges if includeEdge is true.mxRectangle
getCellContainmentArea(java.lang.Object cell)
Returns the mxRectangle inside which a cell is to be kept.mxGeometry
getCellGeometry(java.lang.Object cell)
Returns the geometry for the given cell.java.lang.Object[]
getCellsBeyond(double x0, double y0, java.lang.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.java.lang.Object[]
getCellsForGroup(java.lang.Object[] cells)
Returns the cells with the same parent as the first cell in the given array.java.util.Map<java.lang.String,java.lang.Object>
getCellStyle(java.lang.Object cell)
Returns an array of key, value pairs representing the cell style for the given cell.java.lang.String
getCellValidationError(java.lang.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.int
getChangesRepaintThreshold()
java.lang.Object[]
getChildCells(java.lang.Object parent)
Returns the visible children of the given parent.java.lang.Object[]
getChildCells(java.lang.Object parent, boolean vertices, boolean edges)
Returns the visible child vertices or edges in the given parent.java.lang.Object[]
getChildEdges(java.lang.Object parent)
Returns the visible child edges of the given parent.mxPoint
getChildOffsetForCell(java.lang.Object cell)
Returns the offset to be used for the cells inside the given cell.java.lang.Object[]
getChildVertices(java.lang.Object parent)
Returns the visible child vertices of the given parent.java.lang.Object[]
getCloneableCells(java.lang.Object[] cells)
Returns the cells which are movable in the given array of cells.mxConnectionConstraint
getConnectionConstraint(mxCellState edge, mxCellState terminal, boolean source)
Returns an connection constraint that describes the given connection point.mxPoint
getConnectionPoint(mxCellState vertex, mxConnectionConstraint constraint)
Sets the connection constraint that describes the given connection point.java.lang.Object[]
getConnections(java.lang.Object cell)
Returns all visible edges connected to the given cell without loops.java.lang.Object[]
getConnections(java.lang.Object cell, java.lang.Object parent)
Returns all visible edges connected to the given cell without loops.java.lang.Object[]
getConnections(java.lang.Object cell, java.lang.Object parent, boolean recurse)
Returns all visible edges connected to the given cell without loops.java.lang.Object
getCurrentRoot()
Returns the current root of the displayed cell hierarchy.mxEdgeStyle.mxEdgeStyleFunction
getDefaultLoopStyle()
Returns the default edge style used for loops.double
getDefaultOverlap()
Gets defaultOverlap.java.lang.Object
getDefaultParent()
Returns the first child of the root in the model, that is, the first or default layer of the diagram.java.lang.Object[]
getDeletableCells(java.lang.Object[] cells)
Returns the cells which are movable in the given array of cells.java.lang.Object
getDropTarget(java.lang.Object[] cells, java.awt.Point pt, java.lang.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.java.lang.Object[]
getEdges(java.lang.Object cell)
Returns all visible edges connected to the given cell including loops.java.lang.Object[]
getEdges(java.lang.Object cell, java.lang.Object parent)
Returns all visible edges connected to the given cell including loops.java.lang.Object[]
getEdges(java.lang.Object cell, java.lang.Object parent, boolean incoming, boolean outgoing, boolean includeLoops)
Returns the incoming and/or outgoing edges for the given cell.java.lang.Object[]
getEdges(java.lang.Object cell, java.lang.Object parent, boolean incoming, boolean outgoing, boolean includeLoops, boolean recurse)
Returns the incoming and/or outgoing edges for the given cell.java.lang.Object[]
getEdgesBetween(java.lang.Object source, java.lang.Object target)
Returns the edges between the given source and target.java.lang.Object[]
getEdgesBetween(java.lang.Object source, java.lang.Object target, boolean directed)
Returns the edges between the given source and target.java.lang.String
getEdgeValidationError(java.lang.Object edge, java.lang.Object source, java.lang.Object target)
Returns the validation error message to be displayed when inserting or changing an edges' connectivity.java.lang.Object[]
getFoldableCells(java.lang.Object[] cells, boolean collapse)
Returns the cells which are movable in the given array of cells.mxRectangle
getGraphBounds()
Returns the bounds of the visible graph.int
getGridSize()
Returns the grid size.java.lang.String
getImage(mxCellState state)
Returns the image URL for the given cell state.java.util.List<mxImageBundle>
getImageBundles()
Returns the image bundlesvoid
getImageBundles(java.util.List<mxImageBundle> value)
Returns the image bundlesjava.lang.String
getImageFromBundles(java.lang.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.java.lang.Object[]
getIncomingEdges(java.lang.Object cell)
Returns all incoming visible edges connected to the given cell without loops.java.lang.Object[]
getIncomingEdges(java.lang.Object cell, java.lang.Object parent)
Returns the visible incoming edges for the given cell.java.lang.String
getLabel(java.lang.Object cell)
Returns a string or DOM node that represents the label for the given cell.protected java.lang.String
getLinkForCell(java.lang.Object cell)
Returns the hyperlink to be used for the given cell.mxRectangle
getMaximumGraphBounds()
mxRectangle
getMinimumGraphSize()
Returns the minimum size of the diagram.mxIGraphModel
getModel()
Returns the graph model that contains the graph data.java.lang.Object[]
getMovableCells(java.lang.Object[] cells)
Returns the cells which are movable in the given array of cells.mxMultiplicity[]
getMultiplicities()
java.lang.Object[]
getOpposites(java.lang.Object[] edges, java.lang.Object terminal)
Returns all distinct visible opposite cells of the terminal on the given edges.java.lang.Object[]
getOpposites(java.lang.Object[] edges, java.lang.Object terminal, boolean sources, boolean targets)
Returns all distincts visible opposite cells for the specified terminal on the given edges.mxPoint
getOrigin()
Returns origin.java.lang.Object[]
getOutgoingEdges(java.lang.Object cell)
Returns all outgoing visible edges connected to the given cell without loops.java.lang.Object[]
getOutgoingEdges(java.lang.Object cell, java.lang.Object parent)
Returns the visible outgoing edges for the given cell.double
getOverlap(java.lang.Object cell)
Returns a decimal number representing the amount of the width and height of the given cell that is allowed to overlap its parent.mxRectangle
getPaintBounds(java.lang.Object[] cells)
Returns the bounding box of the given cells and their descendants.mxRectangle
getPreferredSizeForCell(java.lang.Object cell)
Returns the preferred width and height of the givenas an . java.lang.Object
getSelectionCell()
java.lang.Object[]
getSelectionCells()
java.lang.Object[]
getSelectionCellsForChanges(java.util.List<mxUndoableEdit.mxUndoableChange> changes)
Returns the cells to be selected for the given list of changes.int
getSelectionCount()
mxGraphSelectionModel
getSelectionModel()
mxRectangle
getStartSize(java.lang.Object swimlane)
Returns the start size of the given swimlane, that is, the width or height of the part that contains the title, depending on the horizontal style.mxStylesheet
getStylesheet()
Returns the stylesheet that provides the style.protected java.lang.String
getTargetForCell(java.lang.Object cell)
Returns the hyperlink to be used for the given cell.java.lang.Object
getTerminalForPort(java.lang.Object cell, boolean source)
Returns the terminal to be used for a given port.java.lang.String
getToolTipForCell(java.lang.Object cell)
Returns the tooltip to be used for the given cell.mxPoint
getTranslateForRoot(java.lang.Object cell)
Returns the translation to be used if the given cell is the root cell as an. mxGraphView
getView()
Returns the view that contains the cell states.mxRectangle
graphModelChanged(mxIGraphModel sender, java.util.List<mxUndoableEdit.mxUndoableChange> changes)
Called when the graph model changes.java.lang.Object
groupCells()
Groups the selection cells.java.lang.Object
groupCells(java.lang.Object group)
Groups the selection cells and adds them to the given group.java.lang.Object
groupCells(java.lang.Object group, double border)
Groups the selection cells and adds them to the given group.java.lang.Object
groupCells(java.lang.Object group, double border, java.lang.Object[] cells)
Adds the cells into the given group.void
home()
Uses the root of the model as the root of the displayed cell hierarchy and selects the previous root.java.lang.Object
insertEdge(java.lang.Object parent, java.lang.String id, java.lang.Object value, java.lang.Object source, java.lang.Object target)
Creates and adds a new edge with an empty style.java.lang.Object
insertEdge(java.lang.Object parent, java.lang.String id, java.lang.Object value, java.lang.Object source, java.lang.Object target, java.lang.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.java.lang.Object
insertVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height)
Creates and adds a new vertex with an empty style.java.lang.Object
insertVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.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.java.lang.Object
insertVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.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.boolean
isAllowDanglingEdges()
Returns allowDanglingEdgesboolean
isAllowLoops()
Returns allowLoops.boolean
isAllowNegativeCoordinates()
Returns isAllowNegativeCoordinates.boolean
isAllowOverlapParent(java.lang.Object cell)
Returns true if the given cell is allowed to be placed outside of the parents area.boolean
isAutoOrigin()
Returns autoOrigin.boolean
isAutoSizeCell(java.lang.Object cell)
Returns true if the size of the given cell should automatically be updated after a change of the label.boolean
isAutoSizeCells()
Returns true if the size of the given cell should automatically be updated after a change of the label.boolean
isCellBendable(java.lang.Object cell)
Returns true if the given cell is bendable.boolean
isCellCloneable(java.lang.Object cell)
Returns the constant true.boolean
isCellCollapsed(java.lang.Object cell)
Returns true if the given cell is collapsed in this graph.boolean
isCellConnectable(java.lang.Object cell)
Returns true if the given cell is connectable in this graph.boolean
isCellDeletable(java.lang.Object cell)
Returns true if the given cell is movable.boolean
isCellDisconnectable(java.lang.Object cell, java.lang.Object terminal, boolean source)
Returns true if the given cell is disconnectable from the source or target terminal.boolean
isCellEditable(java.lang.Object cell)
Returns true if the given cell is movable.boolean
isCellFoldable(java.lang.Object cell, boolean collapse)
Returns true if the given cell is expandable.boolean
isCellLocked(java.lang.Object cell)
Returns true if the given cell may not be moved, sized, bended, disconnected, edited or selected.boolean
isCellMovable(java.lang.Object cell)
Returns true if the given cell is movable.boolean
isCellResizable(java.lang.Object cell)
Returns true if the given cell is resizable.boolean
isCellsBendable()
Returns cellsBendable.boolean
isCellsCloneable()
Returns cellsCloneable.boolean
isCellsDeletable()
Returns cellsDeletable.boolean
isCellsDisconnectable()
Returns cellsDisconnectable.boolean
isCellsEditable()
Returns true if editing is allowed in this graph.boolean
isCellSelectable(java.lang.Object cell)
Returns true if the given cell is selectable.boolean
isCellSelected(java.lang.Object cell)
boolean
isCellsLocked()
Returns cellsLocked, the default return value for isCellLocked.boolean
isCellsMovable()
Returns cellsMovable.boolean
isCellsResizable()
Returns true if the given cell is resizable.boolean
isCellsSelectable()
Returns cellsSelectable.boolean
isCellVisible(java.lang.Object cell)
Returns true if the given cell is visible in this graph.boolean
isCloneInvalidEdges()
Returns cloneInvalidEdges.boolean
isCollapseToPreferredSize()
Returns collapseToPreferredSize.boolean
isConnectableEdges()
Returns connectableEdges.boolean
isConstrainChild(java.lang.Object cell)
Returns true if the given cell should be kept inside the bounds of its parent according to the rules defined by getOverlap and isAllowOverlapParent.boolean
isConstrainChildren()
Returns constrainChildren.boolean
isDisconnectOnMove()
Returns disconnectOnMoveboolean
isDropEnabled()
Returns true if the graph allows drop into other cells.boolean
isEdgeLabelsMovable()
Returns edgeLabelsMovable.boolean
isEdgeValid(java.lang.Object edge, java.lang.Object source, java.lang.Object target)
Checks if the return value of getEdgeValidationError for the given arguments is null.boolean
isEnabled()
Returns true if the graph is. boolean
isExtendParent(java.lang.Object cell)
Returns true if the parent of the given cell should be extended if the child has been resized so that it overlaps the parent.boolean
isExtendParents()
Returns extendParents.boolean
isExtendParentsOnAdd()
Returns extendParentsOnAdd.boolean
isGridEnabled()
Returns true if the grid is enabled.boolean
isHtmlLabel(java.lang.Object cell)
Returns true if the label must be rendered as HTML markup.boolean
isHtmlLabels()
boolean
isKeepEdgesInBackground()
boolean
isKeepEdgesInForeground()
boolean
isLabelClipped(java.lang.Object cell)
Returns true if the overflow portion of labels should be hidden.boolean
isLabelMovable(java.lang.Object cell)
Returns true if the given edges's label is moveable.boolean
isLabelsClipped()
Returns labelsClipped.boolean
isLabelsVisible()
boolean
isLoop(mxCellState state)
Returns true if the given cell state is a loop.boolean
isMultigraph()
Returns multigraph.boolean
isOrthogonal(mxCellState edge)
Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments.boolean
isPort(java.lang.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.boolean
isPortsEnabled()
Returns true if ports are enabled.boolean
isResetEdgesOnConnect()
Returns resetEdgesOnConnect.boolean
isResetEdgesOnMove()
Returns resetEdgesOnMove.boolean
isResetEdgesOnResize()
Returns resetEdgesOnResize.boolean
isResetViewOnRootChange()
Returns resetViewOnRootChange.boolean
isSelectionEmpty()
boolean
isSplitEnabled()
Affects the return values of isValidDropTarget to allow for edges as drop targets.boolean
isSplitTarget(java.lang.Object target, java.lang.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.boolean
isSwimlane(java.lang.Object cell)
Returns true if the given cell is a swimlane.boolean
isSwimlaneNesting()
Returns swimlaneNesting.boolean
isTerminalPointMovable(java.lang.Object cell, boolean source)
Function: isTerminalPointMovable Returns true if the given terminal point is movable.boolean
isValidAncestor(java.lang.Object cell, java.lang.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.boolean
isValidConnection(java.lang.Object source, java.lang.Object target)
Returns true if the given target cell is a valid target for source.boolean
isValidDropTarget(java.lang.Object cell, java.lang.Object[] cells)
Returns true if the given cell is a valid drop target for the specified cells.boolean
isValidRoot(java.lang.Object cell)
Returns true if the given cell is a valid root for the cell display hierarchy.boolean
isValidSource(java.lang.Object cell)
Returns true if the given cell is a valid source for new connections.boolean
isValidTarget(java.lang.Object cell)
Returns isValidSource for the given cell.boolean
isVertexLabelsMovable()
Returns vertexLabelsMovable.static void
main(java.lang.String[] args)
Logs the version number on the console.java.lang.Object[]
moveCells(java.lang.Object[] cells, double dx, double dy)
Moves the cells by the given amount.java.lang.Object[]
moveCells(java.lang.Object[] cells, double dx, double dy, boolean clone)
Moves or clones the cells and moves the cells or clones by the given amount.java.lang.Object[]
moveCells(java.lang.Object[] cells, double dx, double dy, boolean clone, java.lang.Object target, java.awt.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.java.lang.Object[]
orderCells(boolean back)
Moves the selection cells to the front or back.java.lang.Object[]
orderCells(boolean back, java.lang.Object[] cells)
Moves the given cells to the front or back.protected java.util.Map<java.lang.String,java.lang.Object>
postProcessCellStyle(java.util.Map<java.lang.String,java.lang.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.mxRectangle
processChange(mxUndoableEdit.mxUndoableChange change, boolean invalidate, boolean ignoreDirty)
Processes the given change and invalidates the respective cached data in. mxRectangle
processChanges(java.util.List<mxUndoableEdit.mxUndoableChange> changes, boolean invalidate, boolean ignoreDirty)
Processes the changes and returns the minimal rectangle to be repainted in the buffer.void
refresh()
Clears all cell states or the states for the hierarchy starting at the given cell and validates the graph.java.lang.Object[]
removeCells()
Removes the selection cells from the graph.java.lang.Object[]
removeCells(java.lang.Object[] cells)
Removes the given cells from the graph.java.lang.Object[]
removeCells(java.lang.Object[] cells, boolean includeEdges)
Removes the given cells from the graph including all connected edges if includeEdges is true.java.lang.Object[]
removeCellsFromParent()
Removes the selection cells from their parents and adds them to the default parent returned by getDefaultParent.java.lang.Object[]
removeCellsFromParent(java.lang.Object[] cells)
Removes the specified cells from their parents and adds them to the default parent.void
removeImageBundle(mxImageBundle bundle)
Removes the specified bundle.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
void
removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
void
removeSelectionCell(java.lang.Object cell)
void
removeSelectionCells(java.lang.Object[] cells)
protected void
removeStateForCell(java.lang.Object cell)
Removes all cached information for the given cell and its descendants.void
repaint()
Fires a repaint event.void
repaint(mxRectangle region)
Fires a repaint event.java.lang.Object
resetEdge(java.lang.Object edge)
Resets the control points of the given edge.void
resetEdges(java.lang.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.java.lang.Object
resizeCell(java.lang.Object cell, mxRectangle bounds)
Sets the bounds of the given cell using resizeCells.java.lang.Object[]
resizeCells(java.lang.Object[] cells, mxRectangle[] bounds)
Sets the bounds of the given cells and fires a mxEvent.RESIZE_CELLS event.void
selectAll()
void
selectAll(java.lang.Object parent)
Selects all children of the given parent cell or the children of the default parent if no parent is specified.void
selectCell(boolean isNext, boolean isParent, boolean isChild)
Selects the next, parent, first child or previous cell, if all arguments are false.void
selectCells(boolean vertices, boolean edges)
Selects all vertices and/or edges depending on the given boolean arguments recursively, starting at the default parent.void
selectCells(boolean vertices, boolean edges, java.lang.Object parent)
Selects all vertices and/or edges depending on the given boolean arguments recursively, starting at the given parent or the default parent if no parent is specified.void
selectChildCell()
Selects the first child cell.void
selectEdges()
Selects all vertices inside the default parent.void
selectEdges(java.lang.Object parent)
Selects all vertices inside the given parent or the default parent if no parent is given.void
selectNextCell()
Selects the next cell.void
selectParentCell()
Selects the parent cell.void
selectPreviousCell()
Selects the previous cell.void
selectVertices()
Selects all vertices inside the default parent.void
selectVertices(java.lang.Object parent)
Selects all vertices inside the given parent or the default parent if no parent is given.void
setAllowDanglingEdges(boolean value)
Sets allowDanglingEdges.void
setAllowLoops(boolean value)
Sets allowLoops.void
setAllowNegativeCoordinates(boolean value)
void
setAlternateEdgeStyle(java.lang.String value)
Sets alternateEdgeStyle.void
setAutoOrigin(boolean value)
void
setAutoSizeCells(boolean value)
Specifies if cell sizes should be automatically updated after a label change.void
setBorder(int value)
Sets the value of. void
setCellsBendable(boolean value)
Sets cellsBendable.void
setCellsCloneable(boolean value)
Specifies if the graph should allow cloning of cells by holding down the control key while cells are being moved.void
setCellsDeletable(boolean value)
Sets cellsDeletable.void
setCellsDisconnectable(boolean value)
Sets cellsDisconnectable.void
setCellsEditable(boolean value)
Sets if the graph is editable.void
setCellsLocked(boolean value)
Sets cellsLocked, the default return value for isCellLocked and fires a property change event for cellsLocked.void
setCellsMovable(boolean value)
Sets cellsMovable.void
setCellsResizable(boolean value)
Sets if the graph is resizable.void
setCellsSelectable(boolean value)
Sets cellsSelectable.java.lang.Object[]
setCellStyle(java.lang.String style)
Sets the style of the selection cells to the given value.java.lang.Object[]
setCellStyle(java.lang.String style, java.lang.Object[] cells)
Sets the style of the specified cells.java.lang.Object[]
setCellStyleFlags(java.lang.String key, int flag, boolean value)
Sets or toggles the given bit for the given key in the styles of the selection cells.java.lang.Object[]
setCellStyleFlags(java.lang.String key, int flag, java.lang.Boolean value, java.lang.Object[] cells)
Sets or toggles the given bit for the given key in the styles of the specified cells.java.lang.Object[]
setCellStyles(java.lang.String key, java.lang.String value)
Sets the key to value in the styles of the selection cells.java.lang.Object[]
setCellStyles(java.lang.String key, java.lang.String value, java.lang.Object[] cells)
Sets the key to value in the styles of the given cells.void
setChangesRepaintThreshold(int value)
void
setCloneInvalidEdges(boolean value)
Sets cloneInvalidEdge.void
setCollapseToPreferredSize(boolean value)
void
setConnectableEdges(boolean value)
Sets connetableEdges.void
setConnectionConstraint(java.lang.Object edge, java.lang.Object terminal, boolean source, mxConnectionConstraint constraint)
Sets the connection constraint that describes the given connection point.void
setConstrainChildren(boolean value)
void
setDefaultLoopStyle(mxEdgeStyle.mxEdgeStyleFunction value)
Sets the default style used for loops.void
setDefaultOverlap(double value)
Sets defaultOverlap.void
setDefaultParent(java.lang.Object value)
Sets the default parent to be returned by getDefaultParent.void
setDisconnectOnMove(boolean value)
Sets disconnectOnMove.void
setDropEnabled(boolean value)
Sets dropEnabled.void
setEdgeLabelsMovable(boolean value)
Returns edgeLabelsMovable.void
setEnabled(boolean value)
Specifies if the graph should allow any interactions.void
setExtendParents(boolean value)
Sets extendParents.void
setExtendParentsOnAdd(boolean value)
Sets extendParentsOnAdd.void
setGridEnabled(boolean value)
Sets if the grid is enabled.void
setGridSize(int value)
Sets the grid size and fires a property change event for gridSize.void
setHtmlLabels(boolean value)
void
setKeepEdgesInBackground(boolean value)
void
setKeepEdgesInForeground(boolean value)
void
setLabelsClipped(boolean value)
Sets labelsClipped.void
setLabelsVisible(boolean value)
void
setMaximumGraphBounds(mxRectangle value)
void
setMinimumGraphSize(mxRectangle value)
void
setModel(mxIGraphModel value)
Sets the graph model that contains the data, and fires an mxEvent.CHANGE followed by an mxEvent.REPAINT event.void
setMultigraph(boolean value)
Sets multigraph.void
setMultiplicities(mxMultiplicity[] value)
void
setOrigin(mxPoint value)
void
setPortsEnabled(boolean value)
Sets if ports are enabled.void
setResetEdgesOnConnect(boolean value)
Sets resetEdgesOnConnect.void
setResetEdgesOnMove(boolean value)
Sets resetEdgesOnMove.void
setResetEdgesOnResize(boolean value)
Sets resetEdgesOnResize.void
setResetViewOnRootChange(boolean value)
Sets resetEdgesOnResize.void
setSelectionCell(java.lang.Object cell)
void
setSelectionCells(java.lang.Object[] cells)
void
setSelectionCells(java.util.Collection<java.lang.Object> cells)
void
setSplitEnabled(boolean value)
Sets splitEnabled.void
setStylesheet(mxStylesheet value)
Sets the stylesheet that provides the style.void
setSwimlaneNesting(boolean value)
Sets swimlaneNesting.void
setVertexLabelsMovable(boolean value)
Sets vertexLabelsMovable.void
setView(mxGraphView value)
Sets the view that contains the cell states.double
snap(double value)
Snaps the given numeric value to the grid ifis true. java.lang.Object
splitEdge(java.lang.Object edge, java.lang.Object[] cells)
java.lang.Object
splitEdge(java.lang.Object edge, java.lang.Object[] cells, double dx, double dy)
java.lang.Object
splitEdge(java.lang.Object edge, java.lang.Object[] cells, java.lang.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.void
swapBounds(java.lang.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.java.lang.Object[]
toggleCells(boolean show)
Sets the visible state of the selection cells.java.lang.Object[]
toggleCells(boolean show, java.lang.Object[] cells)
Sets the visible state of the specified cells.java.lang.Object[]
toggleCells(boolean show, java.lang.Object[] cells, boolean includeEdges)
Sets the visible state of the specified cells and all connected edges if includeEdges is true.java.lang.Object
toggleCellStyle(java.lang.String key, boolean defaultValue, java.lang.Object cell)
Toggles the boolean value for the given key in the style of the given cell.java.lang.Object[]
toggleCellStyleFlags(java.lang.String key, int flag)
Toggles the given bit for the given key in the styles of the selection cells.java.lang.Object[]
toggleCellStyleFlags(java.lang.String key, int flag, java.lang.Object[] cells)
Toggles the given bit for the given key in the styles of the specified cells.java.lang.Object[]
toggleCellStyles(java.lang.String key, boolean defaultValue)
Toggles the boolean value for the given key in the style of the selection cells.java.lang.Object[]
toggleCellStyles(java.lang.String key, boolean defaultValue, java.lang.Object[] cells)
Toggles the boolean value for the given key in the style of the given cells.java.lang.String
toString()
void
translateCell(java.lang.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.void
traverse(java.lang.Object vertex, boolean directed, mxGraph.mxICellVisitor visitor)
Traverses the tree starting at the given vertex.void
traverse(java.lang.Object vertex, boolean directed, mxGraph.mxICellVisitor visitor, java.lang.Object edge, java.util.Set<java.lang.Object> visited)
Traverses the (directed) graph invoking the given function for each visited vertex and edge.java.lang.Object[]
ungroupCells()
Ungroups the selection cells.java.lang.Object[]
ungroupCells(java.lang.Object[] cells)
Ungroups the given cells by moving the children the children to their parents parent and removing the empty groups.void
updateAlternateBounds(java.lang.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.java.lang.Object
updateCellSize(java.lang.Object cell)
Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.java.lang.Object
updateCellSize(java.lang.Object cell, boolean ignoreChildren)
Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.java.lang.Object[]
updateGroupBounds()
Updates the bounds of the given array of groups so that it includes all child vertices.java.lang.Object[]
updateGroupBounds(java.lang.Object[] cells)
Updates the bounds of the given array of groups so that it includes all child vertices.java.lang.Object[]
updateGroupBounds(java.lang.Object[] cells, int border)
Updates the bounds of the given array of groups so that it includes all child vertices.java.lang.Object[]
updateGroupBounds(java.lang.Object[] cells, int border, boolean moveParent)
Updates the bounds of the given array of groups so that it includes all child vertices.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).protected void
updateSelection()
Function: updateSelection Removes selection cells that are not in the model from the selection.java.lang.String
validateCell(java.lang.Object cell, java.util.Hashtable<java.lang.Object,java.lang.Object> context)
Hook method for subclassers to return an error message for the given cell and validation context.java.lang.String
validateEdge(java.lang.Object edge, java.lang.Object source, java.lang.Object target)
Hook method for subclassers to return an error message for the given edge and terminals.-
Methods inherited from class com.mxgraph.util.mxEventSource
addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource
-
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
Holds the version number of this release. Current version is 4.2.2.- See Also:
- Constant Field Values
-
changeSupport
protected java.beans.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 thethat 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 into 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 java.lang.Object defaultParent
Specifies the default parent to be used to insert new cells. This is used in getDefaultParent. Default is null.
-
alternateEdgeStyle
protected java.lang.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 theswitch 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 java.util.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 Detail
-
mxGraph
public mxGraph()
Constructs a new graph with an emptymxGraphModel
.
-
mxGraph
public mxGraph(mxIGraphModel model)
Constructs a new graph for the specified model. If no model is specified, then a new, emptymxGraphModel
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, emptymxGraphModel
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, emptymxGraphModel
is used.- Parameters:
model
- Model that contains the graph data
-
-
Method Detail
-
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(java.lang.Object cell, java.util.List<java.lang.Object> cells)
Returns the cells to be selected for the given list of changes.
-
getSelectionCellsForChanges
public java.lang.Object[] getSelectionCellsForChanges(java.util.List<mxUndoableEdit.mxUndoableChange> changes)
Returns the cells to be selected for the given list of changes.
-
graphModelChanged
public mxRectangle graphModelChanged(mxIGraphModel sender, java.util.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(java.util.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(java.lang.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 java.util.Map<java.lang.String,java.lang.Object> getCellStyle(java.lang.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 java.util.Map<java.lang.String,java.lang.Object> postProcessCellStyle(java.util.Map<java.lang.String,java.lang.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 java.lang.Object[] setCellStyle(java.lang.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 java.lang.Object[] setCellStyle(java.lang.String style, java.lang.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 ofto set the style for. Default is the selection cells.
-
toggleCellStyle
public java.lang.Object toggleCellStyle(java.lang.String key, boolean defaultValue, java.lang.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 java.lang.Object[] toggleCellStyles(java.lang.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 java.lang.Object[] toggleCellStyles(java.lang.String key, boolean defaultValue, java.lang.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 java.lang.Object[] setCellStyles(java.lang.String key, java.lang.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 java.lang.Object[] setCellStyles(java.lang.String key, java.lang.String value, java.lang.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 java.lang.Object[] toggleCellStyleFlags(java.lang.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 java.lang.Object[] toggleCellStyleFlags(java.lang.String key, int flag, java.lang.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 ofto change the style for. Default is the selection cells.
-
setCellStyleFlags
public java.lang.Object[] setCellStyleFlags(java.lang.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 java.lang.Object[] setCellStyleFlags(java.lang.String key, int flag, java.lang.Boolean value, java.lang.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 java.lang.String getImageFromBundles(java.lang.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 java.util.List<mxImageBundle> getImageBundles()
Returns the image bundles
-
getImageBundles
public void getImageBundles(java.util.List<mxImageBundle> value)
Returns the image bundles
-
alignCells
public java.lang.Object[] alignCells(java.lang.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 java.lang.Object[] alignCells(java.lang.String align, java.lang.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 java.lang.Object[] alignCells(java.lang.String align, java.lang.Object[] cells, java.lang.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 java.lang.Object flipEdge(java.lang.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 java.lang.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 java.lang.Object[] orderCells(boolean back, java.lang.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(java.lang.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 java.lang.Object groupCells()
Groups the selection cells. This is a shortcut method.- Returns:
- Returns the new group.
-
groupCells
public java.lang.Object groupCells(java.lang.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 java.lang.Object groupCells(java.lang.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 java.lang.Object groupCells(java.lang.Object group, double border, java.lang.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 java.lang.Object[] getCellsForGroup(java.lang.Object[] cells)
Returns the cells with the same parent as the first cell in the given array.
-
getBoundsForGroup
public mxRectangle getBoundsForGroup(java.lang.Object group, java.lang.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 java.lang.Object createGroupCell(java.lang.Object[] cells)
Hook for creating the group cell to hold the given array ofif 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 java.lang.Object[] ungroupCells()
Ungroups the selection cells. This is a shortcut method.
-
ungroupCells
public java.lang.Object[] ungroupCells(java.lang.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 java.lang.Object[] removeCellsFromParent()
Removes the selection cells from their parents and adds them to the default parent returned by getDefaultParent.
-
removeCellsFromParent
public java.lang.Object[] removeCellsFromParent(java.lang.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 java.lang.Object[] updateGroupBounds()
Updates the bounds of the given array of groups so that it includes all child vertices.
-
updateGroupBounds
public java.lang.Object[] updateGroupBounds(java.lang.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 java.lang.Object[] updateGroupBounds(java.lang.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 java.lang.Object[] updateGroupBounds(java.lang.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 java.lang.Object[] cloneCells(java.lang.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 java.lang.Object[] cloneCells(java.lang.Object[] cells, boolean allowInvalidEdges)
Returns the clones for the given cells. The clones are created recursively using. 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 java.lang.Object insertVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height)
Creates and adds a new vertex with an empty style.
-
insertVertex
public java.lang.Object insertVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.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 java.lang.Object insertVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.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 java.lang.Object createVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.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 java.lang.Object createVertex(java.lang.Object parent, java.lang.String id, java.lang.Object value, double x, double y, double width, double height, java.lang.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 java.lang.Object insertEdge(java.lang.Object parent, java.lang.String id, java.lang.Object value, java.lang.Object source, java.lang.Object target)
Creates and adds a new edge with an empty style.
-
insertEdge
public java.lang.Object insertEdge(java.lang.Object parent, java.lang.String id, java.lang.Object value, java.lang.Object source, java.lang.Object target, java.lang.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 java.lang.Object createEdge(java.lang.Object parent, java.lang.String id, java.lang.Object value, java.lang.Object source, java.lang.Object target, java.lang.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 java.lang.Object addEdge(java.lang.Object edge, java.lang.Object parent, java.lang.Object source, java.lang.Object target, java.lang.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 java.lang.Object addCell(java.lang.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 java.lang.Object addCell(java.lang.Object cell, java.lang.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 java.lang.Object addCell(java.lang.Object cell, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.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 java.lang.Object[] addCells(java.lang.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 java.lang.Object[] addCells(java.lang.Object[] cells, java.lang.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 java.lang.Object[] addCells(java.lang.Object[] cells, java.lang.Object parent, java.lang.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 java.lang.Object[] addCells(java.lang.Object[] cells, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.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(java.lang.Object[] cells, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.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(java.lang.Object[] cells, java.lang.Object parent, java.lang.Integer index, java.lang.Object source, java.lang.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 java.lang.Object[] removeCells()
Removes the selection cells from the graph.- Returns:
- Returns the cells that have been removed.
-
removeCells
public java.lang.Object[] removeCells(java.lang.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 java.lang.Object[] removeCells(java.lang.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(java.lang.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 java.lang.Object splitEdge(java.lang.Object edge, java.lang.Object[] cells)
-
splitEdge
public java.lang.Object splitEdge(java.lang.Object edge, java.lang.Object[] cells, double dx, double dy)
-
splitEdge
public java.lang.Object splitEdge(java.lang.Object edge, java.lang.Object[] cells, java.lang.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 java.lang.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 java.lang.Object[] toggleCells(boolean show, java.lang.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 java.lang.Object[] toggleCells(boolean show, java.lang.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(java.lang.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 java.lang.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 java.lang.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 java.lang.Object[] foldCells(boolean collapse, boolean recurse, java.lang.Object[] cells)
Invokes foldCells with checkFoldable set to false.
-
foldCells
public java.lang.Object[] foldCells(boolean collapse, boolean recurse, java.lang.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(java.lang.Object[] cells, boolean collapse, boolean recurse)
Invokes cellsFoldable with checkFoldable set to false.
-
cellsFolded
public void cellsFolded(java.lang.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(java.lang.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(java.lang.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 java.lang.Object[] addAllEdges(java.lang.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 java.lang.Object[] getAllEdges(java.lang.Object[] cells)
Returns all edges connected to the given cells or their descendants.
-
updateCellSize
public java.lang.Object updateCellSize(java.lang.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 java.lang.Object updateCellSize(java.lang.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(java.lang.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(java.lang.Object cell)
Returns the preferred width and height of the givenas an . - Parameters:
cell
-for which the preferred size should be returned.
-
resizeCell
public java.lang.Object resizeCell(java.lang.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 java.lang.Object[] resizeCells(java.lang.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(java.lang.Object[] cells, mxRectangle[] bounds)
Sets the bounds of the given cells and fires aevent. 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 ofwhose bounds should be changed. bounds
- Array ofthat represents the new bounds.
-
extendParent
public void extendParent(java.lang.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 java.lang.Object[] moveCells(java.lang.Object[] cells, double dx, double dy)
Moves the cells by the given amount. This is a shortcut method.
-
moveCells
public java.lang.Object[] moveCells(java.lang.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 java.lang.Object[] moveCells(java.lang.Object[] cells, double dx, double dy, boolean clone, java.lang.Object target, java.awt.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.Object resetEdge(java.lang.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(java.lang.Object edge, java.lang.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 java.lang.Object connectCell(java.lang.Object edge, java.lang.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 java.lang.Object connectCell(java.lang.Object edge, java.lang.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(java.lang.Object edge, java.lang.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 fireswhile 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(java.lang.Object[] cells)
Disconnects the given edges from the terminals which are not in the given array.- Parameters:
cells
- Array ofto be disconnected.
-
getCurrentRoot
public java.lang.Object getCurrentRoot()
Returns the current root of the displayed cell hierarchy. This is a shortcut toin . - Returns:
- Returns the current root in the view.
-
getTranslateForRoot
public mxPoint getTranslateForRoot(java.lang.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(java.lang.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 java.lang.Object getTerminalForPort(java.lang.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(java.lang.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(java.lang.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 ifreturns 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(java.lang.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(java.lang.Object cell)
Returns the bounds of the given cell.
-
getCellBounds
public mxRectangle getCellBounds(java.lang.Object cell, boolean includeEdges)
Returns the bounds of the given cell including all connected edges if includeEdge is true.
-
getCellBounds
public mxRectangle getCellBounds(java.lang.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(java.lang.Object[] cells)
Returns the bounding box for the geometries of the vertices in the given array of cells.
-
getBoundingBox
public mxRectangle getBoundingBox(java.lang.Object cell)
Returns the bounds of the given cell.
-
getBoundingBox
public mxRectangle getBoundingBox(java.lang.Object cell, boolean includeEdges)
Returns the bounding box of the given cell including all connected edges if includeEdge is true.
-
getBoundingBox
public mxRectangle getBoundingBox(java.lang.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(java.lang.Object[] cells)
Returns the bounding box of the given cells and their descendants.
-
getBoundsForCells
public mxRectangle getBoundsForCells(java.lang.Object[] cells, boolean includeEdges, boolean includeDescendants, boolean boundingBox)
Returns the bounds for the given cells.
-
getCellBounds
public mxRectangle getCellBounds(java.lang.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 ifis true. - Parameters:
value
- Numeric value to be snapped to the grid.- Returns:
- Returns the value aligned to the grid.
-
getCellGeometry
public mxGeometry getCellGeometry(java.lang.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(java.lang.Object cell)
Returns true if the given cell is visible in this graph. This implementation uses. Subclassers can override this to implement specific visibility for cells in only one graph, that is, without affecting the visible state of the cell. When using dynamic filter expressions for cell visibility, then the graph should be revalidated after the filter expression has changed. - Parameters:
cell
- Cell whose visible state should be returned.- Returns:
- Returns the visible state of the cell.
-
isCellCollapsed
public boolean isCellCollapsed(java.lang.Object cell)
Returns true if the given cell is collapsed in this graph. This implementation uses. Subclassers can override this to implement specific collapsed states for cells in only one graph, that is, without affecting the collapsed state of the cell. When using dynamic filter expressions for the collapsed state, then the graph should be revalidated after the filter expression has changed. - Parameters:
cell
- Cell whose collapsed state should be returned.- Returns:
- Returns the collapsed state of the cell.
-
isCellConnectable
public boolean isCellConnectable(java.lang.Object cell)
Returns true if the given cell is connectable in this graph. This implementation uses. 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(java.lang.Object edge, java.lang.Object source, java.lang.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 java.lang.String getEdgeValidationError(java.lang.Object edge, java.lang.Object source, java.lang.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 java.lang.String validateEdge(java.lang.Object edge, java.lang.Object source, java.lang.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 java.lang.String getCellValidationError(java.lang.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 java.lang.String validateCell(java.lang.Object cell, java.util.Hashtable<java.lang.Object,java.lang.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 java.lang.String convertValueToString(java.lang.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 java.lang.String getLabel(java.lang.Object cell)
Returns a string or DOM node that represents the label for the given cell. This implementation usesif 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(java.lang.Object cell, java.lang.Object value, boolean autoSize)
Sets the new label for a cell. If autoSize is true thenwill 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(java.lang.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 java.lang.String getToolTipForCell(java.lang.Object cell)
Returns the tooltip to be used for the given cell.
-
getStartSize
public mxRectangle getStartSize(java.lang.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 anwith 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 java.lang.String getImage(mxCellState state)
Returns the image URL for the given cell state. This implementation returns the value stored underin 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(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.Object[] getMovableCells(java.lang.Object[] cells)
Returns the cells which are movable in the given array of cells.
-
isCellMovable
public boolean isCellMovable(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.lang.Object[] getDeletableCells(java.lang.Object[] cells)
Returns the cells which are movable in the given array of cells.
-
isCellDeletable
public boolean isCellDeletable(java.lang.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 java.lang.Object[] getCloneableCells(java.lang.Object[] cells)
Returns the cells which are movable in the given array of cells.
-
isCellCloneable
public boolean isCellCloneable(java.lang.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(java.lang.Object cell, java.lang.Object terminal, boolean source)
Returns true if the given cell is disconnectable from the source or target terminal. This returnsfor 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(java.lang.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 ifin 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(java.lang.Object cell)
Returns true if the given edges's label is moveable. This returnsfor 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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.Object source, java.lang.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(java.lang.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. Ifreturns 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(java.lang.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 java.lang.Object[] getFoldableCells(java.lang.Object[] cells, boolean collapse)
Returns the cells which are movable in the given array of cells.
-
isCellFoldable
public boolean isCellFoldable(java.lang.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 java.lang.String getAlternateEdgeStyle()
Returns alternateEdgeStyle.
-
setAlternateEdgeStyle
public void setAlternateEdgeStyle(java.lang.String value)
Sets alternateEdgeStyle.
-
isValidDropTarget
public boolean isValidDropTarget(java.lang.Object cell, java.lang.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(java.lang.Object target, java.lang.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 java.lang.Object getDropTarget(java.lang.Object[] cells, java.awt.Point pt, java.lang.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 java.lang.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(java.lang.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 java.lang.Object[] getChildVertices(java.lang.Object parent)
Returns the visible child vertices of the given parent.- Parameters:
parent
- Cell whose children should be returned.
-
getChildEdges
public java.lang.Object[] getChildEdges(java.lang.Object parent)
Returns the visible child edges of the given parent.- Parameters:
parent
- Cell whose children should be returned.
-
getChildCells
public java.lang.Object[] getChildCells(java.lang.Object parent)
Returns the visible children of the given parent.- Parameters:
parent
- Cell whose children should be returned.
-
getChildCells
public java.lang.Object[] getChildCells(java.lang.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 java.lang.Object[] getConnections(java.lang.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 java.lang.Object[] getConnections(java.lang.Object cell, java.lang.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 java.lang.Object[] getConnections(java.lang.Object cell, java.lang.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 java.lang.Object[] getIncomingEdges(java.lang.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 java.lang.Object[] getIncomingEdges(java.lang.Object cell, java.lang.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 java.lang.Object[] getOutgoingEdges(java.lang.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 java.lang.Object[] getOutgoingEdges(java.lang.Object cell, java.lang.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 java.lang.Object[] getEdges(java.lang.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 java.lang.Object[] getEdges(java.lang.Object cell, java.lang.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 java.lang.Object[] getEdges(java.lang.Object cell, java.lang.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 java.lang.Object[] getEdges(java.lang.Object cell, java.lang.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(java.lang.Object cell, java.lang.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 cellparent
- the possible parent cellrecurse
- 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 java.lang.Object[] getOpposites(java.lang.Object[] edges, java.lang.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 java.lang.Object[] getOpposites(java.lang.Object[] edges, java.lang.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 java.lang.Object[] getEdgesBetween(java.lang.Object source, java.lang.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 java.lang.Object[] getEdgesBetween(java.lang.Object source, java.lang.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 java.lang.Object[] getCellsBeyond(double x0, double y0, java.lang.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 java.util.List<java.lang.Object> findTreeRoots(java.lang.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 java.util.List<java.lang.Object> findTreeRoots(java.lang.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 java.util.List<java.lang.Object> findTreeRoots(java.lang.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(java.lang.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(java.lang.Object vertex, boolean directed, mxGraph.mxICellVisitor visitor, java.lang.Object edge, java.util.Set<java.lang.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
- Optionalthat 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(java.lang.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 java.lang.Object getSelectionCell()
- Returns:
- Returns the selection cell.
-
setSelectionCell
public void setSelectionCell(java.lang.Object cell)
- Parameters:
cell
-
-
getSelectionCells
public java.lang.Object[] getSelectionCells()
- Returns:
- Returns the selection cells.
-
setSelectionCells
public void setSelectionCells(java.lang.Object[] cells)
-
setSelectionCells
public void setSelectionCells(java.util.Collection<java.lang.Object> cells)
- Parameters:
cells
-
-
addSelectionCell
public void addSelectionCell(java.lang.Object cell)
-
addSelectionCells
public void addSelectionCells(java.lang.Object[] cells)
-
removeSelectionCell
public void removeSelectionCell(java.lang.Object cell)
-
removeSelectionCells
public void removeSelectionCells(java.lang.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(java.lang.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(java.lang.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. UseselectAll
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, java.lang.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. UseselectAll
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 isdefaultParent
.
-
selectAll
public void selectAll()
-
selectAll
public void selectAll(java.lang.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
- Optionalwhose 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, java.lang.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, java.lang.Object element, java.lang.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 java.lang.String getLinkForCell(java.lang.Object cell)
Returns the hyperlink to be used for the given cell.
-
getTargetForCell
protected java.lang.String getTargetForCell(java.lang.Object cell)
Returns the hyperlink to be used for the given cell.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
- Parameters:
listener
-- See Also:
PropertyChangeSupport.addPropertyChangeListener(java.beans.PropertyChangeListener)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
- Parameters:
propertyName
-listener
-- See Also:
PropertyChangeSupport.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
- Parameters:
listener
-- See Also:
PropertyChangeSupport.removePropertyChangeListener(java.beans.PropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
- Parameters:
propertyName
-listener
-- See Also:
PropertyChangeSupport.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
main
public static void main(java.lang.String[] args)
Logs the version number on the console.
-
-