mxGraph
|
Implements a graph model. The graph model acts as a wrapper around the cells which are in charge of storing the actual graph datastructure. The model acts as a transactional wrapper with event notification for all changes, whereas the cells contain the atomic operations for updating the actual datastructure. More...
Public Member Functions | |
mxGraphModel () | |
Constructs a new empty graph model. More... | |
mxGraphModel (Object root) | |
Constructs a new graph model. If no root is specified then a new root mxCell with a default layer is created. More... | |
void | Clear () |
Sets a new root using createRoot. More... | |
Object | CreateRoot () |
Creates a new root cell with a default layer (child 0). More... | |
Object | GetCell (string id) |
Object[] | CloneCells (Object[] cells, bool includeChildren) |
Returns an array of clones for the given array of cells. Depending on the value of includeChildren, a deep clone is created for each cell. Connections are restored based if the corresponding cell is contained in the passed in array. More... | |
bool | IsAncestor (Object parent, Object child) |
Returns true if the given parent is an ancestor of child. More... | |
bool | Contains (Object cell) |
Returns true if the model contains the given cell. More... | |
Object | GetParent (Object child) |
Returns the parent of the given cell. More... | |
Object | Add (Object parent, Object child, int index) |
Adds the specified child to the parent at the given index. If no index is specified then the child is appended to the parent's array of children. More... | |
string | CreateId (Object cell) |
Creates a new Id for the given cell and increments the global counter for creating new Ids. More... | |
Object | Remove (Object cell) |
see com.mxgraph.mxIGraphModel.Remove(Object) More... | |
int | GetChildCount (Object cell) |
Returns the number of children in the given cell. More... | |
Object | GetChildAt (Object parent, int index) |
Returns the child of the given parent at the given index. More... | |
Object | GetTerminal (Object edge, bool isSource) |
Returns the source or target terminal of the given edge depending on the value of the boolean parameter. More... | |
Object | SetTerminal (Object edge, Object terminal, bool isSource) |
Sets the source or target terminal of the given edge using. More... | |
void | UpdateEdgeParents (Object cell) |
Updates the parents of the edges connected to the given cell and all its descendants so that each edge is contained in the nearest common ancestor. More... | |
void | UpdateEdgeParents (Object cell, Object root) |
Updates the parents of the edges connected to the given cell and all its descendants so that the edge is contained in the nearest-common-ancestor. More... | |
void | UpdateEdgeParent (Object edge, Object root) |
Inner helper method to update the parent of the specified edge to the nearest-common-ancestor of its two terminals. More... | |
mxPoint | GetOrigin (Object cell) |
Returns the absolute, cummulated origin for the children inside the given parent. More... | |
Object | GetNearestCommonAncestor (Object cell1, Object cell2) |
Returns the nearest common ancestor for the specified cells. More... | |
int | GetEdgeCount (Object cell) |
see com.mxgraph.mxIGraphModel.GetEdgeCount(Object) More... | |
Object | GetEdgeAt (Object parent, int index) |
see com.mxgraph.mxIGraphModel.GetEdgeAt(Object, int) More... | |
bool | IsVertex (Object cell) |
see com.mxgraph.mxIGraphModel.IsVertex(Object) More... | |
bool | IsEdge (Object cell) |
see com.mxgraph.mxIGraphModel.IsEdge(Object) More... | |
bool | IsConnectable (Object cell) |
see com.mxgraph.mxIGraphModel.IsConnectable(Object) More... | |
Object | GetValue (Object cell) |
see com.mxgraph.mxIGraphModel.GetValue(Object) More... | |
Object | SetValue (Object cell, Object value) |
see com.mxgraph.mxIGraphModel.SetValue(Object, Object) More... | |
mxGeometry | GetGeometry (Object cell) |
see com.mxgraph.mxIGraphModel.GetGeometry(Object) More... | |
mxGeometry | SetGeometry (Object cell, mxGeometry geometry) |
see com.mxgraph.mxIGraphModel.SetGeometry(Object, mxGeometry) More... | |
string | GetStyle (Object cell) |
see com.mxgraph.mxIGraphModel.GetStyle(Object) More... | |
string | SetStyle (Object cell, string style) |
see com.mxgraph.mxIGraphModel.SetStyle(Object, string) More... | |
bool | IsVisible (Object cell) |
see com.mxgraph.mxIGraphModel.IsVisible(Object) More... | |
bool | SetVisible (Object cell, bool visible) |
see com.mxgraph.mxIGraphModel.SetVisible(Object, bool) More... | |
bool | IsCollapsed (Object cell) |
see com.mxgraph.mxIGraphModel.IsCollapsed(Object) More... | |
bool | SetCollapsed (Object cell, bool collapsed) |
see com.mxgraph.mxIGraphModel.SetCollapsed(Object, bool) More... | |
void | BeginUpdate () |
see com.mxgraph.mxIGraphModel.BeginUpdate() More... | |
void | EndUpdate () |
see com.mxgraph.mxIGraphModel.EndUpdate() More... | |
void | MergeChildren (mxICell from, mxICell to, bool cloneAllEdges) |
Merges the children of the given cell into the given target cell inside this model. All cells are cloned unless there is a corresponding cell in the model with the same id, in which case the source cell is ignored and all edges are connected to the corresponding cell in this model. Edges are considered to have no identity and are always cloned unless the cloneAllEdges flag is set to false, in which case edges with the same id in the target model are reconnected to reflect the terminals of the source edges. More... | |
Static Public Member Functions | |
static int | GetDirectedEdgeCount (mxIGraphModel model, Object cell, bool outgoing) |
Returns the number of incoming or outgoing edges. More... | |
static int | GetDirectedEdgeCount (mxIGraphModel model, Object cell, bool outgoing, Object ignoredEdge) |
Returns the number of incoming or outgoing edges, ignoring the given edge. More... | |
static Object[] | GetEdges (mxIGraphModel model, Object cell) |
Returns all edges connected to this cell including loops. More... | |
static Object[] | GetConnections (mxIGraphModel model, Object cell) |
Returns all edges connected to this cell without loops. More... | |
static Object[] | GetIncomingEdges (mxIGraphModel model, Object cell) |
Returns the incoming edges of the given cell without loops. More... | |
static Object[] | GetOutgoingEdges (mxIGraphModel model, Object cell) |
Returns the outgoing edges of the given cell without loops. More... | |
static Object[] | GetEdges (mxIGraphModel model, Object cell, bool incoming, bool outgoing, bool includeLoops) |
Returns all distinct edges connected to this cell. If at least one of incoming or outgoing is true, then loops are ignored, otherwise if both are false, then all edges connected to the given cell are returned including loops. More... | |
static Object[] | GetEdgesBetween (mxIGraphModel model, Object source, Object target) |
Returns all edges between the given source and target mxCells. If the optional boolean directed argument is false, then a matching edge is returned regardless of its direction. More... | |
static Object[] | GetEdgesBetween (mxIGraphModel model, Object source, Object target, bool directed) |
Returns all edges between the given source and target mxCells. If the optional boolean directed argument is false, then a matching edge is returned regardless of its direction. More... | |
static Object[] | GetOpposites (mxIGraphModel model, Object[] edges, Object terminal, bool sources, bool targets) |
Returns all opposite vertices wrt terminal for the given edges, only$ returning sources and/or targets as specified. The result is returned as an array of mxCells. More... | |
static void | SetTerminals (mxIGraphModel model, Object edge, Object source, Object target) |
Sets the source and target of the given edge in a single atomic change. More... | |
static Object[] | getChildVertices (mxIGraphModel model, Object parent) |
Returns the child vertices of the given parent. More... | |
static Object[] | getChildEdges (mxIGraphModel model, Object parent) |
Returns the child edges of the given parent. More... | |
static Object[] | getChildCells (mxIGraphModel model, Object parent, bool vertices, bool edges) |
Returns the children of the given cell that are vertices and/or edges depending on the arguments. More... | |
Protected Member Functions | |
Object | CloneCell (Object cell, Hashtable mapping, bool includeChildren) |
Inner helper method for cloning cells recursively. More... | |
void | RestoreClone (Object clone, Object cell, Hashtable mapping) |
Inner helper method for restoring the connections in a network of cloned cells. More... | |
void | CellAdded (Object cell) |
Invoked after a cell has been added to a parent. This recursively creates an Id for the new cell and/or resolves Id collisions. More... | |
void | CellRemoved (Object cell) |
Invoked after a cell has been removed from the model. This recursively removes the cell from its terminals and removes the mapping from the Id to the cell. More... | |
void | MergeChildrenImpl (mxICell from, mxICell to, bool cloneAllEdges, Dictionary< Object, Object > mapping) |
Clones 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. More... | |
Protected Attributes | |
mxICell | root |
Holds the root cell, which in turn contains the cells that represent the layers of the diagram as child cells. That is, the actual element of the diagram are supposed to live in the third generation of cells and below. More... | |
Dictionary< Object, Object > | cells |
Maps from Ids to cells. More... | |
bool | createIds = true |
Specifies if edges should automatically be moved into the nearest common ancestor of their terminals. Default is true. More... | |
bool | maintainEdgeParent = true |
Specifies if the parent of edges should be automatically change to point to the nearest common ancestor of its terminals. Default is true. More... | |
int | nextId = 0 |
Specifies the next Id to be created. Initial value is 0. More... | |
int | updateLevel = 0 |
Counter for the depth of nested transactions. Each call to beginUpdate increments this counter and each call to endUpdate decrements it. When the counter reaches 0, the transaction is closed and the respective events are fired. Initial value is 0. More... | |
Properties | |
bool | IsMaintainEdgeParent [get, set] |
Sets of returns if edges should automatically be moved into the nearest common ancestor of their terminals. More... | |
bool | IsCreateIds [get, set] |
Sets or returns if the model automatically creates Ids and resolves Id collisions. More... | |
Object | Root [get, set] |
Properties inherited from com.mxgraph.mxIGraphModel | |
Object | Root [get, set] |
Holds the root cell. More... | |
Events | |
mxGraphModelChangeEventHandler | GraphModelChange |
Fires when the graph model has changed. More... | |
Events inherited from com.mxgraph.mxIGraphModel | |
mxGraphModelChangeEventHandler | GraphModelChange |
Called when the graph model has changed. More... | |
Implements a graph model. The graph model acts as a wrapper around the cells which are in charge of storing the actual graph datastructure. The model acts as a transactional wrapper with event notification for all changes, whereas the cells contain the atomic operations for updating the actual datastructure.
|
inline |
Constructs a new empty graph model.
|
inline |
Constructs a new graph model. If no root is specified then a new root mxCell with a default layer is created.
root | Cell that represents the root cell. |
|
inline |
Adds the specified child to the parent at the given index. If no index is specified then the child is appended to the parent's array of children.
parent | Cell that specifies the parent to contain the child. |
child | Cell that specifies the child to be inserted. |
index | Integer that specifies the index of the child. |
Implements com.mxgraph.mxIGraphModel.
|
inline |
see com.mxgraph.mxIGraphModel.BeginUpdate()
Implements com.mxgraph.mxIGraphModel.
|
inlineprotected |
Invoked after a cell has been added to a parent. This recursively creates an Id for the new cell and/or resolves Id collisions.
cell | Cell that has been added. |
References com.mxgraph.mxICell.ChildCount(), com.mxgraph.mxICell.GetChildAt(), and com.mxgraph.mxICell.Id.
|
inlineprotected |
Invoked after a cell has been removed from the model. This recursively removes the cell from its terminals and removes the mapping from the Id to the cell.
cell | Cell that has been removed. |
References com.mxgraph.mxICell.ChildCount(), com.mxgraph.mxICell.GetChildAt(), com.mxgraph.mxICell.Id, and com.mxgraph.mxICell.RemoveFromTerminal().
|
inline |
Sets a new root using createRoot.
|
inlineprotected |
Inner helper method for cloning cells recursively.
References com.mxgraph.mxICell.Insert().
|
inline |
Returns an array of clones for the given array of cells. Depending on the value of includeChildren, a deep clone is created for each cell. Connections are restored based if the corresponding cell is contained in the passed in array.
cells | Array of cells to be cloned. |
includeChildren | Boolean indicating if the cells should be cloned with all descendants. |
Implements com.mxgraph.mxIGraphModel.
|
inline |
Returns true if the model contains the given cell.
cell | Cell to be checked. |
Implements com.mxgraph.mxIGraphModel.
|
inline |
Creates a new Id for the given cell and increments the global counter for creating new Ids.
cell | Cell for which a new Id should be created. |
|
inline |
Creates a new root cell with a default layer (child 0).
References com.mxgraph.mxCell.Insert().
|
inline |
see com.mxgraph.mxIGraphModel.EndUpdate()
Implements com.mxgraph.mxIGraphModel.
|
inline |
id |
|
inline |
Returns the child of the given parent at the given index.
parent | Cell that represents the parent. |
index | Integer that specifies the index of the child to be returned. |
Implements com.mxgraph.mxIGraphModel.
|
inlinestatic |
Returns the children of the given cell that are vertices and/or edges depending on the arguments.
model | Model that contains the hierarchical information. |
parent | Cell whose child vertices or edges should be returned. |
vertices | Boolean indicating if child vertices should be returned. |
edges | Boolean indicating if child edges should be returned. |
References com.mxgraph.mxIGraphModel.GetChildAt(), com.mxgraph.mxIGraphModel.GetChildCount(), com.mxgraph.mxIGraphModel.IsEdge(), and com.mxgraph.mxIGraphModel.IsVertex().
Referenced by com.mxgraph.mxGraph.GetChildCells().
|
inline |
Returns the number of children in the given cell.
cell | Cell whose number of children should be returned. |
Implements com.mxgraph.mxIGraphModel.
|
inlinestatic |
Returns the child edges of the given parent.
model | Model that contains the hierarchical information. |
parent | Cell whose child edges should be returned. |
|
inlinestatic |
Returns the child vertices of the given parent.
model | Model that contains the hierarchical information. |
parent | Cell whose child vertices should be returned. |
|
inlinestatic |
Returns all edges connected to this cell without loops.
model | Model that contains the connection information |
cell | Cell whose connections should be returned |
|
inlinestatic |
Returns the number of incoming or outgoing edges.
model | Graph model that contains the connection data. |
cell | Cell whose edges should be counted. |
outgoing | Boolean that specifies if the number of outgoing or incoming edges should be returned. |
|
inlinestatic |
Returns the number of incoming or outgoing edges, ignoring the given edge.
model | Graph model that contains the connection data. |
cell | Cell whose edges should be counted. |
outgoing | Boolean that specifies if the number of outgoing or incoming edges should be returned. |
ignoredEdge | Object that represents an edge to be ignored. |
References com.mxgraph.mxIGraphModel.GetEdgeAt(), com.mxgraph.mxIGraphModel.GetEdgeCount(), and com.mxgraph.mxIGraphModel.GetTerminal().
|
inline |
|
inline |
|
inlinestatic |
Returns all edges connected to this cell including loops.
model | Model that contains the connection information |
cell | Cell whose connections should be returned |
Referenced by com.mxgraph.mxFastOrganicLayout.execute(), and com.mxgraph.mxGraph.GetEdges().
|
inlinestatic |
Returns all distinct edges connected to this cell. If at least one of incoming or outgoing is true, then loops are ignored, otherwise if both are false, then all edges connected to the given cell are returned including loops.
model | Model that contains the connection information |
cell | Cell whose connections should be returned |
incoming | Specifies if incoming edges should be returned |
outgoing | Specifies if outgoing edges should be returned |
includeLoops | Specifies if loops should be returned |
References com.mxgraph.mxIGraphModel.GetEdgeAt(), com.mxgraph.mxIGraphModel.GetEdgeCount(), and com.mxgraph.mxIGraphModel.GetTerminal().
|
inlinestatic |
Returns all edges between the given source and target mxCells. If the optional boolean directed argument is false, then a matching edge is returned regardless of its direction.
model | |
source | |
target |
|
inlinestatic |
Returns all edges between the given source and target mxCells. If the optional boolean directed argument is false, then a matching edge is returned regardless of its direction.
model | The graph model that contains the graph. |
source | mxCell that defines the source terminal of the edge to be returned. |
target | mxCell that defines the target terminal of the edge to be returned. |
directed | Optional boolean that specifies if the direction of the edge should be taken into account. Default is true. |
References com.mxgraph.mxIGraphModel.GetEdgeAt(), com.mxgraph.mxIGraphModel.GetEdgeCount(), and com.mxgraph.mxIGraphModel.GetTerminal().
|
inline |
|
inlinestatic |
Returns the incoming edges of the given cell without loops.
model | Graphmodel that contains the edges |
cell | Cell whose incoming edges should be returned |
|
inline |
Returns the nearest common ancestor for the specified cells.
cell1 | Cell that specifies the first cell in the tree. |
cell2 | Cell that specifies the second cell in the tree. |
References com.mxgraph.mxCellPath.Create(), com.mxgraph.mxCellPath.GetParentPath(), and com.mxgraph.mxCellPath.PATH_SEPARATOR.
|
inlinestatic |
Returns all opposite vertices wrt terminal for the given edges, only$ returning sources and/or targets as specified. The result is returned as an array of mxCells.
model | Model that contains the graph. |
edges | Array of edges to be examined. |
terminal | Cell that specifies the known end of the edges. |
sources | Boolean that specifies if source terminals should be contained in the result. Default is true. |
targets | Boolean that specifies if target terminals should be contained in the result. Default is true. |
References com.mxgraph.mxIGraphModel.GetTerminal().
Referenced by com.mxgraph.mxFastOrganicLayout.execute().
|
inline |
Returns the absolute, cummulated origin for the children inside the given parent.
References com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inlinestatic |
Returns the outgoing edges of the given cell without loops.
model | Graphmodel that contains the edges |
cell | Cell whose outgoing edges should be returned |
|
inline |
Returns the parent of the given cell.
child | Cell whose parent should be returned. |
Implements com.mxgraph.mxIGraphModel.
|
inline |
see com.mxgraph.mxIGraphModel.GetStyle(Object)
Implements com.mxgraph.mxIGraphModel.
|
inline |
Returns the source or target terminal of the given edge depending on the value of the boolean parameter.
edge | Cell that specifies the edge. |
source | Boolean indicating which end of the edge should be returned. |
Implements com.mxgraph.mxIGraphModel.
|
inline |
see com.mxgraph.mxIGraphModel.GetValue(Object)
Implements com.mxgraph.mxIGraphModel.
|
inline |
Returns true if the given parent is an ancestor of child.
parent | Cell that specifies the parent. |
child | Cell that specifies the child. |
Implements com.mxgraph.mxIGraphModel.
|
inline |
|
inline |
|
inline |
see com.mxgraph.mxIGraphModel.IsEdge(Object)
Implements com.mxgraph.mxIGraphModel.
|
inline |
see com.mxgraph.mxIGraphModel.IsVertex(Object)
Implements com.mxgraph.mxIGraphModel.
|
inline |
see com.mxgraph.mxIGraphModel.IsVisible(Object)
Implements com.mxgraph.mxIGraphModel.
Merges the children of the given cell into the given target cell inside this model. All cells are cloned unless there is a corresponding cell in the model with the same id, in which case the source cell is ignored and all edges are connected to the corresponding cell in this model. Edges are considered to have no identity and are always cloned unless the cloneAllEdges flag is set to false, in which case edges with the same id in the target model are reconnected to reflect the terminals of the source edges.
from | |
to | |
cloneAllEdges |
|
inlineprotected |
Clones 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.
from | |
to | |
cloneAllEdges | |
mapping |
References com.mxgraph.mxICell.ChildCount(), com.mxgraph.mxICell.Clone(), com.mxgraph.mxICell.GetChildAt(), com.mxgraph.mxICell.Id, and com.mxgraph.mxICell.Insert().
|
inline |
see com.mxgraph.mxIGraphModel.Remove(Object)
cell |
Implements com.mxgraph.mxIGraphModel.
References com.mxgraph.mxICell.RemoveFromParent().
|
inlineprotected |
Inner helper method for restoring the connections in a network of cloned cells.
References com.mxgraph.mxICell.InsertEdge().
|
inline |
|
inline |
|
inline |
|
inline |
Sets the source or target terminal of the given edge using.
edge | Cell that specifies the edge. |
terminal | Cell that specifies the new terminal. |
source | Boolean indicating if the terminal is the new source or target terminal of the edge. |
Implements com.mxgraph.mxIGraphModel.
References com.mxgraph.mxICell.GetTerminal(), and com.mxgraph.mxICell.RemoveEdge().
|
inlinestatic |
Sets the source and target of the given edge in a single atomic change.
model | Model that contains the graph. |
edge | Cell that specifies the edge. |
source | Cell that specifies the new source terminal. |
target | Cell that specifies the new target terminal. |
References com.mxgraph.mxIGraphModel.BeginUpdate(), com.mxgraph.mxIGraphModel.EndUpdate(), and com.mxgraph.mxIGraphModel.SetTerminal().
|
inline |
|
inline |
|
inline |
Inner helper method to update the parent of the specified edge to the nearest-common-ancestor of its two terminals.
edge | Specifies the edge to be updated. |
root | Current root of the model. |
References com.mxgraph.mxGeometry.Clone(), com.mxgraph.mxGeometry.Translate(), com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Updates the parents of the edges connected to the given cell and all its descendants so that each edge is contained in the nearest common ancestor.
cell | Cell whose edges should be checked and updated. |
|
inline |
Updates the parents of the edges connected to the given cell and all its descendants so that the edge is contained in the nearest-common-ancestor.
cell | Cell whose edges should be checked and updated. |
root | Root of the cell hierarchy that contains all cells. |
|
protected |
Maps from Ids to cells.
|
protected |
Specifies if edges should automatically be moved into the nearest common ancestor of their terminals. Default is true.
|
protected |
Specifies if the parent of edges should be automatically change to point to the nearest common ancestor of its terminals. Default is true.
|
protected |
Specifies the next Id to be created. Initial value is 0.
|
protected |
Holds the root cell, which in turn contains the cells that represent the layers of the diagram as child cells. That is, the actual element of the diagram are supposed to live in the third generation of cells and below.
|
protected |
Counter for the depth of nested transactions. Each call to beginUpdate increments this counter and each call to endUpdate decrements it. When the counter reaches 0, the transaction is closed and the respective events are fired. Initial value is 0.
|
getset |
Sets or returns if the model automatically creates Ids and resolves Id collisions.
|
getset |
Sets of returns if edges should automatically be moved into the nearest common ancestor of their terminals.
mxGraphModelChangeEventHandler com.mxgraph.mxGraphModel.GraphModelChange |
Fires when the graph model has changed.