public class GroupingSupport extends Object
The grouping information is provided through IDataProvider
s registered with the graph with keys
GroupingKeys.NODE_ID_DPKEY
, GroupingKeys.PARENT_NODE_ID_DPKEY
and GroupingKeys.GROUP_DPKEY
.
GroupingSupport
,
GroupingKeys
Modifier and Type | Class and Description |
---|---|
static interface |
GroupingSupport.IVisitor
Visitor interface that can be used to traverse the descendants of a group node.
|
Modifier and Type | Method and Description |
---|---|
void |
assignEdgeGroupNodesToGroups(ILayers layers)
Assigns edge group nodes to groups based on a given
ILayers instance. |
void |
assignLabelNodesToGroups(ILayers layers,
IItemFactory itemFactory)
Assigns label nodes to groups.
|
NodeList |
getChildren(Node groupNode)
Returns the direct children of the given group node.
|
NodeList |
getDescendants(Node groupNode)
Returns the descendant
Node s of the given group node. |
double |
getMinimumGroupDistance()
Gets the minimum distance between group nodes.
|
Node |
getParentNode(Node node)
Returns the parent group node of the given
Node or null if the given node is a top-level node. |
void |
hideGroupNodes()
Hides the group nodes and incident edges from the graph.
|
boolean |
isActive()
Gets whether or not
GroupingSupport is active. |
boolean |
isDescendant(Node node,
Node groupNode)
Returns whether or not the given node is a descendant
Node of the given group node. |
boolean |
isGroupNode(Node node)
Returns whether or not the given
Node is a non-empty group node. |
void |
removeEdgeGroupAssignment(ILayers layers)
Removes the current assignment of source/target edge groups from a given
ILayers instance. |
void |
setMinimumGroupDistance(double value)
Sets the minimum distance between group nodes.
|
void |
unhideGroupNodes()
Un-hides all previously hidden group nodes and incident edges.
|
void |
visitDescendants(Node groupNode,
GroupingSupport.IVisitor visitor)
Visits all descendant
Node s of the given group node. |
public void assignEdgeGroupNodesToGroups(ILayers layers)
ILayers
instance.Active
returns true
.layers
- the given ILayers
instance containing the elements in the layeringNodeDataType.SOURCE_GROUP_NODE
,
NodeDataType.TARGET_GROUP_NODE
public void assignLabelNodesToGroups(ILayers layers, IItemFactory itemFactory)
Active
returns true
.layers
- the given ILayers
instance containing the elements in the layeringitemFactory
- the IItemFactory
used temporarily for modifying the graph instanceNodeDataType.LABEL
,
NodeDataType.BEND
,
NodeDataType.GROUP_BEGIN
,
NodeDataType.GROUP_END
public NodeList getChildren(Node groupNode)
null
if GroupingSupport
is not active
.groupNode
- the given group nodeNodeList
of all direct children or null
if GroupingSupport
is not active
public NodeList getDescendants(Node groupNode)
Node
s of the given group node.
The descendants are all direct or indirect children of a group node.
null
if GroupingSupport
is not active
.groupNode
- the given group nodeNodeList
of all descendants or null
if GroupingSupport
is not active
public double getMinimumGroupDistance()
The minimum distance should be greater than 0
.
IllegalArgumentException
- if the minimum distance is negativesetMinimumGroupDistance(double)
public Node getParentNode(Node node)
Node
or null
if the given node is a top-level node.null
if GroupingSupport
is not active
.node
- the given Node
null
if the given node is a top-level node or if GroupingSupport
is not active
public void hideGroupNodes()
public boolean isActive()
GroupingSupport
is active.GroupingSupport
is inactive.true
if GroupingSupport
is active, false
otherwisepublic boolean isDescendant(Node node, Node groupNode)
Node
of the given group node.
The descendants are all direct or indirect children of a group node.
node
- the given nodegroupNode
- the given group nodetrue
if the given node is a descendant of the given group node, false
otherwisepublic boolean isGroupNode(Node node)
Node
is a non-empty group node.false
if GroupingSupport
is not active
.node
- the given Node
true
if the given node is a non-empty group node, false
otherwisepublic void removeEdgeGroupAssignment(ILayers layers)
ILayers
instance.Active
returns true
.layers
- the given ILayers
instance containing the elements in the layeringNodeDataType.SOURCE_GROUP_NODE
,
NodeDataType.TARGET_GROUP_NODE
public void setMinimumGroupDistance(double value)
The minimum distance should be greater than 0
.
IllegalArgumentException
- if the minimum distance is negativevalue
- the minimum distance between group nodesgetMinimumGroupDistance()
public void unhideGroupNodes()
public void visitDescendants(Node groupNode, GroupingSupport.IVisitor visitor)
Node
s of the given group node.
The descendants are all direct or indirect children of a group node.
Active
returns true
.groupNode
- the given group nodevisitor
- a GroupingSupport.IVisitor
implementation