|
mxGraph 2.3.0.5 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mxgraph.util.mxEventSource com.mxgraph.view.mxGraph
public class mxGraph
Implements a graph object that allows to create diagrams from a graph model and stylesheet.
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 | |
---|---|
static interface |
mxGraph.mxICellVisitor
|
Nested classes/interfaces inherited from class com.mxgraph.util.mxEventSource |
---|
mxEventSource.mxIEventListener |
Field Summary | |
---|---|
protected boolean |
allowDanglingEdges
Specifies if edges with disconnected terminals are allowed in the graph. |
protected boolean |
allowLoops
Specifies if loops (aka self-references) are allowed. |
protected boolean |
allowNegativeCoordinates
Specifies if negative coordinates for vertices are allowed. |
protected String |
alternateEdgeStyle
Specifies the alternate edge style to be used if the main control point on an edge is being doubleclicked. |
protected boolean |
autoOrigin
Specifies if the origin should be automatically updated. |
protected boolean |
autoSizeCells
Specifies if the graph should automatically update the cell size after an edit. |
protected int |
border
Border to be added to the bottom and right side when the container is being resized after the graph has been changed. |
protected boolean |
cellsBendable
Specifies the return value for isCell(s)Bendable. |
protected boolean |
cellsCloneable
Specifies the return value for isCell(s)Cloneable. |
protected boolean |
cellsDeletable
Specifies the return value for isCell(s)Deletable. |
protected boolean |
cellsDisconnectable
Specifies the return value for isCellDisconntableFromTerminal. |
protected boolean |
cellsEditable
Specifies the return value for isCell(s)Editable. |
protected boolean |
cellsLocked
Specifies the return value for isCell(s)Locked. |
protected boolean |
cellsMovable
Specifies the return value for isCell(s)Movable. |
protected boolean |
cellsResizable
Specifies the return value for isCell(s)Sizable. |
protected boolean |
cellsSelectable
Specifies the return value for isCell(s)Selectable. |
protected int |
changesRepaintThreshold
Specifies the maximum number of changes that should be processed to find the dirty region. |
protected PropertyChangeSupport |
changeSupport
Property change event handling. |
protected boolean |
cloneInvalidEdges
Specifies if edges that are cloned should be validated and only inserted if they are valid. |
protected boolean |
collapseToPreferredSize
Specifies if the cell size should be changed to the preferred size when a cell is first collapsed. |
protected boolean |
connectableEdges
Specifies if edges are connectable. |
protected boolean |
constrainChildren
Specifies the return value for isConstrainChildren. |
protected mxEdgeStyle.mxEdgeStyleFunction |
defaultLoopStyle
Specifies the default style for loops. |
protected double |
defaultOverlap
Value returned by getOverlap if isAllowOverlapParent returns true for the given cell. |
protected Object |
defaultParent
Specifies the default parent to be used to insert new cells. |
protected boolean |
disconnectOnMove
Specifies if edges should be disconnected from their terminals when they are moved. |
protected boolean |
dropEnabled
Specifies the return value for isDropEnabled. |
protected boolean |
edgeLabelsMovable
Specifies the return value for edges in isLabelMovable. |
protected boolean |
enabled
Specifies the return value for isEnabled. |
protected boolean |
extendParents
Specifies if a parent should contain the child bounds after a resize of the child. |
protected boolean |
extendParentsOnAdd
Specifies if parents should be extended according to the |
protected mxEventSource.mxIEventListener |
fullRepaintHandler
Fires repaint events for full repaints. |
protected mxEventSource.mxIEventListener |
graphModelChangeHandler
Fires repaint events for model changes. |
protected boolean |
gridEnabled
Specifies if the grid is enabled. |
protected int |
gridSize
Specifies the grid size. |
protected boolean |
htmlLabels
Specifies the return value for isHtmlLabel. |
protected static List<mxImageBundle> |
imageBundles
Holds the list of bundles. |
protected boolean |
keepEdgesInBackground
Specifies if edges should appear in the background regardless of their order in the model. |
protected boolean |
keepEdgesInForeground
Specifies if edges should appear in the foreground regardless of their order in the model. |
protected boolean |
labelsClipped
Specifies the return value for isLabel(s)Clipped. |
protected boolean |
labelsVisible
Specifies if labels should be visible. |
protected mxRectangle |
maximumGraphBounds
|
protected mxRectangle |
minimumGraphSize
mxRectangle that specifies the minimum size of the graph canvas inside the scrollpane. |
protected mxIGraphModel |
model
Holds the model that contains the cells to be displayed. |
protected boolean |
multigraph
Specifies if multiple edges in the same direction between the same pair of vertices are allowed. |
protected mxMultiplicity[] |
multiplicities
Specifies the multiplicities to be used for validation of the graph. |
protected mxPoint |
origin
Holds the current automatic origin. |
protected boolean |
portsEnabled
Specifies if ports are enabled. |
protected boolean |
resetEdgesOnConnect
Specifies if edge control points should be reset after the the edge has been reconnected. |
protected boolean |
resetEdgesOnMove
Specifies if edge control points should be reset after the move of a connected cell. |
protected boolean |
resetEdgesOnResize
Specifies if loops (aka self-references) are allowed. |
protected boolean |
resetViewOnRootChange
Specifies if the scale and translate should be reset if the root changes in the model. |
protected mxGraphSelectionModel |
selectionModel
Holds the |
protected boolean |
splitEnabled
Specifies if dropping onto edges should be enabled. |
protected mxStylesheet |
stylesheet
Holds the stylesheet that defines the appearance of the cells. |
protected boolean |
swimlaneNesting
Specifies if nesting of swimlanes is allowed. |
protected mxEventSource.mxIEventListener |
updateOriginHandler
Fires repaint events for full repaints. |
static String |
VERSION
Holds the version number of this release. |
protected boolean |
vertexLabelsMovable
Specifies the return value for vertices in isLabelMovable. |
protected mxGraphView |
view
Holds the view that caches the cell states. |
Fields inherited from class com.mxgraph.util.mxEventSource |
---|
eventListeners, eventsEnabled, eventSource |
Constructor Summary | |
---|---|
mxGraph()
Constructs a new graph with an empty mxGraphModel . |
|
mxGraph(mxIGraphModel model)
Constructs a new graph for the specified model. |
|
mxGraph(mxIGraphModel model,
mxStylesheet stylesheet)
Constructs a new graph for the specified model. |
|
mxGraph(mxStylesheet stylesheet)
Constructs a new graph for the specified model. |
Method Summary | |
---|---|
Object[] |
addAllEdges(Object[] cells)
Returns an array with the given cells and all edges that are connected to a cell or one of its descendants. |
Object |
addCell(Object cell)
Adds the cell to the default parent. |
Object |
addCell(Object cell,
Object parent)
Adds the cell to the parent. |
Object |
addCell(Object cell,
Object parent,
Integer index,
Object source,
Object target)
Adds the cell to the parent and connects it to the given source and target terminals. |
Object[] |
addCells(Object[] cells)
Adds the cells to the default parent. |
Object[] |
addCells(Object[] cells,
Object parent)
Adds the cells to the parent. |
Object[] |
addCells(Object[] cells,
Object parent,
Integer index)
Adds the cells to the parent at the given index. |
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. |
Object |
addEdge(Object edge,
Object parent,
Object source,
Object target,
Integer index)
Adds the edge to the parent and connects it to the given source and target terminals. |
void |
addImageBundle(mxImageBundle bundle)
Adds the specified bundle. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
|
void |
addSelectionCell(Object cell)
|
void |
addSelectionCells(Object[] cells)
|
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 |
void |
cellsToggled(Object[] cells,
boolean show)
Sets the visible state of the specified cells. |
void |
clearSelection()
|
Object[] |
cloneCells(Object[] cells)
Clones all cells in the given array. |
Object[] |
cloneCells(Object[] cells,
boolean allowInvalidEdges)
Returns the clones for the given cells. |
Object |
connectCell(Object edge,
Object terminal,
boolean source)
Connects the specified end of the given edge to the given terminal using cellConnected and fires mxEvent.CONNECT_CELL while the transaction is in progress. |
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. |
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. |
String |
convertValueToString(Object cell)
Returns the textual representation for the given cell. |
Object |
createEdge(Object parent,
String id,
Object value,
Object source,
Object target,
String style)
Hook method that creates the new edge for insertEdge. |
protected mxGraphView |
createGraphView()
Constructs a new view to be used in this graph. |
Object |
createGroupCell(Object[] cells)
Hook for creating the group cell to hold the given array of |
protected mxGraphSelectionModel |
createSelectionModel()
Constructs a new selection model to be used in this graph. |
protected mxStylesheet |
createStylesheet()
Constructs a new stylesheet to be used in this graph. |
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. |
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. |
void |
disconnectGraph(Object[] cells)
Disconnects the given edges from the terminals which are not in the given array. |
void |
drawCell(mxICanvas canvas,
Object cell)
Draws the given cell and its descendants onto the specified canvas. |
void |
drawGraph(mxICanvas canvas)
Draws the graph onto the given canvas. |
void |
drawState(mxICanvas canvas,
mxCellState state,
boolean drawLabel)
Draws the cell state with the given label onto the canvas. |
void |
enterGroup()
|
void |
enterGroup(Object cell)
Uses the given cell as the root of the displayed cell hierarchy. |
void |
exitGroup()
Changes the current root to the next valid root in the displayed cell hierarchy. |
void |
extendParent(Object cell)
Resizes the parents recursively so that they contain the complete area of the resized child cell. |
List<Object> |
findTreeRoots(Object parent)
Returns all visible children in the given parent which do not have incoming edges. |
List<Object> |
findTreeRoots(Object parent,
boolean isolate)
Returns all visible children in the given parent which do not have incoming edges. |
List<Object> |
findTreeRoots(Object parent,
boolean isolate,
boolean invert)
Returns all visible children in the given parent which do not have incoming edges. |
Object |
flipEdge(Object edge)
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[] |
foldCells(boolean collapse,
boolean recurse,
Object[] cells)
Invokes foldCells with checkFoldable set to false. |
Object[] |
foldCells(boolean collapse,
boolean recurse,
Object[] cells,
boolean checkFoldable)
Sets the collapsed state of the specified cells and all descendants if recurse is true. |
mxConnectionConstraint[] |
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. |
String |
getAlternateEdgeStyle()
Returns alternateEdgeStyle. |
int |
getBorder()
Returns the value of |
mxRectangle |
getBoundingBox(Object cell)
Returns the bounds of the given cell. |
mxRectangle |
getBoundingBox(Object cell,
boolean includeEdges)
Returns the bounding box of the given cell including all connected edges if includeEdge is true. |
mxRectangle |
getBoundingBox(Object cell,
boolean includeEdges,
boolean includeDescendants)
Returns the bounding box of the given cell including all connected edges if includeEdge is true. |
mxRectangle |
getBoundingBoxFromGeometry(Object[] cells)
Returns the bounding box for the geometries of the vertices in the given array of cells. |
mxRectangle |
getBoundsForCells(Object[] cells,
boolean includeEdges,
boolean includeDescendants,
boolean boundingBox)
Returns the bounds for the given cells. |
mxRectangle |
getBoundsForGroup(Object group,
Object[] children,
double border)
Returns the bounds to be used for the given group and children. |
mxRectangle |
getCellBounds(Object cell)
Returns the bounds of the given cell. |
mxRectangle |
getCellBounds(Object cell,
boolean includeEdges)
Returns the bounds of the given cell including all connected edges if includeEdge is true. |
mxRectangle |
getCellBounds(Object cell,
boolean includeEdges,
boolean includeDescendants)
Returns the bounds of the given cell including all connected edges if includeEdge is true. |
mxRectangle |
getCellBounds(Object cell,
boolean includeEdges,
boolean includeDescendants,
boolean boundingBox)
Returns the bounds of the given cell including all connected edges if includeEdge is true. |
mxRectangle |
getCellContainmentArea(Object cell)
Returns the mxRectangle inside which a cell is to be kept. |
mxGeometry |
getCellGeometry(Object cell)
Returns the geometry for the given cell. |
Object[] |
getCellsBeyond(double x0,
double y0,
Object parent,
boolean rightHalfpane,
boolean bottomHalfpane)
Returns the children of the given parent that are contained in the halfpane from the given point (x0, y0) rightwards and downwards depending on rightHalfpane and bottomHalfpane. |
Object[] |
getCellsForGroup(Object[] cells)
Returns the cells with the same parent as the first cell in the given array. |
Map<String,Object> |
getCellStyle(Object cell)
Returns an array of key, value pairs representing the cell style for the given cell. |
String |
getCellValidationError(Object cell)
Checks all multiplicities that cannot be enforced while the graph is being modified, namely, all multiplicities that require a minimum of 1 edge. |
int |
getChangesRepaintThreshold()
|
Object[] |
getChildCells(Object parent)
Returns the visible children of the given parent. |
Object[] |
getChildCells(Object parent,
boolean vertices,
boolean edges)
Returns the visible child vertices or edges in the given parent. |
Object[] |
getChildEdges(Object parent)
Returns the visible child edges of the given parent. |
mxPoint |
getChildOffsetForCell(Object cell)
Returns the offset to be used for the cells inside the given cell. |
Object[] |
getChildVertices(Object parent)
Returns the visible child vertices of the given parent. |
Object[] |
getCloneableCells(Object[] cells)
Returns the cells which are movable in the given array of cells. |
mxConnectionConstraint |
getConnectionConstraint(mxCellState edge,
mxCellState terminal,
boolean source)
Returns an connection constraint that describes the given connection point. |
mxPoint |
getConnectionPoint(mxCellState vertex,
mxConnectionConstraint constraint)
Sets the connection constraint that describes the given connection point. |
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. |
Object |
getCurrentRoot()
Returns the current root of the displayed cell hierarchy. |
mxEdgeStyle.mxEdgeStyleFunction |
getDefaultLoopStyle()
Returns the default edge style used for loops. |
double |
getDefaultOverlap()
Gets defaultOverlap. |
Object |
getDefaultParent()
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. |
Object |
getDropTarget(Object[] cells,
Point pt,
Object cell)
Returns the given cell if it is a drop target for the given cells or the nearest ancestor that may be used as a drop target for the given cells. |
Object[] |
getEdges(Object cell)
Returns all visible edges connected to the given cell including loops. |
Object[] |
getEdges(Object cell,
Object parent)
Returns all visible edges connected to the given cell including loops. |
Object[] |
getEdges(Object cell,
Object parent,
boolean incoming,
boolean outgoing,
boolean includeLoops)
Returns the incoming and/or outgoing edges for the given cell. |
Object[] |
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. |
String |
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. |
mxRectangle |
getGraphBounds()
Returns the bounds of the visible graph. |
int |
getGridSize()
Returns the grid size. |
String |
getImage(mxCellState state)
Returns the image URL for the given cell state. |
List<mxImageBundle> |
getImageBundles()
Returns the image bundles |
void |
getImageBundles(List<mxImageBundle> value)
Returns the image bundles |
String |
getImageFromBundles(String key)
Searches all bundles for the specified key and returns the value for the first match or null if the key is not found. |
Object[] |
getIncomingEdges(Object cell)
Returns all incoming visible edges connected to the given cell without loops. |
Object[] |
getIncomingEdges(Object cell,
Object parent)
Returns the visible incoming edges for the given cell. |
String |
getLabel(Object cell)
Returns a string or DOM node that represents the label for the given cell. |
protected String |
getLinkForCell(Object cell)
Returns the hyperlink to be used for the given cell. |
mxRectangle |
getMaximumGraphBounds()
|
mxRectangle |
getMinimumGraphSize()
Returns the minimum size of the diagram. |
mxIGraphModel |
getModel()
Returns the graph model that contains the graph data. |
Object[] |
getMovableCells(Object[] cells)
Returns the cells which are movable in the given array of cells. |
mxMultiplicity[] |
getMultiplicities()
|
Object[] |
getOpposites(Object[] edges,
Object terminal)
Returns all distinct visible opposite cells of the terminal on the given edges. |
Object[] |
getOpposites(Object[] edges,
Object terminal,
boolean sources,
boolean targets)
Returns all distincts visible opposite cells for the specified terminal on the given edges. |
mxPoint |
getOrigin()
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. |
mxRectangle |
getPaintBounds(Object[] cells)
Returns the bounding box of the given cells and their descendants. |
mxRectangle |
getPreferredSizeForCell(Object cell)
Returns the preferred width and height of the given |
Object[] |
getRemovedCellsForChanges(List<mxUndoableEdit.mxUndoableChange> changes)
Returns the cells that have been removed from the model. |
Object |
getSelectionCell()
|
Object[] |
getSelectionCells()
|
Object[] |
getSelectionCellsForChanges(List<mxUndoableEdit.mxUndoableChange> changes)
Returns the cells to be selected for the given list of changes. |
int |
getSelectionCount()
|
mxGraphSelectionModel |
getSelectionModel()
|
mxRectangle |
getStartSize(Object swimlane)
Returns the start size of the given swimlane, that is, the width or height of the part that contains the title, depending on the horizontal style. |
mxStylesheet |
getStylesheet()
Returns the stylesheet that provides the style. |
protected String |
getTargetForCell(Object cell)
Returns the hyperlink to be used for the given cell. |
Object |
getTerminalForPort(Object cell,
boolean source)
Returns the terminal to be used for a given port. |
String |
getToolTipForCell(Object cell)
Returns the tooltip to be used for the given cell. |
mxPoint |
getTranslateForRoot(Object cell)
Returns the translation to be used if the given cell is the root cell as an |
mxGraphView |
getView()
Returns the view that contains the cell states. |
mxRectangle |
graphModelChanged(mxIGraphModel sender,
List<mxUndoableEdit.mxUndoableChange> changes)
Called when the graph model changes. |
Object |
groupCells()
Groups the selection cells. |
Object |
groupCells(Object group)
Groups the selection cells and adds them to the given group. |
Object |
groupCells(Object group,
double border)
Groups the selection cells and adds them to the given group. |
Object |
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. |
Object |
insertEdge(Object parent,
String id,
Object value,
Object source,
Object target)
Creates and adds a new edge with an empty style. |
Object |
insertEdge(Object parent,
String id,
Object value,
Object source,
Object target,
String style)
Adds a new edge into the given parent using value as the user object and the given source and target as the terminals of the new edge. |
Object |
insertVertex(Object parent,
String id,
Object value,
double x,
double y,
double width,
double height)
Creates and adds a new vertex with an empty style. |
Object |
insertVertex(Object parent,
String id,
Object value,
double x,
double y,
double width,
double height,
String style)
Adds a new vertex into the given parent using value as the user object and the given coordinates as the geometry of the new vertex. |
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. |
boolean |
isAllowDanglingEdges()
Returns allowDanglingEdges |
boolean |
isAllowLoops()
Returns allowLoops. |
boolean |
isAllowNegativeCoordinates()
Returns isAllowNegativeCoordinates. |
boolean |
isAllowOverlapParent(Object cell)
Returns true if the given cell is allowed to be placed outside of the parents area. |
boolean |
isAutoOrigin()
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 |
isAutoSizeCells()
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 |
isCellsBendable()
Returns cellsBendable. |
boolean |
isCellsCloneable()
Returns cellsCloneable. |
boolean |
isCellsDeletable()
Returns cellsDeletable. |
boolean |
isCellsDisconnectable()
Returns cellsDisconnectable. |
boolean |
isCellsEditable()
Returns true if editing is allowed in this graph. |
boolean |
isCellSelectable(Object cell)
Returns true if the given cell is selectable. |
boolean |
isCellSelected(Object cell)
|
boolean |
isCellsLocked()
Returns cellsLocked, the default return value for isCellLocked. |
boolean |
isCellsMovable()
Returns cellsMovable. |
boolean |
isCellsResizable()
Returns true if the given cell is resizable. |
boolean |
isCellsSelectable()
Returns cellsSelectable. |
boolean |
isCellVisible(Object cell)
Returns true if the given cell is visible in this graph. |
boolean |
isCloneInvalidEdges()
Returns cloneInvalidEdges. |
boolean |
isCollapseToPreferredSize()
Returns collapseToPreferredSize. |
boolean |
isConnectableEdges()
Returns connectableEdges. |
boolean |
isConstrainChild(Object cell)
Returns true if the given cell should be kept inside the bounds of its parent according to the rules defined by getOverlap and isAllowOverlapParent. |
boolean |
isConstrainChildren()
Returns constrainChildren. |
boolean |
isDisconnectOnMove()
Returns disconnectOnMove |
boolean |
isDropEnabled()
Returns true if the graph allows drop into other cells. |
boolean |
isEdgeLabelsMovable()
Returns edgeLabelsMovable. |
boolean |
isEdgeValid(Object edge,
Object source,
Object target)
Checks if the return value of getEdgeValidationError for the given arguments is null. |
boolean |
isEnabled()
Returns true if the graph is |
boolean |
isExtendParent(Object cell)
Returns true if the parent of the given cell should be extended if the child has been resized so that it overlaps the parent. |
boolean |
isExtendParents()
Returns extendParents. |
boolean |
isExtendParentsOnAdd()
Returns extendParentsOnAdd. |
boolean |
isGridEnabled()
Returns true if the grid is enabled. |
boolean |
isHtmlLabel(Object cell)
Returns true if the label must be rendered as HTML markup. |
boolean |
isHtmlLabels()
|
boolean |
isKeepEdgesInBackground()
|
boolean |
isKeepEdgesInForeground()
|
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 |
isLabelsClipped()
Returns labelsClipped. |
boolean |
isLabelsVisible()
|
boolean |
isLoop(mxCellState state)
Returns true if the given cell state is a loop. |
boolean |
isMultigraph()
Returns multigraph. |
boolean |
isOrthogonal(mxCellState edge)
Returns true if perimeter points should be computed such that the resulting edge has only horizontal or vertical segments. |
boolean |
isPort(Object cell)
Returns true if the given cell is a "port", that is, when connecting to it, the cell returned by getTerminalForPort should be used as the terminal and the port should be referenced by the ID in either the mxConstants.STYLE_SOURCE_PORT or the or the mxConstants.STYLE_TARGET_PORT. |
boolean |
isPortsEnabled()
Returns true if ports are enabled. |
boolean |
isResetEdgesOnConnect()
Returns resetEdgesOnConnect. |
boolean |
isResetEdgesOnMove()
Returns resetEdgesOnMove. |
boolean |
isResetEdgesOnResize()
Returns resetEdgesOnResize. |
boolean |
isResetViewOnRootChange()
Returns resetViewOnRootChange. |
boolean |
isSelectionEmpty()
|
boolean |
isSplitEnabled()
Affects the return values of isValidDropTarget to allow for edges as drop targets. |
boolean |
isSplitTarget(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 |
isSwimlaneNesting()
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 |
isVertexLabelsMovable()
Returns vertexLabelsMovable. |
static void |
main(String[] args)
Prints the version number on the console. |
Object[] |
moveCells(Object[] cells,
double dx,
double dy)
Moves the cells by the given amount. |
Object[] |
moveCells(Object[] cells,
double dx,
double dy,
boolean clone)
Moves or clones the cells and moves the cells or clones by the given amount. |
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. |
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. |
protected Map<String,Object> |
postProcessCellStyle(Map<String,Object> style)
Tries to resolve the value for the image style in the image bundles and turns short data URIs as defined in mxImageBundle to data URIs as defined in RFC 2397 of the IETF. |
mxRectangle |
processChange(mxUndoableEdit.mxUndoableChange change,
boolean invalidate,
boolean ignoreDirty)
Processes the given change and invalidates the respective cached data in |
mxRectangle |
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[] |
removeCells()
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[] |
removeCellsFromParent()
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 |
removePropertyChangeListener(PropertyChangeListener listener)
|
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. |
Object |
resetEdge(Object edge)
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. |
Object |
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 |
selectAll()
|
void |
selectAll(Object parent)
Selects all children of the given parent cell or the children of the default parent if no parent is specified. |
void |
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 |
selectChildCell()
Selects the first child cell. |
void |
selectEdges()
Selects all vertices inside the default parent. |
void |
selectEdges(Object parent)
Selects all vertices inside the given parent or the default parent if no parent is given. |
void |
selectNextCell()
Selects the next cell. |
void |
selectParentCell()
Selects the parent cell. |
void |
selectPreviousCell()
Selects the previous cell. |
void |
selectVertices()
Selects all vertices inside the default parent. |
void |
selectVertices(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 |
setDefaultLoopStyle(mxEdgeStyle.mxEdgeStyleFunction value)
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 |
setOrigin(mxPoint value)
|
void |
setPortsEnabled(boolean value)
Sets if ports are enabled. |
void |
setResetEdgesOnConnect(boolean value)
Sets resetEdgesOnConnect. |
void |
setResetEdgesOnMove(boolean value)
Sets resetEdgesOnMove. |
void |
setResetEdgesOnResize(boolean value)
Sets resetEdgesOnResize. |
void |
setResetViewOnRootChange(boolean value)
Sets resetEdgesOnResize. |
void |
setSelectionCell(Object cell)
|
void |
setSelectionCells(Collection<Object> cells)
|
void |
setSelectionCells(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 if |
Object |
splitEdge(Object edge,
Object[] cells)
|
Object |
splitEdge(Object edge,
Object[] cells,
double dx,
double dy)
|
Object |
splitEdge(Object edge,
Object[] cells,
Object newEdge,
double dx,
double dy)
Splits the given edge by adding a newEdge between the previous source and the given cell and reconnecting the source of the given edge to the given cell. |
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. |
Object |
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. |
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[] |
ungroupCells()
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. |
Object |
updateCellSize(Object cell)
Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size. |
Object |
updateCellSize(Object cell,
boolean ignoreChildren)
Updates the size of the given cell in the model using getPreferredSizeForCell to get the new size. |
Object[] |
updateGroupBounds()
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 |
updateOrigin()
Extends the canvas by doing another validation with a shifted global translation if the bounds of the graph are below (0,0). |
String |
validateCell(Object cell,
Hashtable<Object,Object> context)
Hook method for subclassers to return an error message for the given cell and validation context. |
String |
validateEdge(Object edge,
Object source,
Object target)
Hook method for subclassers to return an error message for the given edge and terminals. |
Methods inherited from class com.mxgraph.util.mxEventSource |
---|
addListener, fireEvent, fireEvent, getEventSource, isEventsEnabled, removeListener, removeListener, setEventsEnabled, setEventSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String VERSION
protected PropertyChangeSupport changeSupport
protected mxIGraphModel model
protected mxGraphView view
protected mxStylesheet stylesheet
protected mxGraphSelectionModel selectionModel
protected int gridSize
protected boolean gridEnabled
protected boolean portsEnabled
protected double defaultOverlap
protected Object defaultParent
protected String alternateEdgeStyle
protected boolean enabled
protected boolean cellsLocked
protected boolean cellsEditable
protected boolean cellsResizable
protected boolean cellsMovable
protected boolean cellsBendable
protected boolean cellsSelectable
protected boolean cellsDeletable
protected boolean cellsCloneable
protected boolean cellsDisconnectable
protected boolean labelsClipped
protected boolean edgeLabelsMovable
protected boolean vertexLabelsMovable
protected boolean dropEnabled
protected boolean splitEnabled
protected boolean autoSizeCells
protected mxRectangle maximumGraphBounds
protected mxRectangle minimumGraphSize
protected int border
protected boolean keepEdgesInForeground
protected boolean keepEdgesInBackground
protected boolean collapseToPreferredSize
protected boolean allowNegativeCoordinates
protected boolean constrainChildren
protected boolean extendParents
protected boolean extendParentsOnAdd
protected boolean resetViewOnRootChange
protected boolean resetEdgesOnResize
protected boolean resetEdgesOnMove
protected boolean resetEdgesOnConnect
protected boolean allowLoops
protected mxMultiplicity[] multiplicities
protected mxEdgeStyle.mxEdgeStyleFunction defaultLoopStyle
protected boolean multigraph
protected boolean connectableEdges
protected boolean allowDanglingEdges
protected boolean cloneInvalidEdges
protected boolean disconnectOnMove
protected boolean labelsVisible
protected boolean htmlLabels
protected boolean swimlaneNesting
protected int changesRepaintThreshold
protected boolean autoOrigin
protected mxPoint origin
protected static List<mxImageBundle> imageBundles
protected mxEventSource.mxIEventListener fullRepaintHandler
protected mxEventSource.mxIEventListener updateOriginHandler
protected mxEventSource.mxIEventListener graphModelChangeHandler
Constructor Detail |
---|
public mxGraph()
mxGraphModel
.
public mxGraph(mxIGraphModel model)
mxGraphModel
is
used.
model
- Model that contains the graph datapublic mxGraph(mxStylesheet stylesheet)
mxGraphModel
is
used.
stylesheet
- The stylesheet to use for the graph.public mxGraph(mxIGraphModel model, mxStylesheet stylesheet)
mxGraphModel
is
used.
model
- Model that contains the graph dataMethod Detail |
---|
protected mxGraphSelectionModel createSelectionModel()
protected mxStylesheet createStylesheet()
protected mxGraphView createGraphView()
public mxIGraphModel getModel()
public void setModel(mxIGraphModel value)
value
- Model that contains the graph datapublic mxGraphView getView()
public void setView(mxGraphView value)
value
- View that contains the cell statespublic mxStylesheet getStylesheet()
public void setStylesheet(mxStylesheet value)
value
- Stylesheet that provides the style.public Object[] getSelectionCellsForChanges(List<mxUndoableEdit.mxUndoableChange> changes)
public mxRectangle graphModelChanged(mxIGraphModel sender, List<mxUndoableEdit.mxUndoableChange> changes)
protected void updateOrigin()
public Object[] getRemovedCellsForChanges(List<mxUndoableEdit.mxUndoableChange> changes)
public mxRectangle processChanges(List<mxUndoableEdit.mxUndoableChange> changes, boolean invalidate, boolean ignoreDirty)
public mxRectangle processChange(mxUndoableEdit.mxUndoableChange change, boolean invalidate, boolean ignoreDirty)
protected void removeStateForCell(Object cell)
cell
- Cell that was removed from the model.public Map<String,Object> getCellStyle(Object cell)
cell
- Cell whose style should be returned.
protected Map<String,Object> postProcessCellStyle(Map<String,Object> style)
public Object[] setCellStyle(String style)
style
- String representing the new style of the cells.public Object[] setCellStyle(String style, Object[] cells)
style
- String representing the new style of the cells.cells
- Optional array of public Object toggleCellStyle(String key, boolean defaultValue, Object cell)
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.public Object[] toggleCellStyles(String key, boolean defaultValue)
key
- Key for the boolean value to be toggled.defaultValue
- Default boolean value if no value is defined.public Object[] toggleCellStyles(String key, boolean defaultValue, Object[] cells)
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.public Object[] setCellStyles(String key, String value)
key
- String representing the key to be assigned.value
- String representing the new value for the key.public Object[] setCellStyles(String key, String value, Object[] cells)
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.public Object[] toggleCellStyleFlags(String key, int flag)
key
- String representing the key to toggle the flag in.flag
- Integer that represents the bit to be toggled.public Object[] toggleCellStyleFlags(String key, int flag, Object[] cells)
key
- String representing the key to toggle the flag in.flag
- Integer that represents the bit to be toggled.cells
- Optional array of public Object[] setCellStyleFlags(String key, int flag, boolean value)
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.public Object[] setCellStyleFlags(String key, int flag, Boolean value, Object[] cells)
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.public void addImageBundle(mxImageBundle bundle)
public void removeImageBundle(mxImageBundle bundle)
public String getImageFromBundles(String key)
public List<mxImageBundle> getImageBundles()
public void getImageBundles(List<mxImageBundle> value)
public Object[] alignCells(String align)
align
- Specifies the alignment. Possible values are all constants
in mxConstants with an ALIGN prefix.public Object[] alignCells(String align, Object[] cells)
align
- Specifies the alignment. Possible values are all constants
in mxConstants with an ALIGN prefix.cells
- Array of cells to be aligned.public Object[] alignCells(String align, Object[] cells, Object param)
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.public Object flipEdge(Object edge)
edge
- Cell that represents the edge to be flipped.
public Object[] orderCells(boolean back)
back
- Specifies if the cells should be moved to back.public Object[] orderCells(boolean back, Object[] cells)
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.public void cellsOrdered(Object[] cells, boolean back)
cells
- Array of cells whose order should be changed.back
- Specifies if the cells should be moved to back.public Object groupCells()
public Object groupCells(Object group)
public Object groupCells(Object group, double border)
public Object groupCells(Object group, double border, Object[] cells)
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.public Object[] getCellsForGroup(Object[] cells)
public mxRectangle getBoundsForGroup(Object group, Object[] children, double border)
public Object createGroupCell(Object[] cells)
cells
-
public Object[] ungroupCells()
public Object[] ungroupCells(Object[] cells)
cells
- Array of cells to be ungrouped. If null is specified then
the selection cells are used.
public Object[] removeCellsFromParent()
public Object[] removeCellsFromParent(Object[] cells)
cells
- Array of cells to be removed from their parents.
public Object[] updateGroupBounds()
public Object[] updateGroupBounds(Object[] cells)
cells
- The groups whose bounds should be updated.public Object[] updateGroupBounds(Object[] cells, int border)
cells
- The groups whose bounds should be updated.border
- The border to be added in the group.public Object[] updateGroupBounds(Object[] cells, int border, boolean moveParent)
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.public Object[] cloneCells(Object[] cells)
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()));
public Object[] cloneCells(Object[] cells, boolean allowInvalidEdges)
cells
- Array of mxCells to be cloned.
public Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height)
public Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style)
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.
public Object insertVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative)
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.
public Object createVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style)
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.
public Object createVertex(Object parent, String id, Object value, double x, double y, double width, double height, String style, boolean relative)
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.
public Object insertEdge(Object parent, String id, Object value, Object source, Object target)
public Object insertEdge(Object parent, String id, Object value, Object source, Object target, String style)
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.
public Object createEdge(Object parent, String id, Object value, Object source, Object target, String style)
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.
public Object addEdge(Object edge, Object parent, Object source, Object target, Integer index)
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.
public Object addCell(Object cell)
cell
- Cell to be inserted.
public Object addCell(Object cell, Object parent)
cell
- Cell tobe inserted.parent
- Object that represents the new parent. If no parent is
given then the default parent is used.
public Object addCell(Object cell, Object parent, Integer index, Object source, Object target)
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.
public Object[] addCells(Object[] cells)
cells
- Array of cells to be inserted.
public Object[] addCells(Object[] cells, Object parent)
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.
public Object[] addCells(Object[] cells, Object parent, Integer index)
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.
public Object[] addCells(Object[] cells, Object parent, Integer index, Object source, Object target)
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.
public void cellsAdded(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute)
public void cellsAdded(Object[] cells, Object parent, Integer index, Object source, Object target, boolean absolute, boolean constrain)
public Object[] removeCells()
public Object[] removeCells(Object[] cells)
cells
- Array of cells to remove.
public Object[] removeCells(Object[] cells, boolean includeEdges)
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.public void cellsRemoved(Object[] cells)
cells
- Array of cells to remove.public Object splitEdge(Object edge, Object[] cells)
public Object splitEdge(Object edge, Object[] cells, double dx, double dy)
public Object splitEdge(Object edge, Object[] cells, Object newEdge, double dx, double dy)
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.
public Object[] toggleCells(boolean show)
show
- Boolean that specifies the visible state to be assigned.
public Object[] toggleCells(boolean show, Object[] cells)
show
- Boolean that specifies the visible state to be assigned.cells
- Array of cells whose visible state should be changed.
public Object[] toggleCells(boolean show, Object[] cells, boolean includeEdges)
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.
public void cellsToggled(Object[] cells, boolean show)
cells
- Array of cells whose visible state should be changed.show
- Boolean that specifies the visible state to be assigned.public Object[] foldCells(boolean collapse)
collapse
- Boolean that specifies the collapsed state to be
assigned.
public Object[] foldCells(boolean collapse, boolean recurse)
collapse
- Boolean that specifies the collapsed state to be
assigned.recurse
- Boolean that specifies if the collapsed state should
be assigned to all descendants.
public Object[] foldCells(boolean collapse, boolean recurse, Object[] cells)
public Object[] foldCells(boolean collapse, boolean recurse, Object[] cells, boolean checkFoldable)
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.public void cellsFolded(Object[] cells, boolean collapse, boolean recurse)
public void cellsFolded(Object[] cells, boolean collapse, boolean recurse, boolean checkFoldable)
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.public void swapBounds(Object cell, boolean willCollapse)
cell
- Cell for which the bounds should be swapped.willCollapse
- Boolean indicating if the cell is going to be collapsed.public void updateAlternateBounds(Object cell, mxGeometry geo, boolean willCollapse)
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.public Object[] addAllEdges(Object[] cells)
public Object[] getAllEdges(Object[] cells)
public Object updateCellSize(Object cell)
cell
- public Object updateCellSize(Object cell, boolean ignoreChildren)
cell
- Cell for which the size should be changed.public void cellSizeUpdated(Object cell, boolean ignoreChildren)
cell
- Cell for which the size should be changed.public mxRectangle getPreferredSizeForCell(Object cell)
cell
- public Object resizeCell(Object cell, mxRectangle bounds)
cell
- bounds
- public Object[] resizeCells(Object[] cells, mxRectangle[] bounds)
cells
- Array of cells whose bounds should be changed.bounds
- Array of rectangles that represents the new bounds.public void cellsResized(Object[] cells, mxRectangle[] bounds)
cells
- Array of bounds
- Array of public void extendParent(Object cell)
cell
- public Object[] moveCells(Object[] cells, double dx, double dy)
public Object[] moveCells(Object[] cells, double dx, double dy, boolean clone)
public Object[] moveCells(Object[] cells, double dx, double dy, boolean clone, Object target, Point location)
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.
public void cellsMoved(Object[] cells, double dx, double dy, boolean disconnect, boolean constrain)
public void translateCell(Object cell, double dx, double dy)
public mxRectangle getCellContainmentArea(Object cell)
public mxRectangle getMaximumGraphBounds()
public void setMaximumGraphBounds(mxRectangle value)
value
- the maximumGraphBounds to setpublic void constrainChild(Object cell)
cell
- Cell which should be constrained.public void resetEdges(Object[] cells)
cells
- Array of mxCells for which the connected edges should be
reset.public Object resetEdge(Object edge)
public mxConnectionConstraint[] getAllConnectionConstraints(mxCellState terminal, boolean source)
terminal
- Cell state that represents the terminal.source
- Specifies if the terminal is the source or target.public mxConnectionConstraint getConnectionConstraint(mxCellState edge, mxCellState terminal, boolean source)
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.public void setConnectionConstraint(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint)
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.public mxPoint getConnectionPoint(mxCellState vertex, mxConnectionConstraint constraint)
vertex
- Cell state that represents the vertex.constraint
- Connection constraint that represents the connection point
constraint as returned by getConnectionConstraint.public Object connectCell(Object edge, Object terminal, boolean source)
public Object connectCell(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint)
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.
public void cellConnected(Object edge, Object terminal, boolean source, mxConnectionConstraint constraint)
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.public void disconnectGraph(Object[] cells)
cells
- Array of public Object getCurrentRoot()
public mxPoint getTranslateForRoot(Object cell)
cell
- Cell that represents the root of the view.
public boolean isPort(Object cell)
public boolean isPort(Object cell)
{
mxGeometry geo = getCellGeometry(cell);
return (geo != null) ? geo.isRelative() : false;
}
cell
- Cell that represents the port.
public Object getTerminalForPort(Object cell, boolean source)
cell
- Cell that represents the port.source
- If the cell is the source or target port.
public mxPoint getChildOffsetForCell(Object cell)
cell
- Cell whose offset should be returned.
public void enterGroup()
public void enterGroup(Object cell)
cell
- public void exitGroup()
public void home()
public boolean isValidRoot(Object cell)
cell
- public mxRectangle getGraphBounds()
public mxRectangle getCellBounds(Object cell)
public mxRectangle getCellBounds(Object cell, boolean includeEdges)
public mxRectangle getCellBounds(Object cell, boolean includeEdges, boolean includeDescendants)
public mxRectangle getBoundingBoxFromGeometry(Object[] cells)
public mxRectangle getBoundingBox(Object cell)
public mxRectangle getBoundingBox(Object cell, boolean includeEdges)
public mxRectangle getBoundingBox(Object cell, boolean includeEdges, boolean includeDescendants)
public mxRectangle getPaintBounds(Object[] cells)
public mxRectangle getBoundsForCells(Object[] cells, boolean includeEdges, boolean includeDescendants, boolean boundingBox)
public mxRectangle getCellBounds(Object cell, boolean includeEdges, boolean includeDescendants, boolean boundingBox)
public void refresh()
public void repaint()
public void repaint(mxRectangle region)
public double snap(double value)
value
- Numeric value to be snapped to the grid.
public mxGeometry getCellGeometry(Object cell)
cell
- Cell whose geometry should be returned.
public boolean isCellVisible(Object cell)
cell
- Cell whose visible state should be returned.
public boolean isCellCollapsed(Object cell)
cell
- Cell whose collapsed state should be returned.
public boolean isCellConnectable(Object cell)
cell
- Cell whose connectable state should be returned.
public boolean isOrthogonal(mxCellState edge)
edge
- Cell state that represents the edge.public boolean isLoop(mxCellState state)
state
- public void setMultiplicities(mxMultiplicity[] value)
public mxMultiplicity[] getMultiplicities()
public boolean isEdgeValid(Object edge, Object source, Object target)
edge
- Cell that represents the edge to validate.source
- Cell that represents the source terminal.target
- Cell that represents the target terminal.public String getEdgeValidationError(Object edge, Object source, Object target)
edge
- Cell that represents the edge to validate.source
- Cell that represents the source terminal.target
- Cell that represents the target terminal.public String validateEdge(Object edge, Object source, Object target)
edge
- Cell that represents the edge to validate.source
- Cell that represents the source terminal.target
- Cell that represents the target terminal.public String getCellValidationError(Object cell)
cell
- Cell for which the multiplicities should be checked.public String validateCell(Object cell, Hashtable<Object,Object> context)
cell
- Cell that represents the cell to validate.context
- Hashtable that represents the global validation state.public boolean isLabelsVisible()
public void setLabelsVisible(boolean value)
value
- the labelsVisible to setpublic void setHtmlLabels(boolean value)
value
- the htmlLabels to setpublic boolean isHtmlLabels()
public String convertValueToString(Object cell)
cell
- Cell to be converted to a string.
public String getLabel(Object cell)
cell
- public void cellLabelChanged(Object cell, Object value, boolean autoSize)
cell
- Cell whose label should be changed.value
- New label to be assigned.autoSize
- Specifies if cellSizeUpdated should be called.public boolean isHtmlLabel(Object cell)
cell
- public String getToolTipForCell(Object cell)
public mxRectangle getStartSize(Object swimlane)
swimlane
- public String getImage(mxCellState state)
state
-
public int getBorder()
public void setBorder(int value)
value
- Positive integer that represents the border to be used.public mxEdgeStyle.mxEdgeStyleFunction getDefaultLoopStyle()
public void setDefaultLoopStyle(mxEdgeStyle.mxEdgeStyleFunction value)
value
- Default style to be used for loops.public boolean isSwimlane(Object cell)
cell
- Cell that should be checked.
public boolean isCellLocked(Object cell)
cell
- Cell whose locked state should be returned.
public boolean isCellsLocked()
public void setCellsLocked(boolean value)
public boolean isCellEditable(Object cell)
cell
- Cell whose editable state should be returned.
public boolean isCellsEditable()
public void setCellsEditable(boolean value)
public boolean isCellResizable(Object cell)
cell
- Cell whose resizable state should be returned.
public boolean isCellsResizable()
public void setCellsResizable(boolean value)
public Object[] getMovableCells(Object[] cells)
public boolean isCellMovable(Object cell)
cell
- Cell whose movable state should be returned.
public boolean isCellsMovable()
public void setCellsMovable(boolean value)
public boolean isTerminalPointMovable(Object cell, boolean source)
cell
- Cell whose terminal point should be moved.source
- Boolean indicating if the source or target terminal should be moved.public boolean isCellBendable(Object cell)
cell
- Cell whose bendable state should be returned.
public boolean isCellsBendable()
public void setCellsBendable(boolean value)
public boolean isCellSelectable(Object cell)
cell
- public boolean isCellsSelectable()
public void setCellsSelectable(boolean value)
public Object[] getDeletableCells(Object[] cells)
public boolean isCellDeletable(Object cell)
cell
- Cell whose movable state should be returned.
public boolean isCellsDeletable()
public void setCellsDeletable(boolean value)
public Object[] getCloneableCells(Object[] cells)
public boolean isCellCloneable(Object cell)
public boolean isCellsCloneable()
public void setCellsCloneable(boolean value)
value
- Boolean indicating if the graph should be cloneable.public boolean isCellDisconnectable(Object cell, Object terminal, boolean source)
cell
- terminal
- source
- Boolean indicating if the source or target terminal is to be
disconnected.
public boolean isCellsDisconnectable()
public void setCellsDisconnectable(boolean value)
value
- Boolean indicating if the graph should allow disconnecting of
edges.public boolean isLabelClipped(Object cell)
cell
- Cell whose label should be clipped.
public boolean isLabelsClipped()
public void setLabelsClipped(boolean value)
public boolean isLabelMovable(Object cell)
cell
- public boolean isVertexLabelsMovable()
public void setVertexLabelsMovable(boolean value)
public boolean isEdgeLabelsMovable()
public void setEdgeLabelsMovable(boolean value)
public boolean isEnabled()
public void setEnabled(boolean value)
value
- Boolean indicating if the graph should be enabled.public boolean isDropEnabled()
public void setDropEnabled(boolean value)
public boolean isSplitEnabled()
public void setSplitEnabled(boolean value)
public boolean isMultigraph()
public void setMultigraph(boolean value)
public boolean isSwimlaneNesting()
public void setSwimlaneNesting(boolean value)
public boolean isAllowDanglingEdges()
public void setAllowDanglingEdges(boolean value)
public boolean isCloneInvalidEdges()
public void setCloneInvalidEdges(boolean value)
public boolean isDisconnectOnMove()
public void setDisconnectOnMove(boolean value)
public boolean isAllowLoops()
public void setAllowLoops(boolean value)
public boolean isConnectableEdges()
public void setConnectableEdges(boolean value)
public boolean isResetEdgesOnMove()
public void setResetEdgesOnMove(boolean value)
public boolean isResetViewOnRootChange()
public void setResetViewOnRootChange(boolean value)
public boolean isResetEdgesOnResize()
public void setResetEdgesOnResize(boolean value)
public boolean isResetEdgesOnConnect()
public void setResetEdgesOnConnect(boolean value)
public boolean isAutoSizeCell(Object cell)
cell
- Cell that should be resized.
public boolean isAutoSizeCells()
public void setAutoSizeCells(boolean value)
value
- Boolean indicating if cells should be resized
automatically.public boolean isExtendParent(Object cell)
cell
- Cell that has been resized.public boolean isExtendParents()
public void setExtendParents(boolean value)
public boolean isExtendParentsOnAdd()
public void setExtendParentsOnAdd(boolean value)
public boolean isConstrainChild(Object cell)
public boolean isConstrainChildren()
public void setConstrainChildren(boolean value)
value
- the constrainChildren to setpublic boolean isAutoOrigin()
public void setAutoOrigin(boolean value)
value
- the autoOrigin to setpublic mxPoint getOrigin()
public void setOrigin(mxPoint value)
value
- the origin to setpublic int getChangesRepaintThreshold()
public void setChangesRepaintThreshold(int value)
value
- the changesRepaintThreshold to setpublic boolean isAllowNegativeCoordinates()
public void setAllowNegativeCoordinates(boolean value)
value
- the allowNegativeCoordinates to setpublic boolean isCollapseToPreferredSize()
public void setCollapseToPreferredSize(boolean value)
value
- the collapseToPreferredSize to setpublic boolean isKeepEdgesInForeground()
public void setKeepEdgesInForeground(boolean value)
value
- the keepEdgesInForeground to setpublic boolean isKeepEdgesInBackground()
public void setKeepEdgesInBackground(boolean value)
value
- the keepEdgesInBackground to setpublic boolean isValidSource(Object cell)
cell
- Object that represents a possible source or null.
public boolean isValidTarget(Object cell)
cell
- Object that represents a possible target or null.
public boolean isValidConnection(Object source, Object target)
source
- Object that represents the source cell.target
- Object that represents the target cell.
public mxRectangle getMinimumGraphSize()
public void setMinimumGraphSize(mxRectangle value)
value
- the minimumGraphSize to setpublic double getOverlap(Object cell)
cell
-
public double getDefaultOverlap()
public void setDefaultOverlap(double value)
public boolean isAllowOverlapParent(Object cell)
cell
-
public Object[] getFoldableCells(Object[] cells, boolean collapse)
public boolean isCellFoldable(Object cell, boolean collapse)
cell
- public boolean isGridEnabled()
public void setGridEnabled(boolean value)
value
- Specifies if the grid should be enabled.public boolean isPortsEnabled()
public void setPortsEnabled(boolean value)
value
- Specifies if the ports should be enabled.public int getGridSize()
public void setGridSize(int value)
value
- New grid size to be used.public String getAlternateEdgeStyle()
public void setAlternateEdgeStyle(String value)
public boolean isValidDropTarget(Object cell, Object[] cells)
cell
- Object that represents the possible drop target.cells
- Objects that are going to be dropped.
public boolean isSplitTarget(Object target, Object[] cells)
target
- Object that represents the edge to be splitted.cells
- Array of cells to add into the given edge.
public Object getDropTarget(Object[] cells, Point pt, Object cell)
public Object getDefaultParent()
public void setDefaultParent(Object value)
public Object[] getChildVertices(Object parent)
parent
- Cell whose children should be returned.public Object[] getChildEdges(Object parent)
parent
- Cell whose children should be returned.public Object[] getChildCells(Object parent)
parent
- Cell whose children should be returned.public Object[] getChildCells(Object parent, boolean vertices, boolean edges)
parent
- Cell whose children should be returned.vertices
- Specifies if child vertices should be returned.edges
- Specifies if child edges should be returned.
public Object[] getConnections(Object cell)
cell
- Cell whose connections should be returned.
public Object[] getConnections(Object cell, Object parent)
cell
- Cell whose connections should be returned.parent
- Optional parent of the opposite end for a connection
to be returned.
public Object[] getConnections(Object cell, Object parent, boolean recurse)
cell
- Cell whose connections should be returned.parent
- Optional parent of the opposite end for a connection
to be returned.
public Object[] getIncomingEdges(Object cell)
cell
- Cell whose incoming edges should be returned.
public Object[] getIncomingEdges(Object cell, Object parent)
cell
- Cell whose incoming edges should be returned.parent
- Optional parent of the opposite end for an edge
to be returned.
public Object[] getOutgoingEdges(Object cell)
cell
- Cell whose outgoing edges should be returned.
public Object[] getOutgoingEdges(Object cell, Object parent)
cell
- Cell whose outgoing edges should be returned.parent
- Optional parent of the opposite end for an edge
to be returned.
public Object[] getEdges(Object cell)
cell
- Cell whose edges should be returned.
public Object[] getEdges(Object cell, Object parent)
cell
- Cell whose edges should be returned.parent
- Optional parent of the opposite end for an edge
to be returned.
public Object[] getEdges(Object cell, Object parent, boolean incoming, boolean outgoing, boolean includeLoops)
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.
public Object[] getEdges(Object cell, Object parent, boolean incoming, boolean outgoing, boolean includeLoops, boolean recurse)
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
public boolean isValidAncestor(Object cell, Object parent, boolean recurse)
cell
- the possible child cellparent
- the possible parent cellrecurse
- whether or not to recurse the child ancestors
public Object[] getOpposites(Object[] edges, Object terminal)
edges
- terminal
-
public Object[] getOpposites(Object[] edges, Object terminal, boolean sources, boolean targets)
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.
public Object[] getEdgesBetween(Object source, Object target)
source
- target
-
public Object[] getEdgesBetween(Object source, Object target, boolean directed)
source
- target
- directed
-
public Object[] getCellsBeyond(double x0, double y0, Object parent, boolean rightHalfpane, boolean bottomHalfpane)
x0
- X-coordinate of the origin.y0
- Y-coordinate of the origin.parent
- 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.
public List<Object> findTreeRoots(Object parent)
parent
- Cell whose children should be checked.
public List<Object> findTreeRoots(Object parent, boolean isolate)
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.
public List<Object> findTreeRoots(Object parent, boolean isolate, boolean invert)
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.
public void traverse(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor)
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;
}
});
vertex
- directed
- visitor
- public void traverse(Object vertex, boolean directed, mxGraph.mxICellVisitor visitor, Object edge, Set<Object> visited)
vertex
- directed
- Optional boolean indicating if edges should only be traversed
from source to target. Default is true.visitor
- Visitor that takes the current vertex and the incoming edge.
The traversal stops if the function returns false.edge
- Optional visited
- Optional array of cell paths for the visited cells.public mxGraphSelectionModel getSelectionModel()
public int getSelectionCount()
public boolean isCellSelected(Object cell)
cell
-
public boolean isSelectionEmpty()
public void clearSelection()
public Object getSelectionCell()
public void setSelectionCell(Object cell)
cell
- public Object[] getSelectionCells()
public void setSelectionCells(Object[] cells)
public void setSelectionCells(Collection<Object> cells)
cells
- public void addSelectionCell(Object cell)
public void addSelectionCells(Object[] cells)
public void removeSelectionCell(Object cell)
public void removeSelectionCells(Object[] cells)
public void selectNextCell()
public void selectPreviousCell()
public void selectParentCell()
public void selectChildCell()
public void selectCell(boolean isNext, boolean isParent, boolean isChild)
isNext
- isParent
- isChild
- public void selectVertices()
public void selectVertices(Object parent)
public void selectEdges()
public void selectEdges(Object parent)
public void selectCells(boolean vertices, boolean edges)
selectAll
to select all cells.
vertices
- Boolean indicating if vertices should be selected.edges
- Boolean indicating if edges should be selected.public void selectCells(boolean vertices, boolean edges, Object parent)
selectAll
to select
all cells.
vertices
- Boolean indicating if vertices should be selected.edges
- Boolean indicating if edges should be selected.parent
- Optional cell that acts as the root of the recursion.
Default is defaultParent
.public void selectAll()
public void selectAll(Object parent)
parent
- Optional public void drawGraph(mxICanvas canvas)
canvas
- Canvas onto which the graph should be drawn.public void drawCell(mxICanvas canvas, Object cell)
canvas
- Canvas onto which the cell should be drawn.cell
- Cell that should be drawn onto the canvas.public void drawState(mxICanvas canvas, mxCellState state, boolean drawLabel)
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.protected void cellDrawn(mxICanvas canvas, mxCellState state, Object element, Object labelElement)
protected String getLinkForCell(Object cell)
protected String getTargetForCell(Object cell)
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- PropertyChangeSupport.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- listener
- PropertyChangeSupport.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- PropertyChangeSupport.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
propertyName
- listener
- PropertyChangeSupport.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
public static void main(String[] args)
|
mxGraph 2.3.0.5 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |