GeezerVison is showing maxgraph.github.io — GraphAbstractHierarchyCell | @maxgraph/core
- GraphAbstractHierarchyCell
Class GraphAbstractHierarchyCellAbstract
An abstraction of an internal hierarchy node or edge.
- Cell
- GraphAbstractHierarchyCell
Constructors
constructor
-
new GraphAbstractHierarchyCell(): GraphAbstractHierarchyCell
Returns GraphAbstractHierarchyCell
Properties
collapsed
collapsed: boolean = false
Specifies whether the cell is collapsed.
connectable
connectable: boolean = true
Specifies whether the cell is connectable.
edge
edge: boolean = false
Specifies whether the cell is an edge.
height
height: number = 0
The height of this cell. Default is 0.
id
id: string | null = null
Holds the identifier of the Cell.
invalidating
invalidating: boolean = false
maxRank
maxRank: number = -1
The maximum rank this cell occupies. Default is -1.
minRank
minRank: number = -1
The minimum rank this cell occupies. Default is -1.
mxTransient
mxTransient: string[] = ...
List of members that should not be cloned inside clone. This field is
passed to utils.clone and is not made persistent in CellCodec.
This is not a convention for all classes, it is only used in this class
to mark transient fields since transient modifiers are not supported by
the language.
nextLayerConnectedCells
nextLayerConnectedCells: { [key: number]: GraphAbstractHierarchyCell[] } | null = null
A cached version of the cells this cell connects to on the next layer up
onInit
onInit: (() => void) | null = null
parent
parent: Cell | null = null
Reference to the parent cell.
previousLayerConnectedCells
previousLayerConnectedCells:
| { [key: number]: GraphAbstractHierarchyCell[] }
| null = null
A cached version of the cells this cell connects to on the next layer down
source
source: Cell | null = null
Reference to the source terminal.
style
Holds the style of the Cell.
swimlaneIndex
swimlaneIndex: number | null = null
target
target: Cell | null = null
Reference to the target terminal.
temp
temp: number[]
Temporary variable for general use. Generally, try to avoid
carrying information between stages. Currently, the longest
path layering sets temp to the rank position in fixRanks()
and the crossing reduction uses this. This meant temp couldn't
be used for hashing the nodes in the model dfs and so hashCode
was created
vertex
vertex: boolean = false
Specifies whether the cell is a vertex.
visible
visible: boolean = true
Specifies whether the cell is visible.
width
width: number = 0
The width of this cell. Default is 0.
x
x: number[]
The x position of this cell for each layer it occupies
y
y: number[]
The y position of this cell for each layer it occupies
Methods
clone
-
Returns a clone of the cell.
Uses cloneValue to clone the user object.
All fields in mxTransient are ignored during the cloning.
cloneValue
-
Returns a clone of the cell's user object.
Returns any
filterDescendants
-
Visits all cells recursively and applies the specified filter function
to each cell. If the function returns true then the cell is added
to the resulting array. The parent and result paramters are optional.
If parent is not specified then the recursion starts at root.
Example:
The following example extracts all vertices from a given model:
var filter(cell)
{
return model.isVertex(cell);
}
var vertices = model.filterDescendants(filter);
Parameters
- filter: FilterFunction | null
JavaScript function that takes an Cell as an argument
and returns a boolean.
Returns Cell[]
getAttribute
-
getAttribute(name: string, defaultValue?: any): any
Returns the specified attribute from the user object if it is an XML node.
Parameters
- name: string
Name of the attribute whose value should be returned.
OptionaldefaultValue: any
Optional default value to use if the attribute has no
value.
Returns any
getChildAt
-
getChildAt(index: number): Cell
Returns the child at the specified index.
Parameters
- index: number
Integer that specifies the child to be returned.
getChildCells
-
getChildCells(vertices?: boolean, edges?: boolean): Cell[]
Returns the children of the given cell that are vertices and/or edges
depending on the arguments.
Parameters
- vertices: boolean = false
Boolean indicating if child vertices should be returned.
Default is false.
- edges: boolean = false
Boolean indicating if child edges should be returned.
Default is false.
Returns Cell[]
getChildCount
-
Returns the number of child cells.
Returns number
getChildEdges
-
Returns the child edges of the given parent.
Returns Cell[]
getChildVertices
-
getChildVertices(): Cell[]
Returns the child vertices of the given parent.
Returns Cell[]
getClonedStyle
-
Use this method to get the style object to later update it and propagate changes to the view.
See GraphDataModel.setStyle for more details.
getConnections
-
Returns all edges of the given cell without loops.
Returns Cell[]
getDescendants
-
Returns all descendants of the given cell and the cell itself in an array.
Returns Cell[]
getDirectedEdgeCount
-
getDirectedEdgeCount(outgoing: boolean, ignoredEdge?: Cell | null): number
Returns the number of incoming or outgoing edges, ignoring the given
edge.
Parameters
- outgoing: boolean
Boolean that specifies if the number of outgoing or
incoming edges should be returned.
- ignoredEdge: Cell | null = null
that represents an edge to be ignored.
Returns number
getEdgeAt
-
getEdgeAt(index: number): Cell
Returns the edge at the specified index in edges.
Parameters
- index: number
Integer that specifies the index of the edge to be returned.
getEdgeCount
-
Returns the number of edges in the edge array.
Returns number
getEdgeIndex
-
getEdgeIndex(edge: Cell): number
Returns the index of the specified edge in edges.
Returns number
getEdges
-
getEdges(incoming?: boolean, outgoing?: boolean, includeLoops?: boolean): Cell[]
Returns all distinct edges connected to this cell as a new array of
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
- incoming: boolean = true
Optional boolean that specifies if incoming edges should be
returned. Default is true.
- outgoing: boolean = true
Optional boolean that specifies if outgoing edges should be
returned. Default is true.
- includeLoops: boolean = true
Optional boolean that specifies if loops should be returned.
Default is true.
Returns Cell[]
AbstractgetGeneralPurposeVariable
-
getGeneralPurposeVariable(layer: number): number | null
Gets the value of temp for the specified layer
Returns number | null
getId
-
Returns the Id of the cell as a string.
Returns string | null
getIncomingEdges
-
getIncomingEdges(): Cell[]
Returns the incoming edges of the given cell without loops.
Returns Cell[]
getIndex
-
getIndex(child: Cell | null): number
Returns the index of the specified child in the child array.
Parameters
- child: Cell | null
Child whose index should be returned.
Returns number
getNearestCommonAncestor
-
getNearestCommonAncestor(cell2: Cell): Cell | null
Returns the nearest common ancestor for the specified cells to this.
Parameters
- cell2: Cell
that specifies the second cell in the tree.
Returns Cell | null
AbstractgetNextLayerConnectedCells
-
getNextLayerConnectedCells(layer: number): GraphAbstractHierarchyCell
[] | null
Returns the cells this cell connects to on the next layer up
Returns GraphAbstractHierarchyCell[] | null
getOrigin
-
Returns the absolute, accumulated origin for the children inside the
given parent as an Point.
getOutgoingEdges
-
getOutgoingEdges(): Cell[]
Returns the outgoing edges of the given cell without loops.
Returns Cell[]
getParent
-
Returns the cell's parent.
Returns Cell | null
AbstractgetPreviousLayerConnectedCells
-
getPreviousLayerConnectedCells( layer: number,): GraphAbstractHierarchyCell
[] | null
Returns the cells this cell connects to on the next layer down
Returns GraphAbstractHierarchyCell[] | null
getRoot
-
Returns the root of the model or the topmost parent of the given cell.
getStyle
-
Returns a string that describes the style.
IMPORTANT: if you want to get the style object to later update it and propagate changes to the view, use getClonedStyle instead.
getTerminal
-
getTerminal(source?: boolean): Cell | null
Returns the source or target terminal.
Parameters
- source: boolean = false
Boolean that specifies if the source terminal should be
returned.
Returns Cell | null
getValue
-
Returns the user object of the cell. The user object is stored in value.
Returns any
getX
-
getX(layer: number): number
Gets the value of x on the specified layer
Returns number
hasAttribute
-
hasAttribute(name: string): boolean
Returns true if the user object is an XML node that contains the given attribute.
Parameters
- name: string
Name nameName of the attribute.
Returns boolean
insert
-
insert(child: Cell, index?: number): Cell | null
Inserts the specified child into the child array at the specified index and updates the parent reference of the child.
If not index is specified, then the child is appended to the child array.
Returns the inserted child.
Parameters
- child: Cell
Cell to be inserted or appended to the child array.
Optionalindex: number
Optional integer that specifies the index at which the child should be inserted into the child array.
Returns Cell | null
insertEdge
-
insertEdge(edge: Cell, isOutgoing?: boolean): Cell
Inserts the specified edge into the edge array and returns the edge.
Will update the respective terminal reference of the edge.
Parameters
- edge: Cell
Cell to be inserted into the edge array.
- isOutgoing: boolean = false
Boolean that specifies if the edge is outgoing.
isAncestor
-
isAncestor(child: Cell | null): boolean
Returns true if the given parent is an ancestor of the given child. Note
returns true if child == parent.
Parameters
- child: Cell | null
that specifies the child.
Returns boolean
isCollapsed
-
Returns true if the cell is collapsed.
Returns boolean
isConnectable
-
Returns true if the cell is connectable.
Returns boolean
isEdge
-
Returns whether or not this cell is an edge
Returns boolean
isVertex
-
Returns whether or not this cell is a node
Returns boolean
isVisible
-
Returns true if the cell is visibile.
Returns boolean
remove
-
remove(index: number): Cell | null
Removes the child at the specified index from the child array and returns the child that was removed.
Will remove the parent reference of the child.
Parameters
- index: number
Integer that specifies the index of the child to be removed.
Returns Cell | null
removeEdge
-
removeEdge(edge: Cell | null, isOutgoing?: boolean): Cell | null
Removes the specified edge from the edge array and returns the edge.
Will remove the respective terminal reference from the edge.
Parameters
- edge: Cell | null
Cell to be removed from the edge array.
- isOutgoing: boolean = false
Boolean that specifies if the edge is outgoing.
Returns Cell | null
removeFromParent
-
Removes the cell from its parent.
Returns void
removeFromTerminal
-
removeFromTerminal(isSource: boolean): void
Removes the edge from its source or target terminal.
Parameters
- isSource: boolean
Boolean that specifies if the edge should be removed from its source or target terminal.
Returns void
setAttribute
-
setAttribute(name: string, value: any): void
Sets the specified attribute on the user object if it is an XML node.
Parameters
- name: string
Name of the attribute whose value should be set.
- value: any
New value of the attribute.
Returns void
setCollapsed
-
setCollapsed(collapsed: boolean): void
Sets the collapsed state.
Parameters
- collapsed: boolean
Boolean that specifies the new collapsed state.
Returns void
setConnectable
-
setConnectable(connectable: boolean): void
Sets the connectable state.
Parameters
- connectable: boolean
Boolean that specifies the new connectable state.
Returns void
setEdge
-
setEdge(edge: boolean): void
Specifies if the cell is an edge. This should only be assigned at
construction of the cell and not be changed during its lifecycle.
Parameters
- edge: boolean
Boolean that specifies if the cell is an edge.
Returns void
AbstractsetGeneralPurposeVariable
-
setGeneralPurposeVariable(layer: number, value: number): void
Set the value of temp for the specified layer
Parameters
- layer: number
- value: number
Returns void
setGeometry
-
setGeometry(geometry: Geometry | null): void
setId
-
Sets the Id of the cell to the given string.
Returns void
setParent
-
setParent(parent: Cell | null): void
setStyle
-
Sets the string to be used as the style.
Returns void
setTerminal
-
setTerminal(terminal: Cell | null, isSource: boolean): Cell | null
Sets the source or target terminal and returns the new terminal.
Parameters
- terminal: Cell | null
Cell that represents the new source or target terminal.
- isSource: boolean
boolean that specifies if the source or target terminal should be set.
Returns Cell | null
setValue
-
setValue(value: any): void
Sets the user object of the cell. The user object is stored in value.
Returns void
setVertex
-
setVertex(vertex: boolean): void
Specifies if the cell is a vertex. This should only be assigned at
construction of the cell and not be changed during its lifecycle.
Parameters
- vertex: boolean
Boolean that specifies if the cell is a vertex.
Returns void
setVisible
-
setVisible(visible: boolean): void
Specifies if the cell is visible.
Parameters
- visible: boolean
Boolean that specifies the new visible state.
Returns void
setX
-
setX(layer: number, value: number): void
Set the value of x for the specified layer
Parameters
- layer: number
- value: number
Returns void
setY
-
setY(layer: number, value: number): void
Set the value of y for the specified layer
Parameters
- layer: number
- value: number
Returns void
valueChanged
-
valueChanged(newValue: any): any
Changes the user object after an in-place edit
and returns the previous value. This implementation
replaces the user object with the given value and
returns the old user object.
Returns any
On This Page
Constructors
Properties
Methods