Package com.mxgraph.view
Class mxGraph
java.lang.Object
com.mxgraph.util.mxEventSource
com.mxgraph.view.mxGraph
Implements a graph object that allows to create diagrams from a graph model
and stylesheet.
Images
To create an image from a graph, use the following code for a given XML document (doc) and File (file):
Image img = mxCellRenderer.createBufferedImage(
graph, null, 1, Color.WHITE, false, null);
ImageIO.write(img, "png", file);
If the XML is given as a string rather than a document, the document can
be obtained using mxUtils.parse.
This class fires the following events:
mxEvent.ROOT fires if the root in the model has changed. This event has no
properties.
mxEvent.ALIGN_CELLS fires between begin- and endUpdate in alignCells. The
cells
and align
properties contain the respective
arguments that were passed to alignCells.
mxEvent.FLIP_EDGE fires between begin- and endUpdate in flipEdge. The
edge
property contains the edge passed to flipEdge.
mxEvent.ORDER_CELLS fires between begin- and endUpdate in orderCells. The
cells
and back
properties contain the respective
arguments that were passed to orderCells.
mxEvent.CELLS_ORDERED fires between begin- and endUpdate in cellsOrdered.
The cells
and back
arguments contain the
respective arguments that were passed to cellsOrdered.
mxEvent.GROUP_CELLS fires between begin- and endUpdate in groupCells. The
group
, cells
and border
arguments
contain the respective arguments that were passed to groupCells.
mxEvent.UNGROUP_CELLS fires between begin- and endUpdate in ungroupCells.
The cells
property contains the array of cells that was passed
to ungroupCells.
mxEvent.REMOVE_CELLS_FROM_PARENT fires between begin- and endUpdate in
removeCellsFromParent. The cells
property contains the array of
cells that was passed to removeCellsFromParent.
mxEvent.ADD_CELLS fires between begin- and endUpdate in addCells. The
cells
, parent
, index
,
source
and target
properties contain the
respective arguments that were passed to addCells.
mxEvent.CELLS_ADDED fires between begin- and endUpdate in cellsAdded. The
cells
, parent
, index
,
source
, target
and absolute
properties contain the respective arguments that were passed to cellsAdded.
mxEvent.REMOVE_CELLS fires between begin- and endUpdate in removeCells. The
cells
and includeEdges
arguments contain the
respective arguments that were passed to removeCells.
mxEvent.CELLS_REMOVED fires between begin- and endUpdate in cellsRemoved.
The cells
argument contains the array of cells that was
removed.
mxEvent.SPLIT_EDGE fires between begin- and endUpdate in splitEdge. The
edge
property contains the edge to be splitted, the
cells
, newEdge
, dx
and
dy
properties contain the respective arguments that were passed
to splitEdge.
mxEvent.TOGGLE_CELLS fires between begin- and endUpdate in toggleCells. The
show
, cells
and includeEdges
properties contain the respective arguments that were passed to toggleCells.
mxEvent.FOLD_CELLS fires between begin- and endUpdate in foldCells. The
collapse
, cells
and recurse
properties contain the respective arguments that were passed to foldCells.
mxEvent.CELLS_FOLDED fires between begin- and endUpdate in cellsFolded. The
collapse
, cells
and recurse
properties contain the respective arguments that were passed to cellsFolded.
mxEvent.UPDATE_CELL_SIZE fires between begin- and endUpdate in
updateCellSize. The cell
and ignoreChildren
properties contain the respective arguments that were passed to
updateCellSize.
mxEvent.RESIZE_CELLS fires between begin- and endUpdate in resizeCells. The
cells
and bounds
properties contain the respective
arguments that were passed to resizeCells.
mxEvent.CELLS_RESIZED fires between begin- and endUpdate in cellsResized.
The cells
and bounds
properties contain the
respective arguments that were passed to cellsResized.
mxEvent.MOVE_CELLS fires between begin- and endUpdate in moveCells. The
cells
, dx
, dy
, clone
,
target
and location
properties contain the
respective arguments that were passed to moveCells.
mxEvent.CELLS_MOVED fires between begin- and endUpdate in cellsMoved. The
cells
, dx
, dy
and
disconnect
properties contain the respective arguments that
were passed to cellsMoved.
mxEvent.CONNECT_CELL fires between begin- and endUpdate in connectCell. The
edge
, terminal
and source
properties
contain the respective arguments that were passed to connectCell.
mxEvent.CELL_CONNECTED fires between begin- and endUpdate in cellConnected.
The edge
, terminal
and source
properties contain the respective arguments that were passed to
cellConnected.
mxEvent.REPAINT fires if a repaint was requested by calling repaint. The
region
property contains the optional mxRectangle that was
passed to repaint to define the dirty region.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.mxgraph.util.mxEventSource
mxEventSource.mxIEventListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Specifies if edges with disconnected terminals are allowed in the graph.protected boolean
Specifies if loops (aka self-references) are allowed.protected boolean
Specifies if negative coordinates for vertices are allowed.protected String
Specifies the alternate edge style to be used if the main control point on an edge is being doubleclicked.protected boolean
Specifies if the origin should be automatically updated.protected boolean
Specifies if the graph should automatically update the cell size after an edit.protected int
Border to be added to the bottom and right side when the container is being resized after the graph has been changed.protected boolean
Specifies the return value for isCell(s)Bendable.protected boolean
Specifies the return value for isCell(s)Cloneable.protected boolean
Specifies the return value for isCell(s)Deletable.protected boolean
Specifies the return value for isCellDisconntableFromTerminal.protected boolean
Specifies the return value for isCell(s)Editable.protected boolean
Specifies the return value for isCell(s)Locked.protected boolean
Specifies the return value for isCell(s)Movable.protected boolean
Specifies the return value for isCell(s)Sizable.protected boolean
Specifies the return value for isCell(s)Selectable.protected int
Specifies the maximum number of changes that should be processed to find the dirty region.protected PropertyChangeSupport
Property change event handling.protected boolean
Specifies if edges that are cloned should be validated and only inserted if they are valid.protected boolean
Specifies if the cell size should be changed to the preferred size when a cell is first collapsed.protected boolean
Specifies if edges are connectable.protected boolean
Specifies the return value for isConstrainChildren.protected mxEdgeStyle.mxEdgeStyleFunction
Specifies the default style for loops.protected double
Value returned by getOverlap if isAllowOverlapParent returns true for the given cell.protected Object
Specifies the default parent to be used to insert new cells.protected boolean
Specifies if edges should be disconnected from their terminals when they are moved.protected boolean
Specifies the return value for isDropEnabled.protected boolean
Specifies the return value for edges in isLabelMovable.protected boolean
Specifies the return value for isEnabled.protected boolean
Specifies if a parent should contain the child bounds after a resize of the child.protected boolean
Specifies if parents should be extended according to theswitch if cells are added. protected mxEventSource.mxIEventListener
Fires repaint events for full repaints.protected mxEventSource.mxIEventListener
Fires repaint events for model changes.protected boolean
Specifies if the grid is enabled.protected int
Specifies the grid size.protected boolean
Specifies the return value for isHtmlLabel.protected static List
<mxImageBundle> Holds the list of bundles.protected boolean
Specifies if edges should appear in the background regardless of their order in the model.protected boolean
Specifies if edges should appear in the foreground regardless of their order in the model.protected boolean
Specifies the return value for isLabel(s)Clipped.protected boolean
Specifies if labels should be visible.protected mxRectangle
that specifies the area in which all cells in the diagram should be placed. protected mxRectangle
mxRectangle that specifies the minimum size of the graph canvas inside the scrollpane.protected mxIGraphModel
Holds the model that contains the cells to be displayed.protected boolean
Specifies if multiple edges in the same direction between the same pair of vertices are allowed.protected mxMultiplicity[]
Specifies the multiplicities to be used for validation of the graph.protected mxPoint
Holds the current automatic origin.protected boolean
Specifies if ports are enabled.protected boolean
Specifies if edge control points should be reset after the the edge has been reconnected.protected boolean
Specifies if edge control points should be reset after the move of a connected cell.protected boolean
Specifies if loops (aka self-references) are allowed.protected boolean
Specifies if the scale and translate should be reset if the root changes in the model.protected mxGraphSelectionModel
Holds thethat models the current selection. protected boolean
Specifies if dropping onto edges should be enabled.protected mxStylesheet
Holds the stylesheet that defines the appearance of the cells.protected boolean
Specifies if nesting of swimlanes is allowed.protected mxEventSource.mxIEventListener
Fires repaint events for full repaints.static final String
Holds the version number of this release.protected boolean
Specifies the return value for vertices in isLabelMovable.protected mxGraphView
Holds the view that caches the cell states.Fields inherited from class com.mxgraph.util.mxEventSource
eventListeners, eventsEnabled, eventSource
-
Constructor Summary
ConstructorsConstructorDescriptionmxGraph()
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
Modifier and TypeMethodDescriptionObject[]
addAllEdges
(Object[] cells) Returns an array with the given cells and all edges that are connected to a cell or one of its descendants.Adds the cell to the default parent.Adds the cell to the parent.Adds the cell to the parent and connects it to the given source and target terminals.Object[]
Adds the cells to the default parent.Object[]
Adds the cells to the parent.Object[]
Adds the cells to the parent at the given index.Object[]
Adds the cells to the parent at the given index, connecting each cell to the optional source and target terminal.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
void
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) void
addSelectionCell
(Object cell) void
addSelectionCells
(Object[] cells) void
addTopmostVerticesAndEdges
(Object cell, List<Object> cells) Returns the cells to be selected for the given list of changes.Object[]
alignCells
(String align) Aligns the selection cells vertically or horizontally according to the given alignment.Object[]
alignCells
(String align, Object[] cells) Aligns the given cells vertically or horizontally according to the given alignment.Object[]
alignCells
(String align, Object[] cells, Object param) Aligns the given cells vertically or horizontally according to the given alignment using the optional parameter as the coordinate.void
cellConnected
(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint) Sets the new terminal for the given edge and resets the edge points if isResetEdgesOnConnect returns true.protected void
cellDrawn
(mxICanvas canvas, mxCellState state, Object element, Object labelElement) Called when a cell has been painted as the specified object, typically a DOM node that represents the given cell graphically in a document.void
cellLabelChanged
(Object cell, Object value, boolean autoSize) Sets the new label for a cell.void
cellsAdded
(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute) Adds the specified cells to the given parent.void
cellsAdded
(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute, boolean constrain) Adds the specified cells to the given parent.void
cellsFolded
(Object[] cells, boolean collapse, boolean recurse) Invokes cellsFoldable with checkFoldable set to false.void
cellsFolded
(Object[] cells, boolean collapse, boolean recurse, boolean checkFoldable) Sets the collapsed state of the specified cells.void
cellSizeUpdated
(Object cell, boolean ignoreChildren) Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.void
cellsMoved
(Object[] cells, double dx, double dy, boolean disconnect, boolean constrain) Moves the specified cells by the given vector, disconnecting the cells using disconnectGraph if disconnect is true.void
cellsOrdered
(Object[] cells, boolean back) Moves the given cells to the front or back.void
cellsRemoved
(Object[] cells) Removes the given cells from the model.void
cellsResized
(Object[] cells, mxRectangle[] bounds) Sets the bounds of the given cells and fires a invalid input: '<'mxEvent.CELLS_RESIZED> event.void
cellsToggled
(Object[] cells, boolean show) Sets the visible state of the specified cells.void
Object[]
cloneCells
(Object[] cells) Clones all cells in the given array.Object[]
cloneCells
(Object[] cells, boolean allowInvalidEdges) Returns the clones for the given cells.connectCell
(Object edge, Object terminal, boolean source) Connects the specified end of the given edge to the given terminal using cellConnected and fires mxEvent.CONNECT_CELL while the transaction is in progress.connectCell
(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint) Connects the specified end of the given edge to the given terminal using cellConnected and fires mxEvent.CONNECT_CELL while the transaction is in progress.void
constrainChild
(Object cell) Keeps the given cell inside the bounds returned by getCellContainmentArea for its parent, according to the rules defined by getOverlap and isConstrainChild.convertValueToString
(Object cell) Returns the textual representation for the given cell.Hook method that creates the new edge for insertEdge.protected mxGraphView
Constructs a new view to be used in this graph.createGroupCell
(Object[] cells) Hook for creating the group cell to hold the given array ofif no group cell was given to the function. protected mxGraphSelectionModel
Constructs a new selection model to be used in this graph.protected mxStylesheet
Constructs a new stylesheet to be used in this graph.createVertex
(Object parent, String id, Object value, double x, double y, double width, double height, String style) Hook method that creates the new vertex for insertVertex.createVertex
(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative) Hook method that creates the new vertex for insertVertex.void
disconnectGraph
(Object[] cells) Disconnects the given edges from the terminals which are not in the given array.void
Draws the given cell and its descendants onto the specified canvas.void
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
void
enterGroup
(Object cell) Uses the given cell as the root of the displayed cell hierarchy.void
Changes the current root to the next valid root in the displayed cell hierarchy.void
extendParent
(Object cell) Resizes the parents recursively so that they contain the complete area of the resized child cell.findTreeRoots
(Object parent) Returns all visible children in the given parent which do not have incoming edges.findTreeRoots
(Object parent, boolean isolate) Returns all visible children in the given parent which do not have incoming edges.findTreeRoots
(Object parent, boolean isolate, boolean invert) Returns all visible children in the given parent which do not have incoming edges.Called when the main control point of the edge is double-clicked.Object[]
foldCells
(boolean collapse) Sets the collapsed state of the selection cells without recursion.Object[]
foldCells
(boolean collapse, boolean recurse) Sets the collapsed state of the selection cells.Object[]
Invokes foldCells with checkFoldable set to false.Object[]
Sets the collapsed state of the specified cells and all descendants if recurse is true.getAllConnectionConstraints
(mxCellState terminal, boolean source) Returns an array of all constraints for the given terminal.Object[]
getAllEdges
(Object[] cells) Returns all edges connected to the given cells or their descendants.Returns alternateEdgeStyle.int
Returns the value of. getBoundingBox
(Object cell) Returns the bounds of the given cell.getBoundingBox
(Object cell, boolean includeEdges) Returns the bounding box of the given cell including all connected edges if includeEdge is true.getBoundingBox
(Object cell, boolean includeEdges, boolean includeDescendants) Returns the bounding box of the given cell including all connected edges if includeEdge is true.getBoundingBoxFromGeometry
(Object[] cells) Returns the bounding box for the geometries of the vertices in the given array of cells.getBoundsForCells
(Object[] cells, boolean includeEdges, boolean includeDescendants, boolean boundingBox) Returns the bounds for the given cells.getBoundsForGroup
(Object group, Object[] children, double border) Returns the bounds to be used for the given group and children.getCellBounds
(Object cell) Returns the bounds of the given cell.getCellBounds
(Object cell, boolean includeEdges) Returns the bounds of the given cell including all connected edges if includeEdge is true.getCellBounds
(Object cell, boolean includeEdges, boolean includeDescendants) Returns the bounds of the given cell including all connected edges if includeEdge is true.getCellBounds
(Object cell, boolean includeEdges, boolean includeDescendants, boolean boundingBox) Returns the bounds of the given cell including all connected edges if includeEdge is true.getCellContainmentArea
(Object cell) Returns the mxRectangle inside which a cell is to be kept.getCellGeometry
(Object cell) Returns the geometry for the given cell.Object[]
getCellsBeyond
(double x0, double y0, Object parent, boolean rightHalfpane, boolean bottomHalfpane) Returns the children of the given parent that are contained in the halfpane from the given point (x0, y0) rightwards and downwards depending on rightHalfpane and bottomHalfpane.Object[]
getCellsForGroup
(Object[] cells) Returns the cells with the same parent as the first cell in the given array.getCellStyle
(Object cell) Returns an array of key, value pairs representing the cell style for the given cell.getCellValidationError
(Object cell) Checks all multiplicities that cannot be enforced while the graph is being modified, namely, all multiplicities that require a minimum of 1 edge.int
Object[]
getChildCells
(Object parent) Returns the visible children of the given parent.Object[]
getChildCells
(Object parent, boolean vertices, boolean edges) Returns the visible child vertices or edges in the given parent.Object[]
getChildEdges
(Object parent) Returns the visible child edges of the given parent.getChildOffsetForCell
(Object cell) Returns the offset to be used for the cells inside the given cell.Object[]
getChildVertices
(Object parent) Returns the visible child vertices of the given parent.Object[]
getCloneableCells
(Object[] cells) Returns the cells which are movable in the given array of cells.getConnectionConstraint
(mxCellState edge, mxCellState terminal, boolean source) Returns an connection constraint that describes the given connection point.getConnectionPoint
(mxCellState vertex, mxConnectionConstraint constraint) Sets the connection constraint that describes the given connection point.Object[]
getConnections
(Object cell) Returns all visible edges connected to the given cell without loops.Object[]
getConnections
(Object cell, Object parent) Returns all visible edges connected to the given cell without loops.Object[]
getConnections
(Object cell, Object parent, boolean recurse) Returns all visible edges connected to the given cell without loops.Returns the current root of the displayed cell hierarchy.Returns the default edge style used for loops.double
Gets defaultOverlap.Returns the first child of the root in the model, that is, the first or default layer of the diagram.Object[]
getDeletableCells
(Object[] cells) Returns the cells which are movable in the given array of cells.getDropTarget
(Object[] cells, Point pt, Object cell) Returns the given cell if it is a drop target for the given cells or the nearest ancestor that may be used as a drop target for the given cells.Object[]
Returns all visible edges connected to the given cell including loops.Object[]
Returns all visible edges connected to the given cell including loops.Object[]
Returns the incoming and/or outgoing edges for the given cell.Object[]
getEdges
(Object cell, Object parent, boolean incoming, boolean outgoing, boolean includeLoops, boolean recurse) Returns the incoming and/or outgoing edges for the given cell.Object[]
getEdgesBetween
(Object source, Object target) Returns the edges between the given source and target.Object[]
getEdgesBetween
(Object source, Object target, boolean directed) Returns the edges between the given source and target.getEdgeValidationError
(Object edge, Object source, Object target) Returns the validation error message to be displayed when inserting or changing an edges' connectivity.Object[]
getFoldableCells
(Object[] cells, boolean collapse) Returns the cells which are movable in the given array of cells.Returns the bounds of the visible graph.int
Returns the grid size.getImage
(mxCellState state) Returns the image URL for the given cell state.Returns the image bundlesvoid
getImageBundles
(List<mxImageBundle> value) Returns the image bundlesSearches all bundles for the specified key and returns the value for the first match or null if the key is not found.Object[]
getIncomingEdges
(Object cell) Returns all incoming visible edges connected to the given cell without loops.Object[]
getIncomingEdges
(Object cell, Object parent) Returns the visible incoming edges for the given cell.Returns a string or DOM node that represents the label for the given cell.protected String
getLinkForCell
(Object cell) Returns the hyperlink to be used for the given cell.Returns the minimum size of the diagram.getModel()
Returns the graph model that contains the graph data.Object[]
getMovableCells
(Object[] cells) Returns the cells which are movable in the given array of cells.Object[]
getOpposites
(Object[] edges, Object terminal) Returns all distinct visible opposite cells of the terminal on the given edges.Object[]
getOpposites
(Object[] edges, Object terminal, boolean sources, boolean targets) Returns all distincts visible opposite cells for the specified terminal on the given edges.Returns origin.Object[]
getOutgoingEdges
(Object cell) Returns all outgoing visible edges connected to the given cell without loops.Object[]
getOutgoingEdges
(Object cell, Object parent) Returns the visible outgoing edges for the given cell.double
getOverlap
(Object cell) Returns a decimal number representing the amount of the width and height of the given cell that is allowed to overlap its parent.getPaintBounds
(Object[] cells) Returns the bounding box of the given cells and their descendants.Returns the preferred width and height of the givenas an . Object[]
Object[]
Returns the cells to be selected for the given list of changes.int
getStartSize
(Object swimlane) Returns the start size of the given swimlane, that is, the width or height of the part that contains the title, depending on the horizontal style.Returns the stylesheet that provides the style.protected String
getTargetForCell
(Object cell) Returns the hyperlink to be used for the given cell.getTerminalForPort
(Object cell, boolean source) Returns the terminal to be used for a given port.getToolTipForCell
(Object cell) Returns the tooltip to be used for the given cell.getTranslateForRoot
(Object cell) Returns the translation to be used if the given cell is the root cell as an. getView()
Returns the view that contains the cell states.graphModelChanged
(mxIGraphModel sender, List<mxUndoableEdit.mxUndoableChange> changes) Called when the graph model changes.Groups the selection cells.groupCells
(Object group) Groups the selection cells and adds them to the given group.groupCells
(Object group, double border) Groups the selection cells and adds them to the given group.groupCells
(Object group, double border, 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.Creates and adds a new edge with an empty 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.insertVertex
(Object parent, String id, Object value, double x, double y, double width, double height) Creates and adds a new vertex with an empty style.insertVertex
(Object parent, String id, Object value, double x, double y, double width, double height, String style) Adds a new vertex into the given parent using value as the user object and the given coordinates as the geometry of the new vertex.insertVertex
(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative) Adds a new vertex into the given parent using value as the user object and the given coordinates as the geometry of the new vertex.boolean
Returns allowDanglingEdgesboolean
Returns allowLoops.boolean
Returns isAllowNegativeCoordinates.boolean
isAllowOverlapParent
(Object cell) Returns true if the given cell is allowed to be placed outside of the parents area.boolean
Returns autoOrigin.boolean
isAutoSizeCell
(Object cell) Returns true if the size of the given cell should automatically be updated after a change of the label.boolean
Returns true if the size of the given cell should automatically be updated after a change of the label.boolean
isCellBendable
(Object cell) Returns true if the given cell is bendable.boolean
isCellCloneable
(Object cell) Returns the constant true.boolean
isCellCollapsed
(Object cell) Returns true if the given cell is collapsed in this graph.boolean
isCellConnectable
(Object cell) Returns true if the given cell is connectable in this graph.boolean
isCellDeletable
(Object cell) Returns true if the given cell is movable.boolean
isCellDisconnectable
(Object cell, Object terminal, boolean source) Returns true if the given cell is disconnectable from the source or target terminal.boolean
isCellEditable
(Object cell) Returns true if the given cell is movable.boolean
isCellFoldable
(Object cell, boolean collapse) Returns true if the given cell is expandable.boolean
isCellLocked
(Object cell) Returns true if the given cell may not be moved, sized, bended, disconnected, edited or selected.boolean
isCellMovable
(Object cell) Returns true if the given cell is movable.boolean
isCellResizable
(Object cell) Returns true if the given cell is resizable.boolean
Returns cellsBendable.boolean
Returns cellsCloneable.boolean
Returns cellsDeletable.boolean
Returns cellsDisconnectable.boolean
Returns true if editing is allowed in this graph.boolean
isCellSelectable
(Object cell) Returns true if the given cell is selectable.boolean
isCellSelected
(Object cell) boolean
Returns cellsLocked, the default return value for isCellLocked.boolean
Returns cellsMovable.boolean
Returns true if the given cell is resizable.boolean
Returns cellsSelectable.boolean
isCellVisible
(Object cell) Returns true if the given cell is visible in this graph.boolean
Returns cloneInvalidEdges.boolean
Returns collapseToPreferredSize.boolean
Returns connectableEdges.boolean
isConstrainChild
(Object cell) Returns true if the given cell should be kept inside the bounds of its parent according to the rules defined by getOverlap and isAllowOverlapParent.boolean
Returns constrainChildren.boolean
Returns disconnectOnMoveboolean
Returns true if the graph allows drop into other cells.boolean
Returns edgeLabelsMovable.boolean
isEdgeValid
(Object edge, Object source, Object target) Checks if the return value of getEdgeValidationError for the given arguments is null.boolean
Returns true if the graph is. boolean
isExtendParent
(Object cell) Returns true if the parent of the given cell should be extended if the child has been resized so that it overlaps the parent.boolean
Returns extendParents.boolean
Returns extendParentsOnAdd.boolean
Returns true if the grid is enabled.boolean
isHtmlLabel
(Object cell) Returns true if the label must be rendered as HTML markup.boolean
boolean
boolean
boolean
isLabelClipped
(Object cell) Returns true if the overflow portion of labels should be hidden.boolean
isLabelMovable
(Object cell) Returns true if the given edges's label is moveable.boolean
Returns labelsClipped.boolean
boolean
isLoop
(mxCellState state) Returns true if the given cell state is a loop.boolean
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
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
Returns true if ports are enabled.boolean
Returns resetEdgesOnConnect.boolean
Returns resetEdgesOnMove.boolean
Returns resetEdgesOnResize.boolean
Returns resetViewOnRootChange.boolean
boolean
Affects the return values of isValidDropTarget to allow for edges as drop targets.boolean
isSplitTarget
(Object target, Object[] cells) Returns true if split is enabled and the given edge may be splitted into two edges with the given cell as a new terminal between the two.boolean
isSwimlane
(Object cell) Returns true if the given cell is a swimlane.boolean
Returns swimlaneNesting.boolean
isTerminalPointMovable
(Object cell, boolean source) Function: isTerminalPointMovable Returns true if the given terminal point is movable.boolean
isValidAncestor
(Object cell, Object parent, boolean recurse) Returns whether or not the specified parent is a valid ancestor of the specified cell, either direct or indirectly based on whether ancestor recursion is enabled.boolean
isValidConnection
(Object source, Object target) Returns true if the given target cell is a valid target for source.boolean
isValidDropTarget
(Object cell, Object[] cells) Returns true if the given cell is a valid drop target for the specified cells.boolean
isValidRoot
(Object cell) Returns true if the given cell is a valid root for the cell display hierarchy.boolean
isValidSource
(Object cell) Returns true if the given cell is a valid source for new connections.boolean
isValidTarget
(Object cell) Returns isValidSource for the given cell.boolean
Returns vertexLabelsMovable.static void
Logs the version number on the console.Object[]
Moves the cells by the given amount.Object[]
Moves or clones the cells and moves the cells or clones by the given amount.Object[]
Moves or clones the specified cells and moves the cells or clones by the given amount, adding them to the optional target cell.Object[]
orderCells
(boolean back) Moves the selection cells to the front or back.Object[]
orderCells
(boolean back, Object[] cells) Moves the given cells to the front or back.postProcessCellStyle
(Map<String, Object> style) Tries to resolve the value for the image style in the image bundles and turns short data URIs as defined in mxImageBundle to data URIs as defined in RFC 2397 of the IETF.processChange
(mxUndoableEdit.mxUndoableChange change, boolean invalidate, boolean ignoreDirty) Processes the given change and invalidates the respective cached data in. processChanges
(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.Object[]
Removes the selection cells from the graph.Object[]
removeCells
(Object[] cells) Removes the given cells from the graph.Object[]
removeCells
(Object[] cells, boolean includeEdges) Removes the given cells from the graph including all connected edges if includeEdges is true.Object[]
Removes the selection cells from their parents and adds them to the default parent returned by getDefaultParent.Object[]
removeCellsFromParent
(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
void
removePropertyChangeListener
(String propertyName, PropertyChangeListener listener) void
removeSelectionCell
(Object cell) void
removeSelectionCells
(Object[] cells) protected void
removeStateForCell
(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.Resets the control points of the given edge.void
resetEdges
(Object[] cells) Resets the control points of the edges that are connected to the given cells if not both ends of the edge are in the given cells array.resizeCell
(Object cell, mxRectangle bounds) Sets the bounds of the given cell using resizeCells.Object[]
resizeCells
(Object[] cells, mxRectangle[] bounds) Sets the bounds of the given cells and fires a mxEvent.RESIZE_CELLS event.void
void
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, 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
Selects the first child cell.void
Selects all vertices inside the default parent.void
selectEdges
(Object parent) Selects all vertices inside the given parent or the default parent if no parent is given.void
Selects the next cell.void
Selects the parent cell.void
Selects the previous cell.void
Selects all vertices inside the default parent.void
selectVertices
(Object parent) Selects all vertices inside the given parent or the default parent if no parent is given.void
setAllowDanglingEdges
(boolean value) Sets allowDanglingEdges.void
setAllowLoops
(boolean value) Sets allowLoops.void
setAllowNegativeCoordinates
(boolean value) void
setAlternateEdgeStyle
(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.Object[]
setCellStyle
(String style) Sets the style of the selection cells to the given value.Object[]
setCellStyle
(String style, Object[] cells) Sets the style of the specified cells.Object[]
setCellStyleFlags
(String key, int flag, boolean value) Sets or toggles the given bit for the given key in the styles of the selection cells.Object[]
setCellStyleFlags
(String key, int flag, Boolean value, Object[] cells) Sets or toggles the given bit for the given key in the styles of the specified cells.Object[]
setCellStyles
(String key, String value) Sets the key to value in the styles of the selection cells.Object[]
setCellStyles
(String key, String value, 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
(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint) Sets the connection constraint that describes the given connection point.void
setConstrainChildren
(boolean value) void
Sets the default style used for loops.void
setDefaultOverlap
(double value) Sets defaultOverlap.void
setDefaultParent
(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
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
(Object cell) void
setSelectionCells
(Object[] cells) void
setSelectionCells
(Collection<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. Splits the given edge by adding a newEdge between the previous source and the given cell and reconnecting the source of the given edge to the given cell.void
swapBounds
(Object cell, boolean willCollapse) Swaps the alternate and the actual bounds in the geometry of the given cell invoking updateAlternateBounds before carrying out the swap.Object[]
toggleCells
(boolean show) Sets the visible state of the selection cells.Object[]
toggleCells
(boolean show, Object[] cells) Sets the visible state of the specified cells.Object[]
toggleCells
(boolean show, Object[] cells, boolean includeEdges) Sets the visible state of the specified cells and all connected edges if includeEdges is true.toggleCellStyle
(String key, boolean defaultValue, Object cell) Toggles the boolean value for the given key in the style of the given cell.Object[]
toggleCellStyleFlags
(String key, int flag) Toggles the given bit for the given key in the styles of the selection cells.Object[]
toggleCellStyleFlags
(String key, int flag, Object[] cells) Toggles the given bit for the given key in the styles of the specified cells.Object[]
toggleCellStyles
(String key, boolean defaultValue) Toggles the boolean value for the given key in the style of the selection cells.Object[]
toggleCellStyles
(String key, boolean defaultValue, Object[] cells) Toggles the boolean value for the given key in the style of the given cells.toString()
void
translateCell
(Object cell, double dx, double dy) Translates the geometry of the given cell and stores the new, translated geometry in the model as an atomic change.void
traverse
(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor) Traverses the tree starting at the given vertex.void
traverse
(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor, Object edge, Set<Object> visited) Traverses the (directed) graph invoking the given function for each visited vertex and edge.Object[]
Ungroups the selection cells.Object[]
ungroupCells
(Object[] cells) Ungroups the given cells by moving the children the children to their parents parent and removing the empty groups.void
updateAlternateBounds
(Object cell, mxGeometry geo, boolean willCollapse) Updates or sets the alternate bounds in the given geometry for the given cell depending on whether the cell is going to be collapsed.updateCellSize
(Object cell) Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.updateCellSize
(Object cell, boolean ignoreChildren) Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size.Object[]
Updates the bounds of the given array of groups so that it includes all child vertices.Object[]
updateGroupBounds
(Object[] cells) Updates the bounds of the given array of groups so that it includes all child vertices.Object[]
updateGroupBounds
(Object[] cells, int border) Updates the bounds of the given array of groups so that it includes all child vertices.Object[]
updateGroupBounds
(Object[] cells, int border, boolean moveParent) Updates the bounds of the given array of groups so that it includes all child vertices.protected void
Extends the canvas by doing another validation with a shifted global translation if the bounds of the graph are below (0,0).protected void
Function: updateSelection Removes selection cells that are not in the model from the selection.validateCell
(Object cell, Hashtable<Object, Object> context) Hook method for subclassers to return an error message for the given cell and validation context.validateEdge
(Object edge, Object source, Object target) Hook method for subclassers to return an error message for the given edge and terminals.Methods inherited from class com.mxgraph.util.mxEventSource
addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource
-
Field Details
-
VERSION
Holds the version number of this release. Current version is 4.2.2.- See Also:
-
changeSupport
Property change event handling. -
model
Holds the model that contains the cells to be displayed. -
view
Holds the view that caches the cell states. -
stylesheet
Holds the stylesheet that defines the appearance of the cells. -
selectionModel
Holds thethat models the current selection. -
gridSize
protected int gridSizeSpecifies the grid size. Default is 10. -
gridEnabled
protected boolean gridEnabledSpecifies if the grid is enabled. Default is true. -
portsEnabled
protected boolean portsEnabledSpecifies if ports are enabled. This is used into update the respective style. Default is true. -
defaultOverlap
protected double defaultOverlapValue 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
Specifies the default parent to be used to insert new cells. This is used in getDefaultParent. Default is null. -
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 enabledSpecifies the return value for isEnabled. Default is true. -
cellsLocked
protected boolean cellsLockedSpecifies the return value for isCell(s)Locked. Default is false. -
cellsEditable
protected boolean cellsEditableSpecifies the return value for isCell(s)Editable. Default is true. -
cellsResizable
protected boolean cellsResizableSpecifies the return value for isCell(s)Sizable. Default is true. -
cellsMovable
protected boolean cellsMovableSpecifies the return value for isCell(s)Movable. Default is true. -
cellsBendable
protected boolean cellsBendableSpecifies the return value for isCell(s)Bendable. Default is true. -
cellsSelectable
protected boolean cellsSelectableSpecifies the return value for isCell(s)Selectable. Default is true. -
cellsDeletable
protected boolean cellsDeletableSpecifies the return value for isCell(s)Deletable. Default is true. -
cellsCloneable
protected boolean cellsCloneableSpecifies the return value for isCell(s)Cloneable. Default is true. -
cellsDisconnectable
protected boolean cellsDisconnectableSpecifies the return value for isCellDisconntableFromTerminal. Default is true. -
labelsClipped
protected boolean labelsClippedSpecifies the return value for isLabel(s)Clipped. Default is false. -
edgeLabelsMovable
protected boolean edgeLabelsMovableSpecifies the return value for edges in isLabelMovable. Default is true. -
vertexLabelsMovable
protected boolean vertexLabelsMovableSpecifies the return value for vertices in isLabelMovable. Default is false. -
dropEnabled
protected boolean dropEnabledSpecifies the return value for isDropEnabled. Default is true. -
splitEnabled
protected boolean splitEnabledSpecifies if dropping onto edges should be enabled. Default is true. -
autoSizeCells
protected boolean autoSizeCellsSpecifies if the graph should automatically update the cell size after an edit. This is used in isAutoSizeCell. Default is false. -
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
mxRectangle that specifies the minimum size of the graph canvas inside the scrollpane. -
border
protected int borderBorder 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 keepEdgesInForegroundSpecifies 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 keepEdgesInBackgroundSpecifies if edges should appear in the background regardless of their order in the model. Default is false. -
collapseToPreferredSize
protected boolean collapseToPreferredSizeSpecifies if the cell size should be changed to the preferred size when a cell is first collapsed. Default is true. -
allowNegativeCoordinates
protected boolean allowNegativeCoordinatesSpecifies if negative coordinates for vertices are allowed. Default is true. -
constrainChildren
protected boolean constrainChildrenSpecifies the return value for isConstrainChildren. Default is true. -
extendParents
protected boolean extendParentsSpecifies if a parent should contain the child bounds after a resize of the child. Default is true. -
extendParentsOnAdd
protected boolean extendParentsOnAddSpecifies if parents should be extended according to theswitch if cells are added. Default is true. -
resetViewOnRootChange
protected boolean resetViewOnRootChangeSpecifies if the scale and translate should be reset if the root changes in the model. Default is true. -
resetEdgesOnResize
protected boolean resetEdgesOnResizeSpecifies if loops (aka self-references) are allowed. Default is false. -
resetEdgesOnMove
protected boolean resetEdgesOnMoveSpecifies if edge control points should be reset after the move of a connected cell. Default is false. -
resetEdgesOnConnect
protected boolean resetEdgesOnConnectSpecifies if edge control points should be reset after the the edge has been reconnected. Default is true. -
allowLoops
protected boolean allowLoopsSpecifies if loops (aka self-references) are allowed. Default is false. -
multiplicities
Specifies the multiplicities to be used for validation of the graph. -
defaultLoopStyle
Specifies the default style for loops. -
multigraph
protected boolean multigraphSpecifies if multiple edges in the same direction between the same pair of vertices are allowed. Default is true. -
connectableEdges
protected boolean connectableEdgesSpecifies if edges are connectable. Default is false. This overrides the connectable field in edges. -
allowDanglingEdges
protected boolean allowDanglingEdgesSpecifies if edges with disconnected terminals are allowed in the graph. Default is false. -
cloneInvalidEdges
protected boolean cloneInvalidEdgesSpecifies if edges that are cloned should be validated and only inserted if they are valid. Default is true. -
disconnectOnMove
protected boolean disconnectOnMoveSpecifies if edges should be disconnected from their terminals when they are moved. Default is true. -
labelsVisible
protected boolean labelsVisibleSpecifies if labels should be visible. This is used in getLabel. Default is true. -
htmlLabels
protected boolean htmlLabelsSpecifies the return value for isHtmlLabel. Default is false. -
swimlaneNesting
protected boolean swimlaneNestingSpecifies if nesting of swimlanes is allowed. Default is true. -
changesRepaintThreshold
protected int changesRepaintThresholdSpecifies 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 autoOriginSpecifies if the origin should be automatically updated. -
origin
Holds the current automatic origin. -
imageBundles
Holds the list of bundles. -
fullRepaintHandler
Fires repaint events for full repaints. -
updateOriginHandler
Fires repaint events for full repaints. -
graphModelChangeHandler
Fires repaint events for model changes.
-
-
Constructor Details
-
mxGraph
public mxGraph()Constructs a new graph with an emptymxGraphModel
. -
mxGraph
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
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
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 Details
-
createSelectionModel
Constructs a new selection model to be used in this graph. -
createStylesheet
Constructs a new stylesheet to be used in this graph. -
createGraphView
Constructs a new view to be used in this graph. -
getModel
Returns the graph model that contains the graph data.- Returns:
- Returns the model that contains the graph data
-
setModel
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
Returns the view that contains the cell states.- Returns:
- Returns the view that contains the cell states
-
setView
Sets the view that contains the cell states.- Parameters:
value
- View that contains the cell states
-
getStylesheet
Returns the stylesheet that provides the style.- Returns:
- Returns the stylesheet that provides the style.
-
setStylesheet
Sets the stylesheet that provides the style.- Parameters:
value
- Stylesheet that provides the style.
-
addTopmostVerticesAndEdges
Returns the cells to be selected for the given list of changes. -
getSelectionCellsForChanges
Returns the cells to be selected for the given list of changes. -
graphModelChanged
public mxRectangle graphModelChanged(mxIGraphModel sender, List<mxUndoableEdit.mxUndoableChange> changes) Called when the graph model changes. Invokes processChange on each item of the given array to update the view accordingly. -
updateSelection
protected void updateSelection()Function: updateSelection Removes selection cells that are not in the model from the selection. -
updateOrigin
protected void updateOrigin()Extends the canvas by doing another validation with a shifted global translation if the bounds of the graph are below (0,0). The first validation is required to compute the bounds of the graph while the second validation is required to apply the new translate. -
processChanges
public mxRectangle processChanges(List<mxUndoableEdit.mxUndoableChange> changes, boolean invalidate, boolean ignoreDirty) Processes the changes and returns the minimal rectangle to be repainted in the buffer. A return value of null means no repaint is required. -
processChange
public mxRectangle processChange(mxUndoableEdit.mxUndoableChange change, boolean invalidate, boolean ignoreDirty) Processes the given change and invalidates the respective cached data in. This fires a event if the root has changed in the model. -
removeStateForCell
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
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
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
Sets the style of the selection cells to the given value.- Parameters:
style
- String representing the new style of the cells.
-
setCellStyle
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
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
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
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
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
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
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
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
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
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
Adds the specified bundle. -
removeImageBundle
Removes the specified bundle. -
getImageFromBundles
Searches all bundles for the specified key and returns the value for the first match or null if the key is not found. -
getImageBundles
Returns the image bundles -
getImageBundles
Returns the image bundles -
alignCells
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
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
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
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
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
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
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
Groups the selection cells. This is a shortcut method.- Returns:
- Returns the new group.
-
groupCells
Groups the selection cells and adds them to the given group. This is a shortcut method.- Returns:
- Returns the new group.
-
groupCells
Groups the selection cells and adds them to the given group. This is a shortcut method.- Returns:
- Returns the new group.
-
groupCells
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
Returns the cells with the same parent as the first cell in the given array. -
getBoundsForGroup
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
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
Ungroups the selection cells. This is a shortcut method. -
ungroupCells
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
Removes the selection cells from their parents and adds them to the default parent returned by getDefaultParent. -
removeCellsFromParent
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
Updates the bounds of the given array of groups so that it includes all child vertices. -
updateGroupBounds
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
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
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
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
Returns the clones for the given cells. The clones are created recursively using invalid input: '<'mxGraphModel.cloneCells>. If the terminal of an edge is not in the given array, then the respective end is assigned a terminal point and the terminal is removed. If a cloned edge is invalid and allowInvalidEdges is false, then a null pointer will be at this position in the returned array. Use getCloneableCells on the input array to only clone the cells where isCellCloneable returns true.- Parameters:
cells
- Array of mxCells to be cloned.- Returns:
- Returns the clones of the given cells.
-
insertVertex
public Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height) Creates and adds a new vertex with an empty style. -
insertVertex
public Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style) Adds a new vertex into the given parent using value as the user object and the given coordinates as the geometry of the new vertex. The id and style are used for the respective properties of the new cell, which is returned.- Parameters:
parent
- Cell that specifies the parent of the new vertex.id
- Optional string that defines the Id of the new vertex.value
- Object to be used as the user object.x
- Integer that defines the x coordinate of the vertex.y
- Integer that defines the y coordinate of the vertex.width
- Integer that defines the width of the vertex.height
- Integer that defines the height of the vertex.style
- Optional string that defines the cell style.- Returns:
- Returns the new vertex that has been inserted.
-
insertVertex
public Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative) Adds a new vertex into the given parent using value as the user object and the given coordinates as the geometry of the new vertex. The id and style are used for the respective properties of the new cell, which is returned.- Parameters:
parent
- Cell that specifies the parent of the new vertex.id
- Optional string that defines the Id of the new vertex.value
- Object to be used as the user object.x
- Integer that defines the x coordinate of the vertex.y
- Integer that defines the y coordinate of the vertex.width
- Integer that defines the width of the vertex.height
- Integer that defines the height of the vertex.style
- Optional string that defines the cell style.relative
- Specifies if the geometry should be relative.- Returns:
- Returns the new vertex that has been inserted.
-
createVertex
public Object createVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style) Hook method that creates the new vertex for insertVertex.- Parameters:
parent
- Cell that specifies the parent of the new vertex.id
- Optional string that defines the Id of the new vertex.value
- Object to be used as the user object.x
- Integer that defines the x coordinate of the vertex.y
- Integer that defines the y coordinate of the vertex.width
- Integer that defines the width of the vertex.height
- Integer that defines the height of the vertex.style
- Optional string that defines the cell style.- Returns:
- Returns the new vertex to be inserted.
-
createVertex
public Object createVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative) Hook method that creates the new vertex for insertVertex.- Parameters:
parent
- Cell that specifies the parent of the new vertex.id
- Optional string that defines the Id of the new vertex.value
- Object to be used as the user object.x
- Integer that defines the x coordinate of the vertex.y
- Integer that defines the y coordinate of the vertex.width
- Integer that defines the width of the vertex.height
- Integer that defines the height of the vertex.style
- Optional string that defines the cell style.relative
- Specifies if the geometry should be relative.- Returns:
- Returns the new vertex to be inserted.
-
insertEdge
Creates and adds a new edge with an empty style. -
insertEdge
public Object insertEdge(Object parent, String id, Object value, Object source, Object target, String style) Adds a new edge into the given parent using value as the user object and the given source and target as the terminals of the new edge. The Id and style are used for the respective properties of the new cell, which is returned.- Parameters:
parent
- Cell that specifies the parent of the new edge.id
- Optional string that defines the Id of the new edge.value
- Object to be used as the user object.source
- Cell that defines the source of the edge.target
- Cell that defines the target of the edge.style
- Optional string that defines the cell style.- Returns:
- Returns the new edge that has been inserted.
-
createEdge
public Object createEdge(Object parent, String id, Object value, Object source, Object target, String style) Hook method that creates the new edge for insertEdge. This implementation does not set the source and target of the edge, these are set when the edge is added to the model.- Parameters:
parent
- Cell that specifies the parent of the new edge.id
- Optional string that defines the Id of the new edge.value
- Object to be used as the user object.source
- Cell that defines the source of the edge.target
- Cell that defines the target of the edge.style
- Optional string that defines the cell style.- Returns:
- Returns the new edge to be inserted.
-
addEdge
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
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
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
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
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
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
Adds the cells to the parent at the given index. This is a shortcut method.- Parameters:
cells
- Array of cells to be inserted.parent
- Optional cell that represents the new parent. If no parent is specified then the default parent is used.index
- Optional index to insert the cells at. Default is to append.- Returns:
- Returns the cells that were added.
-
addCells
public Object[] addCells(Object[] cells, Object parent, Integer index, Object source, Object target) Adds the cells to the parent at the given index, connecting each cell to the optional source and target terminal. The change is carried out using cellsAdded. This method fires mxEvent.ADD_CELLS while the transaction is in progress.- Parameters:
cells
- Array of cells to be added.parent
- Optional cell that represents the new parent. If no parent is specified then the default parent is used.index
- Optional index to insert the cells at. Default is to append.source
- Optional source terminal for all inserted cells.target
- Optional target terminal for all inserted cells.- Returns:
- Returns the cells that were added.
-
cellsAdded
public void cellsAdded(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute) Adds the specified cells to the given parent. This method fires mxEvent.CELLS_ADDED while the transaction is in progress. -
cellsAdded
public void cellsAdded(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute, boolean constrain) Adds the specified cells to the given parent. This method fires mxEvent.CELLS_ADDED while the transaction is in progress. -
removeCells
Removes the selection cells from the graph.- Returns:
- Returns the cells that have been removed.
-
removeCells
Removes the given cells from the graph.- Parameters:
cells
- Array of cells to remove.- Returns:
- Returns the cells that have been removed.
-
removeCells
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
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
-
splitEdge
-
splitEdge
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
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
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
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
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
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
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
Invokes foldCells with checkFoldable set to false. -
foldCells
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
Invokes cellsFoldable with checkFoldable set to false. -
cellsFolded
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
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
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
Returns an array with the given cells and all edges that are connected to a cell or one of its descendants. -
getAllEdges
Returns all edges connected to the given cells or their descendants. -
updateCellSize
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
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
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
Returns the preferred width and height of the givenas an . - Parameters:
cell
-for which the preferred size should be returned.
-
resizeCell
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
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
Sets the bounds of the given cells and fires a invalid input: '<'mxEvent.CELLS_RESIZED> event. If extendParents is true, then the parent is extended if a child size is changed so that it overlaps with the parent.- Parameters:
cells
- Array ofwhose bounds should be changed. bounds
- Array ofthat represents the new bounds.
-
extendParent
Resizes the parents recursively so that they contain the complete area of the resized child cell.- Parameters:
cell
-that has been resized.
-
moveCells
Moves the cells by the given amount. This is a shortcut method. -
moveCells
Moves or clones the cells and moves the cells or clones by the given amount. This is a shortcut method. -
moveCells
public Object[] moveCells(Object[] cells, double dx, double dy, boolean clone, Object target, Point location) Moves or clones the specified cells and moves the cells or clones by the given amount, adding them to the optional target cell. The location is the position of the mouse pointer as the mouse was released. The change is carried out using cellsMoved. This method fires mxEvent.MOVE_CELLS while the transaction is in progress.- Parameters:
cells
- Array of cells to be moved, cloned or added to the target.dx
- Integer that specifies the x-coordinate of the vector.dy
- Integer that specifies the y-coordinate of the vector.clone
- Boolean indicating if the cells should be cloned.target
- Cell that represents the new parent of the cells.location
- Location where the mouse was released.- Returns:
- Returns the cells that were moved.
-
cellsMoved
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
Translates the geometry of the given cell and stores the new, translated geometry in the model as an atomic change. -
getCellContainmentArea
Returns the mxRectangle inside which a cell is to be kept. -
getMaximumGraphBounds
- Returns:
- the maximumGraphBounds
-
setMaximumGraphBounds
- Parameters:
value
- the maximumGraphBounds to set
-
constrainChild
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
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
Resets the control points of the given edge. -
getAllConnectionConstraints
Returns an array of all constraints for the given terminal.- Parameters:
terminal
- Cell state that represents the terminal.source
- Specifies if the terminal is the source or target.
-
getConnectionConstraint
public mxConnectionConstraint getConnectionConstraint(mxCellState edge, mxCellState terminal, boolean source) Returns an connection constraint that describes the given connection point. This result can then be passed to getConnectionPoint.- Parameters:
edge
- Cell state that represents the edge.terminal
- Cell state that represents the terminal.source
- Boolean indicating if the terminal is the source or target.
-
setConnectionConstraint
public void setConnectionConstraint(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint) Sets the connection constraint that describes the given connection point. If no constraint is given then nothing is changed. To remove an existing constraint from the given edge, use an empty constraint instead.- Parameters:
edge
- Cell that represents the edge.terminal
- Cell that represents the terminal.source
- Boolean indicating if the terminal is the source or target.constraint
- Optional connection constraint to be used for this connection.
-
getConnectionPoint
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
Connects the specified end of the given edge to the given terminal using cellConnected and fires mxEvent.CONNECT_CELL while the transaction is in progress. -
connectCell
public Object connectCell(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint) Connects the specified end of the given edge to the given terminal using cellConnected and fires mxEvent.CONNECT_CELL while the transaction is in progress.- Parameters:
edge
- Edge whose terminal should be updated.terminal
- New terminal to be used.source
- Specifies if the new terminal is the source or target.constraint
- Optional constraint to be used for this connection.- Returns:
- Returns the update edge.
-
cellConnected
public void cellConnected(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint) Sets the new terminal for the given edge and resets the edge points if isResetEdgesOnConnect returns true. This method fires invalid input: '<'mxEvent.CELL_CONNECTED> while the transaction is in progress.- Parameters:
edge
- Edge whose terminal should be updated.terminal
- New terminal to be used.source
- Specifies if the new terminal is the source or target.constraint
- Constraint to be used for this connection.
-
disconnectGraph
Disconnects the given edges from the terminals which are not in the given array.- Parameters:
cells
- Array ofto be disconnected.
-
getCurrentRoot
Returns the current root of the displayed cell hierarchy. This is a shortcut to invalid input: '<'mxGraphView.currentRoot> in. - Returns:
- Returns the current root in the view.
-
getTranslateForRoot
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
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
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
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
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
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
Returns the bounds of the visible graph. -
getCellBounds
Returns the bounds of the given cell. -
getCellBounds
Returns the bounds of the given cell including all connected edges if includeEdge is true. -
getCellBounds
Returns the bounds of the given cell including all connected edges if includeEdge is true. -
getBoundingBoxFromGeometry
Returns the bounding box for the geometries of the vertices in the given array of cells. -
getBoundingBox
Returns the bounds of the given cell. -
getBoundingBox
Returns the bounding box of the given cell including all connected edges if includeEdge is true. -
getBoundingBox
Returns the bounding box of the given cell including all connected edges if includeEdge is true. -
getPaintBounds
Returns the bounding box of the given cells and their descendants. -
getBoundsForCells
public mxRectangle getBoundsForCells(Object[] cells, boolean includeEdges, boolean includeDescendants, boolean boundingBox) Returns the bounds for the given cells. -
getCellBounds
public mxRectangle getCellBounds(Object cell, boolean includeEdges, boolean includeDescendants, boolean boundingBox) Returns the bounds of the given cell including all connected edges if includeEdge is true. -
refresh
public void refresh()Clears all cell states or the states for the hierarchy starting at the given cell and validates the graph. -
repaint
public void repaint()Fires a repaint event. -
repaint
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
Returns the geometry for the given cell.- Parameters:
cell
- Cell whose geometry should be returned.- Returns:
- Returns the geometry of the cell.
-
isCellVisible
Returns true if the given cell is visible in this graph. This implementation uses invalid input: '<'mxGraphModel.isVisible>. Subclassers can override this to implement specific visibility for cells in only one graph, that is, without affecting the visible state of the cell. When using dynamic filter expressions for cell visibility, then the graph should be revalidated after the filter expression has changed.- Parameters:
cell
- Cell whose visible state should be returned.- Returns:
- Returns the visible state of the cell.
-
isCellCollapsed
Returns true if the given cell is collapsed in this graph. This implementation uses invalid input: '<'mxGraphModel.isCollapsed>. Subclassers can override this to implement specific collapsed states for cells in only one graph, that is, without affecting the collapsed state of the cell. When using dynamic filter expressions for the collapsed state, then the graph should be revalidated after the filter expression has changed.- Parameters:
cell
- Cell whose collapsed state should be returned.- Returns:
- Returns the collapsed state of the cell.
-
isCellConnectable
Returns true if the given cell is connectable in this graph. This implementation uses invalid input: '<'mxGraphModel.isConnectable>. Subclassers can override this to implement specific connectable states for cells in only one graph, that is, without affecting the connectable state of the cell in the model.- Parameters:
cell
- Cell whose connectable state should be returned.- Returns:
- Returns the connectable state of the cell.
-
isOrthogonal
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
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
-
getMultiplicities
-
isEdgeValid
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
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
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
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
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
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
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
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
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
Returns the tooltip to be used for the given cell. -
getStartSize
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
Returns the image URL for the given cell state. This implementation returns the value stored under invalid input: '<'mxConstants.STYLE_IMAGE> in the cell style.- Parameters:
state
-- Returns:
- Returns the image associated with the given cell state.
-
getBorder
public int getBorder()Returns the value of. - Returns:
- Returns the border.
-
setBorder
public void setBorder(int value) Sets the value of. - Parameters:
value
- Positive integer that represents the border to be used.
-
getDefaultLoopStyle
Returns the default edge style used for loops.- Returns:
- Returns the default loop style.
-
setDefaultLoopStyle
Sets the default style used for loops.- Parameters:
value
- Default style to be used for loops.
-
isSwimlane
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
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
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
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
Returns the cells which are movable in the given array of cells. -
isCellMovable
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
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
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
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
Returns the cells which are movable in the given array of cells. -
isCellDeletable
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
Returns the cells which are movable in the given array of cells. -
isCellCloneable
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
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
Returns true if the overflow portion of labels should be hidden. If this returns true then vertex labels will be clipped to the size of the vertices. This implementation returns true if invalid input: '<'mxConstants.STYLE_OVERFLOW> in the style of the given cell is "hidden".- Parameters:
cell
- Cell whose label should be clipped.- Returns:
- Returns true if the cell label should be clipped.
-
isLabelsClipped
public boolean isLabelsClipped()Returns labelsClipped. -
setLabelsClipped
public void setLabelsClipped(boolean value) Sets labelsClipped. -
isLabelMovable
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
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
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
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
Returns origin. -
setOrigin
- 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
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
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
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
Returns the minimum size of the diagram.- Returns:
- Returns the minimum container size.
-
setMinimumGraphSize
- Parameters:
value
- the minimumGraphSize to set
-
getOverlap
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
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
Returns the cells which are movable in the given array of cells. -
isCellFoldable
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
Returns alternateEdgeStyle. -
setAlternateEdgeStyle
Sets alternateEdgeStyle. -
isValidDropTarget
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
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
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
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
Sets the default parent to be returned by getDefaultParent. Set this to null to return the first child of the root in getDefaultParent. -
getChildVertices
Returns the visible child vertices of the given parent.- Parameters:
parent
- Cell whose children should be returned.
-
getChildEdges
Returns the visible child edges of the given parent.- Parameters:
parent
- Cell whose children should be returned.
-
getChildCells
Returns the visible children of the given parent.- Parameters:
parent
- Cell whose children should be returned.
-
getChildCells
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
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
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
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
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
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
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
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
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
Returns all visible edges connected to the given cell including loops.- Parameters:
cell
- Cell whose edges should be returned.parent
- Optional parent of the opposite end for an edge to be returned.- Returns:
- Returns the edges of the given cell.
-
getEdges
public Object[] getEdges(Object cell, Object parent, boolean incoming, boolean outgoing, boolean includeLoops) Returns the incoming and/or outgoing edges for the given cell. If the optional parent argument is specified, then only edges are returned where the opposite is in the given parent cell.- Parameters:
cell
- Cell whose edges should be returned.parent
- Optional parent. If specified the opposite end of any edge must be a direct child of that parent in order for the edge to be returned.incoming
- Specifies if incoming edges should be included in the result.outgoing
- Specifies if outgoing edges should be included in the result.includeLoops
- Specifies if loops should be included in the result.- Returns:
- Returns the edges connected to the given cell.
-
getEdges
public Object[] getEdges(Object cell, Object parent, boolean incoming, boolean outgoing, boolean includeLoops, boolean recurse) Returns the incoming and/or outgoing edges for the given cell. If the optional parent argument is specified, then only edges are returned where the opposite is in the given parent cell.- Parameters:
cell
- Cell whose edges should be returned.parent
- Optional parent. If specified the opposite end of any edge must be a child of that parent in order for the edge to be returned. The recurse parameter specifies whether or not it must be the direct child or the parent just be an ancestral parent.incoming
- Specifies if incoming edges should be included in the result.outgoing
- Specifies if outgoing edges should be included in the result.includeLoops
- Specifies if loops should be included in the result.recurse
- Specifies if the parent specified only need be an ancestral parent,true
, or the direct parent,false
- Returns:
- Returns the edges connected to the given cell.
-
isValidAncestor
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
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
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
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
Returns the edges between the given source and target. This takes into account collapsed and invisible cells and returns the connected edges as displayed on the screen.- Parameters:
source
-target
-directed
-- Returns:
- Returns all edges between the given terminals.
-
getCellsBeyond
public Object[] getCellsBeyond(double x0, double y0, Object parent, boolean rightHalfpane, boolean bottomHalfpane) Returns the children of the given parent that are contained in the halfpane from the given point (x0, y0) rightwards and downwards depending on rightHalfpane and bottomHalfpane.- Parameters:
x0
- X-coordinate of the origin.y0
- Y-coordinate of the origin.parent
-whose children should be checked. rightHalfpane
- Boolean indicating if the cells in the right halfpane from the origin should be returned.bottomHalfpane
- Boolean indicating if the cells in the bottom halfpane from the origin should be returned.- Returns:
- Returns the cells beyond the given halfpane.
-
findTreeRoots
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
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
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
Traverses the tree starting at the given vertex. Here is how to use this method for a given vertex (root) which is typically the root of a tree:graph.traverse(root, true, new mxICellVisitor() { public boolean visit(Object vertex, Object edge) { System.out.println("edge="+graph.convertValueToString(edge)+ " vertex="+graph.convertValueToString(vertex)); return true; } });
- Parameters:
vertex
-directed
-visitor
-
-
traverse
public void traverse(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor, Object edge, Set<Object> visited) Traverses the (directed) graph invoking the given function for each visited vertex and edge. The function is invoked with the current vertex and the incoming edge as a parameter. This implementation makes sure each vertex is only visited once. The function may return false if the traversal should stop at the given vertex.- Parameters:
vertex
-that represents the vertex where the traversal starts. directed
- Optional boolean indicating if edges should only be traversed from source to target. Default is true.visitor
- Visitor that takes the current vertex and the incoming edge. The traversal stops if the function returns false.edge
- 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
-
getSelectionCount
public int getSelectionCount() -
isCellSelected
- 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
- Returns:
- Returns the selection cell.
-
setSelectionCell
- Parameters:
cell
-
-
getSelectionCells
- Returns:
- Returns the selection cells.
-
setSelectionCells
-
setSelectionCells
- Parameters:
cells
-
-
addSelectionCell
-
addSelectionCells
-
removeSelectionCell
-
removeSelectionCells
-
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
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
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
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
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
Draws the graph onto the given canvas.- Parameters:
canvas
- Canvas onto which the graph should be drawn.
-
drawCell
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
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
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
Returns the hyperlink to be used for the given cell. -
getTargetForCell
Returns the hyperlink to be used for the given cell. -
addPropertyChangeListener
- Parameters:
listener
-- See Also:
-
addPropertyChangeListener
- Parameters:
propertyName
-listener
-- See Also:
-
removePropertyChangeListener
- Parameters:
listener
-- See Also:
-
removePropertyChangeListener
- Parameters:
propertyName
-listener
-- See Also:
-
toString
-
main
Logs the version number on the console.
-