Package | com.yworks.graph.model |
Class | public class NodeHierarchy |
Inheritance | NodeHierarchy Object |
LayoutGraph
.
Internally, the hierarchy is managed using data providers that can be obtained from the graph using the following keys:
See also
Method | Defined By | ||
---|---|---|---|
enableGrouping(graph:Graph):void [static]
Adds the DataProviders that are required for working with hierarchic layout graphs, namely:
GroupingKeys.GROUP_DPKEY
GroupingKeys.PARENT_NODE_ID_DPKEY
GroupingKeys.NODE_ID_DPKEY
and calls transferMapperIDs. | NodeHierarchy | ||
[static]
Returns a list of all child nodes of the given parent node. | NodeHierarchy | ||
[static]
Returns a list containing the given node and all its neighbor nodes. | NodeHierarchy | ||
[static]
Returns a node list that allows for breadth-first iteration over the node hierarchy of the provided graph. | NodeHierarchy | ||
[static]
Get the parent node of the provided node. | NodeHierarchy | ||
[static]
Returns a cursor over all top level nodes of the provided graph, i.e., all
nodes for which NodeHierarchy.getParent( node ) yields null. | NodeHierarchy | ||
isGroupNode(node:Node):Boolean [static]
Whether the given node is considered a group node. | NodeHierarchy | ||
[static]
Adds all nodes contained in the provided NodeList as children of the provided parent node. | NodeHierarchy | ||
setGroupNode(node:Node, isGroupNode:Boolean):void [static]
Set whether the provided node should be considered a group node. | NodeHierarchy | ||
[static]
Set the parent node for a given node. | NodeHierarchy | ||
transferMapperIDs(graph:Graph):void [static]
Replaces the DataProvider for grouping keys with the id data provider used by yFiles FLEX. | NodeHierarchy |
enableGrouping | () | method |
public static function enableGrouping(graph:Graph):void
Adds the DataProviders
that are required for working with hierarchic layout graphs, namely:
transferMapperIDs
.
Parameters
graph:Graph |
See also
getChildren | () | method |
public static function getChildren(parent:Node):NodeList
Returns a list of all child nodes of the given parent node.
Parameters
parent:Node — The parent group node.
|
NodeList — A list of all child nodes of the given parent node.
|
getNeighbors | () | method |
public static function getNeighbors(node:Node):NodeList
Returns a list containing the given node and all its neighbor nodes.
If the given node is top-level, all top-level nodes are returned. Otherwise all child nodes of the given node's parent node are returned.
Parameters
node:Node — The node to get the neighbors for.
|
NodeList — A list containing the given node and all its neighbor nodes.
|
getNodes | () | method |
public static function getNodes(graph:Graph):NodeList
Returns a node list that allows for breadth-first iteration over the node hierarchy of the provided graph.
Parameters
graph:Graph — The graph for which to return a hierarchy iterator.
|
NodeList — A node cursor that allows to traverse all nodes of the provided graph in
in breadth-first manner.
|
getParent | () | method |
public static function getParent(child:Node):Node
Get the parent node of the provided node. If the node is a top-level node, null
is returned.
Parameters
child:Node — The child node.
|
Node — The parent node or null if child is a top-level node.
|
getTopLevelNodes | () | method |
public static function getTopLevelNodes(graph:Graph):NodeList
Returns a cursor over all top level nodes of the provided graph, i.e., all
nodes for which NodeHierarchy.getParent( node )
yields null
.
Parameters
graph:Graph — The graph containing the top level nodes.
|
NodeList — A cursor that allows to iterate over all top level nodes of the provided graph.
|
isGroupNode | () | method |
public static function isGroupNode(node:Node):Boolean
Whether the given node is considered a group node.
This method may return true
, even if the given node doesn't have any child nodes.
Parameters
node:Node — The node to check for being a group node.
|
Boolean — Whether the given node is considered a group node.
|
setAllParents | () | method |
public static function setAllParents(children:NodeList, parent:Node):void
Adds all nodes contained in the provided NodeList
as children of the provided parent node.
Parameters
children:NodeList — A list of nodes to be added as children of the provided parent node.
| |
parent:Node — The parent node.
|
setGroupNode | () | method |
public static function setGroupNode(node:Node, isGroupNode:Boolean):void
Set whether the provided node should be considered a group node. A group node may (but doesn't have to) have children.
Parameters
node:Node — The node to set as group node or non-group node.
| |
isGroupNode:Boolean — Whether to consider the given node a group node.
|
setParent | () | method |
public static function setParent(child:Node, parent:Node):void
Set the parent node for a given node. To make child
a top-level node, pass null
as the
parent
.
Calls enableGrouping
to make sure that the graph instance supports hierarchies.
Parameters
child:Node — The node to assign a new parent.
| |
parent:Node — The parent node to assign to child .
|
IllegalArgumentException — if parent
is a child of child , or parent equals child .
|
See also
transferMapperIDs | () | method |
public static function transferMapperIDs(graph:Graph):void
Replaces the DataProvider for grouping keys with the id data provider used by yFiles FLEX.
After using this function, graph.getDataProvider( GroupingKeys.NODE_ID_DPKEY )
and
graph.getDataProvider(DefaultGraph#MAPPER_KEY_NODE_2_ID )
will yield the same instance.
This instance will automatically generate ids for newly created nodes.
Clients should only call this function if the graph is read directly using a GraphML I/O handler instance.
Parameters
graph:Graph |
See also