mxGraphModel

mxGraphModelExtends mxEventSource to implement a graph model.
Events
mxEvent.CHANGEFires when an undoable edit is dispatched.
mxEvent.NOTIFYSame as mxEvent.CHANGE, this event can be used for classes that need to implement a sync mechanism between this model and, say, a remote model.
mxEvent.EXECUTEFires between begin- and endUpdate and after an atomic change was executed in the model.
mxEvent.EXECUTEDFires between START_EDIT and END_EDIT after an atomic change was executed.
mxEvent.BEGIN_UPDATEFires after the updateLevel was incremented in beginUpdate.
mxEvent.START_EDITFires after the updateLevel was changed from 0 to 1.
mxEvent.END_UPDATEFires after the updateLevel was decreased in endUpdate but before any notification or change dispatching.
mxEvent.END_EDITFires after the updateLevel was changed from 1 to 0.
mxEvent.BEFORE_UNDOFires before the change is dispatched after the update level has reached 0 in endUpdate.
mxEvent.UNDOFires after the change was dispatched in endUpdate.
Functions
mxGraphModelConstructs a new graph model.
Variables
rootHolds the root cell, which in turn contains the cells that represent the layers of the diagram as child cells.
cellsMaps from Ids to cells.
maintainEdgeParentSpecifies if edges should automatically be moved into the nearest common ancestor of their terminals.
ignoreRelativeEdgeParentSpecifies if relative edge parents should be ignored for finding the nearest common ancestors of an edge’s terminals.
createIdsSpecifies if the model should automatically create Ids for new cells.
prefixDefines the prefix of new Ids.
postfixDefines the postfix of new Ids.
nextIdSpecifies the next Id to be created.
currentEditHolds the changes for the current transaction.
updateLevelCounter for the depth of nested transactions.
endingUpdateTrue if the program flow is currently inside endUpdate.
Functions
clearSets a new root using createRoot.
isCreateIdsReturns createIds.
setCreateIdsSets createIds.
createRootCreates a new root cell with a default layer (child 0).
getCellReturns the mxCell for the specified Id or null if no cell can be found for the given Id.
filterCellsReturns the cells from the given array where the given filter function returns true.
getDescendantsReturns all descendants of the given cell and the cell itself in an array.
filterDescendantsVisits all cells recursively and applies the specified filter function to each cell.
getRootReturns the root of the model or the topmost parent of the given cell.
setRootSets the root of the model using mxRootChange and adds the change to the current transaction.
rootChangedInner callback to change the root of the model and update the internal datastructures, such as cells and nextId.
isRootReturns true if the given cell is the root of the model and a non-null value.
isLayerReturns true if isRoot returns true for the parent of the given cell.
isAncestorReturns true if the given parent is an ancestor of the given child.
containsReturns true if the model contains the given mxCell.
getParentReturns the parent of the given cell.
addAdds the specified child to the parent at the given index using mxChildChange and adds the change to the current transaction.
cellAddedInner callback to update cells when a cell has been added.
createIdHook method to create an Id for the specified cell.
updateEdgeParentsUpdates the parent for all edges that are connected to cell or one of its descendants using updateEdgeParent.
updateEdgeParentInner callback to update the parent of the specified mxCell to the nearest-common-ancestor of its two terminals.
getOriginReturns the absolute, accumulated origin for the children inside the given parent as an mxPoint.
getNearestCommonAncestorReturns the nearest common ancestor for the specified cells.
removeRemoves the specified cell from the model using mxChildChange and adds the change to the current transaction.
cellRemovedInner callback to update cells when a cell has been removed.
parentForCellChangedInner callback to update the parent of a cell using mxCell.insert on the parent and return the previous parent.
getChildCountReturns the number of children in the given cell.
getChildAtReturns the child of the given mxCell at the given index.
getChildrenReturns all children of the given mxCell as an array of mxCells.
getChildVerticesReturns the child vertices of the given parent.
getChildEdgesReturns the child edges of the given parent.
getChildCellsReturns the children of the given cell that are vertices and/or edges depending on the arguments.
getTerminalReturns the source or target mxCell of the given edge depending on the value of the boolean parameter.
setTerminalSets the source or target terminal of the given mxCell using mxTerminalChange and adds the change to the current transaction.
setTerminalsSets the source and target mxCell of the given mxCell in a single transaction using setTerminal for each end of the edge.
terminalForCellChangedInner helper function to update the terminal of the edge using mxCell.insertEdge and return the previous terminal.
getEdgeCountReturns the number of distinct edges connected to the given cell.
getEdgeAtReturns the edge of cell at the given index.
getDirectedEdgeCountReturns the number of incoming or outgoing edges, ignoring the given edge.
getConnectionsReturns all edges of the given cell without loops.
getIncomingEdgesReturns the incoming edges of the given cell without loops.
getOutgoingEdgesReturns the outgoing edges of the given cell without loops.
getEdgesReturns all distinct edges connected to this cell as a new array of mxCells.
getEdgesBetweenReturns all edges between the given source and target pair.
getOppositesReturns all opposite vertices wrt terminal for the given edges, only returning sources and/or targets as specified.
getTopmostCellsReturns the topmost cells of the hierarchy in an array that contains no descendants for each mxCell that it contains.
isVertexReturns true if the given cell is a vertex.
isEdgeReturns true if the given cell is an edge.
isConnectableReturns true if the given mxCell is connectable.
getValueReturns the user object of the given mxCell using mxCell.getValue.
setValueSets the user object of then given mxCell using mxValueChange and adds the change to the current transaction.
valueForCellChangedInner callback to update the user object of the given mxCell using mxCell.valueChanged and return the previous value, that is, the return value of mxCell.valueChanged.
getGeometryReturns the mxGeometry of the given mxCell.
setGeometrySets the mxGeometry of the given mxCell.
geometryForCellChangedInner callback to update the mxGeometry of the given mxCell using mxCell.setGeometry and return the previous mxGeometry.
getStyleReturns the style of the given mxCell.
setStyleSets the style of the given mxCell using mxStyleChange and adds the change to the current transaction.
styleForCellChangedInner callback to update the style of the given mxCell using mxCell.setStyle and return the previous style.
isCollapsedReturns true if the given mxCell is collapsed.
setCollapsedSets the collapsed state of the given mxCell using mxCollapseChange and adds the change to the current transaction.
collapsedStateForCellChangedInner callback to update the collapsed state of the given mxCell using mxCell.setCollapsed and return the previous collapsed state.
isVisibleReturns true if the given mxCell is visible.
setVisibleSets the visible state of the given mxCell using mxVisibleChange and adds the change to the current transaction.
visibleStateForCellChangedInner callback to update the visible state of the given mxCell using mxCell.setCollapsed and return the previous visible state.
executeExecutes the given edit and fires events if required.
beginUpdateIncrements the updateLevel by one.
endUpdateDecrements the updateLevel by one and fires an <undo> event if the updateLevel reaches 0.
createUndoableEditCreates a new mxUndoableEdit that implements the notify function to fire a <change> and <notify> event through the mxUndoableEdit’s source.
mergeChildrenMerges the children of the given cell into the given target cell inside this model.
mergeChildrenClones the children of the source cell into the given target cell in this model and adds an entry to the mapping that maps from the source cell to the target cell with the same id or the clone of the source cell that was inserted into this model.
getParentsReturns an array that represents the set (no duplicates) of all parents for the given array of cells.
cloneCellReturns a deep clone of the given mxCell (including the children) which is created using cloneCells.
cloneCellsReturns an array of clones for the given array of mxCells.
cloneCellImplInner helper method for cloning cells recursively.
cellClonedHook for cloning the cell.
restoreCloneInner helper method for restoring the connections in a network of cloned cells.
mxRootChangeAction to change the root in a model.
Functions
mxRootChangeConstructs a change of the root in the specified model.
executeCarries out a change of the root using mxGraphModel.rootChanged.
mxChildChangeAction to add or remove a child in a model.
Functions
mxChildChangeConstructs a change of a child in the specified model.
executeChanges the parent of <child> using mxGraphModel.parentForCellChanged and removes or restores the cell’s connections.
disconnectDisconnects the given cell recursively from its terminals and stores the previous terminal in the cell’s terminals.
mxTerminalChangeAction to change a terminal in a model.
Functions
mxTerminalChangeConstructs a change of a terminal in the specified model.
executeChanges the terminal of <cell> to <previous> using mxGraphModel.terminalForCellChanged.
mxValueChangeAction to change a user object in a model.
Functions
mxValueChangeConstructs a change of a user object in the specified model.
executeChanges the value of <cell> to <previous> using mxGraphModel.valueForCellChanged.
mxStyleChangeAction to change a cell’s style in a model.
Functions
mxStyleChangeConstructs a change of a style in the specified model.
executeChanges the style of <cell> to <previous> using mxGraphModel.styleForCellChanged.
mxGeometryChangeAction to change a cell’s geometry in a model.
Functions
mxGeometryChangeConstructs a change of a geometry in the specified model.
executeChanges the geometry of <cell> ro <previous> using mxGraphModel.geometryForCellChanged.
mxCollapseChangeAction to change a cell’s collapsed state in a model.
Functions
mxCollapseChangeConstructs a change of a collapsed state in the specified model.
executeChanges the collapsed state of <cell> to <previous> using mxGraphModel.collapsedStateForCellChanged.
mxVisibleChangeAction to change a cell’s visible state in a model.
Functions
mxVisibleChangeConstructs a change of a visible state in the specified model.
executeChanges the visible state of <cell> to <previous> using mxGraphModel.visibleStateForCellChanged.
mxCellAttributeChangeAction to change the attribute of a cell’s user object.
Functions
mxCellAttributeChangeConstructs a change of a attribute of the DOM node stored as the value of the given mxCell.
executeChanges the attribute of the cell’s user object by using mxCell.setAttribute.