Search this API

y.layout.hierarchic.incremental
Class GroupingSupport

java.lang.Object
  extended by y.layout.hierarchic.incremental.GroupingSupport

public class GroupingSupport
extends java.lang.Object

This class is responsible for managing hierarchically grouped graphs.

The grouping information is provided through DataProviders registered with the graph with keys GroupingKeys.NODE_ID_DPKEY, GroupingKeys.PARENT_NODE_ID_DPKEY and GroupingKeys.GROUP_DPKEY.

See Also:
Grouping, GroupingKeys
 
Your browser does not support SVG content.

Nested Class Summary
static interface GroupingSupport.Visitor
          Visitor interface that can be used to traverse the descendants of a group node
 
Method Summary
 void assignEdgeGroupNodesToGroups(Layers layers)
          Assigns edge group nodes to groups based on a given Layers instance.
 void assignLabelNodesToGroups(Layers layers, ItemFactory itemFactory)
          Assigns label nodes to groups.
 NodeList getChildren(Node groupNode)
          Returns the direct children of the given group node.
 NodeList getDecendants(Node groupNode)
          Returns the descendant Nodes of the given group node.
 double getMinimumGroupDistance()
          Returns 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()
          Returns 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(Layers layers)
          Removes the current assignment of source/target edge groups from a given Layers instance.
 void setMinimumGroupDistance(double minimumGroupDistance)
          Specifies the minimum distance between group nodes.
 void unhideGroupNodes()
          Un-hides all previously hidden group nodes and incident edges.
 void visitDecendants(Node groupNode, GroupingSupport.Visitor visitor)
          Visits all descendant Nodes of the given group node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hideGroupNodes

public void hideGroupNodes()
Hides the group nodes and incident edges from the graph.


unhideGroupNodes

public void unhideGroupNodes()
Un-hides all previously hidden group nodes and incident edges.


getMinimumGroupDistance

public double getMinimumGroupDistance()
Returns the minimum distance between group nodes.

The minimum distance should be greater than 0.

Returns:
the minimum distance between group nodes
See Also:
setMinimumGroupDistance(double)

setMinimumGroupDistance

public void setMinimumGroupDistance(double minimumGroupDistance)
Specifies the minimum distance between group nodes.

The minimum distance should be greater than 0.

Default Value:
The default value is 0.0d.
Parameters:
minimumGroupDistance - the given minimum distance
Throws:
java.lang.IllegalArgumentException - if the minimum distance is negative
Sample Graphs:

Minimum group node distance 0.0d

Minimum group node distance 50.0d

assignEdgeGroupNodesToGroups

public void assignEdgeGroupNodesToGroups(Layers layers)
Assigns edge group nodes to groups based on a given Layers instance.

 
This method will have an effect only if method isActive() returns true.
Parameters:
layers - the given Layers instance containing the elements in the layering
See Also:
NodeData.TYPE_SOURCE_GROUP_NODE, NodeData.TYPE_TARGET_GROUP_NODE

removeEdgeGroupAssignment

public void removeEdgeGroupAssignment(Layers layers)
Removes the current assignment of source/target edge groups from a given Layers instance.

 
This method will have an effect only if method isActive() returns true.
Parameters:
layers - the given Layers instance containing the elements in the layering
See Also:
NodeData.TYPE_SOURCE_GROUP_NODE, NodeData.TYPE_TARGET_GROUP_NODE

isGroupNode

public boolean isGroupNode(Node node)
Returns whether or not the given Node is a non-empty group node.

 
This method will return false if GroupingSupport is not active.
Parameters:
node - the given Node
Returns:
true if the given node is a non-empty group node, false otherwise

assignLabelNodesToGroups

public void assignLabelNodesToGroups(Layers layers,
                                     ItemFactory itemFactory)
Assigns label nodes to groups.

 
This method will have an effect only if method isActive() returns true.
Parameters:
layers - the given Layers instance containing the elements in the layering
itemFactory - the ItemFactory used temporarily for modifying the graph instance
See Also:
NodeData.TYPE_LABEL, NodeData.TYPE_BEND, NodeData.TYPE_GROUP_BEGIN, NodeData.TYPE_GROUP_END

isActive

public boolean isActive()
Returns whether or not GroupingSupport is active.

 
All return values of the methods of this class will be invalid if GroupingSupport is inactive.
Returns:
true if GroupingSupport is active, false otherwise

visitDecendants

public void visitDecendants(Node groupNode,
                            GroupingSupport.Visitor visitor)
Visits all descendant Nodes of the given group node.

The descendants are all direct or indirect children of a group node.

 
This method will have an effect only if method isActive() returns true.
Parameters:
groupNode - the given group node
visitor - a GroupingSupport.Visitor implementation

getDecendants

public NodeList getDecendants(Node groupNode)
Returns the descendant Nodes of the given group node.

The descendants are all direct or indirect children of a group node.

 
This method will return null if GroupingSupport is not active.
Parameters:
groupNode - the given group node
Returns:
a NodeList of all descendants or null if GroupingSupport is not active
Sample Graphs:

The marked nodes are descendants of group node 5 (grouped graph)

The marked nodes are descendants of group node 5(hierarchy tree)

getChildren

public NodeList getChildren(Node groupNode)
Returns the direct children of the given group node.

 
This method will return null if GroupingSupport is not active.
Parameters:
groupNode - the given group node
Returns:
a NodeList of all direct children or null if GroupingSupport is not active
Sample Graphs:

The marked nodes are children of group node 5 (grouped graph)

The marked nodes are children of group node 5 (hierarchy tree)

getParentNode

public Node getParentNode(Node node)
Returns the parent group node of the given Node or null if the given node is a top-level node.

 
This method will return null if GroupingSupport is not active.
Parameters:
node - the given Node
Returns:
the parent group node or null if the given node is a top-level node or if GroupingSupport is not active

isDescendant

public boolean isDescendant(Node node,
                            Node groupNode)
Returns whether or not the given node is a descendant Node of the given group node.

The descendants are all direct or indirect children of a group node.

Parameters:
node - the given node
groupNode - the given group node
Returns:
true if the given node is a descendant of the given group node, false otherwise

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.