mxGraph
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Events | List of all members
com.mxgraph.mxGraphModel Class Reference

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...

Inheritance diagram for com.mxgraph.mxGraphModel:
com.mxgraph.mxIGraphModel

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ mxGraphModel() [1/2]

com.mxgraph.mxGraphModel.mxGraphModel ( )
inline

Constructs a new empty graph model.

◆ mxGraphModel() [2/2]

com.mxgraph.mxGraphModel.mxGraphModel ( Object  root)
inline

Constructs a new graph model. If no root is specified then a new root mxCell with a default layer is created.

Parameters
rootCell that represents the root cell.

Member Function Documentation

◆ Add()

Object com.mxgraph.mxGraphModel.Add ( Object  parent,
Object  child,
int  index 
)
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.

Parameters
parentCell that specifies the parent to contain the child.
childCell that specifies the child to be inserted.
indexInteger that specifies the index of the child.
Returns
Returns the inserted child.

Implements com.mxgraph.mxIGraphModel.

◆ BeginUpdate()

void com.mxgraph.mxGraphModel.BeginUpdate ( )
inline

◆ CellAdded()

void com.mxgraph.mxGraphModel.CellAdded ( Object  cell)
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.

Parameters
cellCell that has been added.

References com.mxgraph.mxICell.ChildCount(), com.mxgraph.mxICell.GetChildAt(), and com.mxgraph.mxICell.Id.

◆ CellRemoved()

void com.mxgraph.mxGraphModel.CellRemoved ( Object  cell)
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.

Parameters
cellCell that has been removed.

References com.mxgraph.mxICell.ChildCount(), com.mxgraph.mxICell.GetChildAt(), com.mxgraph.mxICell.Id, and com.mxgraph.mxICell.RemoveFromTerminal().

◆ Clear()

void com.mxgraph.mxGraphModel.Clear ( )
inline

Sets a new root using createRoot.

◆ CloneCell()

Object com.mxgraph.mxGraphModel.CloneCell ( Object  cell,
Hashtable  mapping,
bool  includeChildren 
)
inlineprotected

Inner helper method for cloning cells recursively.

References com.mxgraph.mxICell.Insert().

◆ CloneCells()

Object [] com.mxgraph.mxGraphModel.CloneCells ( Object []  cells,
bool  includeChildren 
)
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.

Parameters
cellsArray of cells to be cloned.
includeChildrenBoolean indicating if the cells should be cloned with all descendants.
Returns
Returns a cloned array of cells.

Implements com.mxgraph.mxIGraphModel.

◆ Contains()

bool com.mxgraph.mxGraphModel.Contains ( Object  cell)
inline

Returns true if the model contains the given cell.

Parameters
cellCell to be checked.
Returns
Returns true if the cell is in the model.

Implements com.mxgraph.mxIGraphModel.

◆ CreateId()

string com.mxgraph.mxGraphModel.CreateId ( Object  cell)
inline

Creates a new Id for the given cell and increments the global counter for creating new Ids.

Parameters
cellCell for which a new Id should be created.
Returns
Returns a new Id for the given cell.

◆ CreateRoot()

Object com.mxgraph.mxGraphModel.CreateRoot ( )
inline

Creates a new root cell with a default layer (child 0).

References com.mxgraph.mxCell.Insert().

◆ EndUpdate()

void com.mxgraph.mxGraphModel.EndUpdate ( )
inline

◆ GetCell()

Object com.mxgraph.mxGraphModel.GetCell ( string  id)
inline

Parameters
id
Returns

◆ GetChildAt()

Object com.mxgraph.mxGraphModel.GetChildAt ( Object  parent,
int  index 
)
inline

Returns the child of the given parent at the given index.

Parameters
parentCell that represents the parent.
indexInteger that specifies the index of the child to be returned.
Returns
Returns the child at index in parent.

Implements com.mxgraph.mxIGraphModel.

◆ getChildCells()

static Object [] com.mxgraph.mxGraphModel.getChildCells ( mxIGraphModel  model,
Object  parent,
bool  vertices,
bool  edges 
)
inlinestatic

Returns the children of the given cell that are vertices and/or edges depending on the arguments.

Parameters
modelModel that contains the hierarchical information.
parentCell whose child vertices or edges should be returned.
verticesBoolean indicating if child vertices should be returned.
edgesBoolean indicating if child edges should be returned.
Returns
Returns the child vertices and/or edges of the given parent.

References com.mxgraph.mxIGraphModel.GetChildAt(), com.mxgraph.mxIGraphModel.GetChildCount(), com.mxgraph.mxIGraphModel.IsEdge(), and com.mxgraph.mxIGraphModel.IsVertex().

Referenced by com.mxgraph.mxGraph.GetChildCells().

◆ GetChildCount()

int com.mxgraph.mxGraphModel.GetChildCount ( Object  cell)
inline

Returns the number of children in the given cell.

Parameters
cellCell whose number of children should be returned.
Returns
Returns the number of children in the given cell.

Implements com.mxgraph.mxIGraphModel.

◆ getChildEdges()

static Object [] com.mxgraph.mxGraphModel.getChildEdges ( mxIGraphModel  model,
Object  parent 
)
inlinestatic

Returns the child edges of the given parent.

Parameters
modelModel that contains the hierarchical information.
parentCell whose child edges should be returned.
Returns
Returns the child edges of the given parent.

◆ getChildVertices()

static Object [] com.mxgraph.mxGraphModel.getChildVertices ( mxIGraphModel  model,
Object  parent 
)
inlinestatic

Returns the child vertices of the given parent.

Parameters
modelModel that contains the hierarchical information.
parentCell whose child vertices should be returned.
Returns
Returns the child vertices of the given parent.

◆ GetConnections()

static Object [] com.mxgraph.mxGraphModel.GetConnections ( mxIGraphModel  model,
Object  cell 
)
inlinestatic

Returns all edges connected to this cell without loops.

Parameters
modelModel that contains the connection information
cellCell whose connections should be returned
Returns
Returns the array of connected edges for the given cell

◆ GetDirectedEdgeCount() [1/2]

static int com.mxgraph.mxGraphModel.GetDirectedEdgeCount ( mxIGraphModel  model,
Object  cell,
bool  outgoing 
)
inlinestatic

Returns the number of incoming or outgoing edges.

Parameters
modelGraph model that contains the connection data.
cellCell whose edges should be counted.
outgoingBoolean that specifies if the number of outgoing or incoming edges should be returned.
Returns
Returns the number of incoming or outgoing edges.

◆ GetDirectedEdgeCount() [2/2]

static int com.mxgraph.mxGraphModel.GetDirectedEdgeCount ( mxIGraphModel  model,
Object  cell,
bool  outgoing,
Object  ignoredEdge 
)
inlinestatic

Returns the number of incoming or outgoing edges, ignoring the given edge.

Parameters
modelGraph model that contains the connection data.
cellCell whose edges should be counted.
outgoingBoolean that specifies if the number of outgoing or incoming edges should be returned.
ignoredEdgeObject that represents an edge to be ignored.
Returns
Returns the number of incoming or outgoing edges.

References com.mxgraph.mxIGraphModel.GetEdgeAt(), com.mxgraph.mxIGraphModel.GetEdgeCount(), and com.mxgraph.mxIGraphModel.GetTerminal().

◆ GetEdgeAt()

Object com.mxgraph.mxGraphModel.GetEdgeAt ( Object  parent,
int  index 
)
inline

◆ GetEdgeCount()

int com.mxgraph.mxGraphModel.GetEdgeCount ( Object  cell)
inline

◆ GetEdges() [1/2]

static Object [] com.mxgraph.mxGraphModel.GetEdges ( mxIGraphModel  model,
Object  cell 
)
inlinestatic

Returns all edges connected to this cell including loops.

Parameters
modelModel that contains the connection information
cellCell whose connections should be returned
Returns

Referenced by com.mxgraph.mxFastOrganicLayout.execute(), and com.mxgraph.mxGraph.GetEdges().

◆ GetEdges() [2/2]

static Object [] com.mxgraph.mxGraphModel.GetEdges ( mxIGraphModel  model,
Object  cell,
bool  incoming,
bool  outgoing,
bool  includeLoops 
)
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.

Parameters
modelModel that contains the connection information
cellCell whose connections should be returned
incomingSpecifies if incoming edges should be returned
outgoingSpecifies if outgoing edges should be returned
includeLoopsSpecifies if loops should be returned
Returns
Returns the array of connected edges for the given cell

References com.mxgraph.mxIGraphModel.GetEdgeAt(), com.mxgraph.mxIGraphModel.GetEdgeCount(), and com.mxgraph.mxIGraphModel.GetTerminal().

◆ GetEdgesBetween() [1/2]

static Object [] com.mxgraph.mxGraphModel.GetEdgesBetween ( mxIGraphModel  model,
Object  source,
Object  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.

Parameters
model
source
target
Returns

◆ GetEdgesBetween() [2/2]

static Object [] com.mxgraph.mxGraphModel.GetEdgesBetween ( mxIGraphModel  model,
Object  source,
Object  target,
bool  directed 
)
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.

Parameters
modelThe graph model that contains the graph.
sourcemxCell that defines the source terminal of the edge to be returned.
targetmxCell that defines the target terminal of the edge to be returned.
directedOptional boolean that specifies if the direction of the edge should be taken into account. Default is true.
Returns

References com.mxgraph.mxIGraphModel.GetEdgeAt(), com.mxgraph.mxIGraphModel.GetEdgeCount(), and com.mxgraph.mxIGraphModel.GetTerminal().

◆ GetGeometry()

mxGeometry com.mxgraph.mxGraphModel.GetGeometry ( Object  cell)
inline

◆ GetIncomingEdges()

static Object [] com.mxgraph.mxGraphModel.GetIncomingEdges ( mxIGraphModel  model,
Object  cell 
)
inlinestatic

Returns the incoming edges of the given cell without loops.

Parameters
modelGraphmodel that contains the edges
cellCell whose incoming edges should be returned
Returns
Returns the incoming edges for the given cell

◆ GetNearestCommonAncestor()

Object com.mxgraph.mxGraphModel.GetNearestCommonAncestor ( Object  cell1,
Object  cell2 
)
inline

Returns the nearest common ancestor for the specified cells.

Parameters
cell1Cell that specifies the first cell in the tree.
cell2Cell that specifies the second cell in the tree.
Returns
Returns the nearest common ancestor of the given cells.

References com.mxgraph.mxCellPath.Create(), com.mxgraph.mxCellPath.GetParentPath(), and com.mxgraph.mxCellPath.PATH_SEPARATOR.

◆ GetOpposites()

static Object [] com.mxgraph.mxGraphModel.GetOpposites ( mxIGraphModel  model,
Object []  edges,
Object  terminal,
bool  sources,
bool  targets 
)
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.

Parameters
modelModel that contains the graph.
edgesArray of edges to be examined.
terminalCell that specifies the known end of the edges.
sourcesBoolean that specifies if source terminals should be contained in the result. Default is true.
targetsBoolean that specifies if target terminals should be contained in the result. Default is true.
Returns
Returns the array of opposite terminals for the given edges.

References com.mxgraph.mxIGraphModel.GetTerminal().

Referenced by com.mxgraph.mxFastOrganicLayout.execute().

◆ GetOrigin()

mxPoint com.mxgraph.mxGraphModel.GetOrigin ( Object  cell)
inline

Returns the absolute, cummulated origin for the children inside the given parent.

References com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.

◆ GetOutgoingEdges()

static Object [] com.mxgraph.mxGraphModel.GetOutgoingEdges ( mxIGraphModel  model,
Object  cell 
)
inlinestatic

Returns the outgoing edges of the given cell without loops.

Parameters
modelGraphmodel that contains the edges
cellCell whose outgoing edges should be returned
Returns
Returns the outgoing edges for the given cell

◆ GetParent()

Object com.mxgraph.mxGraphModel.GetParent ( Object  child)
inline

Returns the parent of the given cell.

Parameters
childCell whose parent should be returned.
Returns
Returns the parent of the given cell.

Implements com.mxgraph.mxIGraphModel.

◆ GetStyle()

string com.mxgraph.mxGraphModel.GetStyle ( Object  cell)
inline

◆ GetTerminal()

Object com.mxgraph.mxGraphModel.GetTerminal ( Object  edge,
bool  source 
)
inline

Returns the source or target terminal of the given edge depending on the value of the boolean parameter.

Parameters
edgeCell that specifies the edge.
sourceBoolean indicating which end of the edge should be returned.
Returns
Returns the source or target of the given edge.

Implements com.mxgraph.mxIGraphModel.

◆ GetValue()

Object com.mxgraph.mxGraphModel.GetValue ( Object  cell)
inline

◆ IsAncestor()

bool com.mxgraph.mxGraphModel.IsAncestor ( Object  parent,
Object  child 
)
inline

Returns true if the given parent is an ancestor of child.

Parameters
parentCell that specifies the parent.
childCell that specifies the child.
Returns
Returns true if child is an ancestor of parent.

Implements com.mxgraph.mxIGraphModel.

◆ IsCollapsed()

bool com.mxgraph.mxGraphModel.IsCollapsed ( Object  cell)
inline

◆ IsConnectable()

bool com.mxgraph.mxGraphModel.IsConnectable ( Object  cell)
inline

◆ IsEdge()

bool com.mxgraph.mxGraphModel.IsEdge ( Object  cell)
inline

◆ IsVertex()

bool com.mxgraph.mxGraphModel.IsVertex ( Object  cell)
inline

◆ IsVisible()

bool com.mxgraph.mxGraphModel.IsVisible ( Object  cell)
inline

◆ MergeChildren()

void com.mxgraph.mxGraphModel.MergeChildren ( mxICell  from,
mxICell  to,
bool  cloneAllEdges 
)
inline

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.

Parameters
from
to
cloneAllEdges

◆ MergeChildrenImpl()

void com.mxgraph.mxGraphModel.MergeChildrenImpl ( mxICell  from,
mxICell  to,
bool  cloneAllEdges,
Dictionary< Object, Object >  mapping 
)
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.

Parameters
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().

◆ Remove()

Object com.mxgraph.mxGraphModel.Remove ( Object  cell)
inline

◆ RestoreClone()

void com.mxgraph.mxGraphModel.RestoreClone ( Object  clone,
Object  cell,
Hashtable  mapping 
)
inlineprotected

Inner helper method for restoring the connections in a network of cloned cells.

References com.mxgraph.mxICell.InsertEdge().

◆ SetCollapsed()

bool com.mxgraph.mxGraphModel.SetCollapsed ( Object  cell,
bool  collapsed 
)
inline

◆ SetGeometry()

mxGeometry com.mxgraph.mxGraphModel.SetGeometry ( Object  cell,
mxGeometry  geometry 
)
inline

◆ SetStyle()

string com.mxgraph.mxGraphModel.SetStyle ( Object  cell,
string  style 
)
inline

◆ SetTerminal()

Object com.mxgraph.mxGraphModel.SetTerminal ( Object  edge,
Object  terminal,
bool  source 
)
inline

Sets the source or target terminal of the given edge using.

Parameters
edgeCell that specifies the edge.
terminalCell that specifies the new terminal.
sourceBoolean 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().

◆ SetTerminals()

static void com.mxgraph.mxGraphModel.SetTerminals ( mxIGraphModel  model,
Object  edge,
Object  source,
Object  target 
)
inlinestatic

Sets the source and target of the given edge in a single atomic change.

Parameters
modelModel that contains the graph.
edgeCell that specifies the edge.
sourceCell that specifies the new source terminal.
targetCell that specifies the new target terminal.

References com.mxgraph.mxIGraphModel.BeginUpdate(), com.mxgraph.mxIGraphModel.EndUpdate(), and com.mxgraph.mxIGraphModel.SetTerminal().

◆ SetValue()

Object com.mxgraph.mxGraphModel.SetValue ( Object  cell,
Object  value 
)
inline

◆ SetVisible()

bool com.mxgraph.mxGraphModel.SetVisible ( Object  cell,
bool  visible 
)
inline

◆ UpdateEdgeParent()

void com.mxgraph.mxGraphModel.UpdateEdgeParent ( Object  edge,
Object  root 
)
inline

Inner helper method to update the parent of the specified edge to the nearest-common-ancestor of its two terminals.

Parameters
edgeSpecifies the edge to be updated.
rootCurrent root of the model.

References com.mxgraph.mxGeometry.Clone(), com.mxgraph.mxGeometry.Translate(), com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.

◆ UpdateEdgeParents() [1/2]

void com.mxgraph.mxGraphModel.UpdateEdgeParents ( Object  cell)
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.

Parameters
cellCell whose edges should be checked and updated.

◆ UpdateEdgeParents() [2/2]

void com.mxgraph.mxGraphModel.UpdateEdgeParents ( Object  cell,
Object  root 
)
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.

Parameters
cellCell whose edges should be checked and updated.
rootRoot of the cell hierarchy that contains all cells.

Member Data Documentation

◆ cells

Dictionary<Object, Object> com.mxgraph.mxGraphModel.cells
protected

Maps from Ids to cells.

◆ createIds

bool com.mxgraph.mxGraphModel.createIds = true
protected

Specifies if edges should automatically be moved into the nearest common ancestor of their terminals. Default is true.

◆ maintainEdgeParent

bool com.mxgraph.mxGraphModel.maintainEdgeParent = 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.

◆ nextId

int com.mxgraph.mxGraphModel.nextId = 0
protected

Specifies the next Id to be created. Initial value is 0.

◆ root

mxICell com.mxgraph.mxGraphModel.root
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.

◆ updateLevel

int com.mxgraph.mxGraphModel.updateLevel = 0
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.

Property Documentation

◆ IsCreateIds

bool com.mxgraph.mxGraphModel.IsCreateIds
getset

Sets or returns if the model automatically creates Ids and resolves Id collisions.

◆ IsMaintainEdgeParent

bool com.mxgraph.mxGraphModel.IsMaintainEdgeParent
getset

Sets of returns if edges should automatically be moved into the nearest common ancestor of their terminals.

Event Documentation

◆ GraphModelChange

mxGraphModelChangeEventHandler com.mxgraph.mxGraphModel.GraphModelChange

Fires when the graph model has changed.


The documentation for this class was generated from the following file: