|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.CanonicMultiStageLayouter
y.layout.hierarchic.HierarchicLayouter
y.layout.hierarchic.HierarchicGroupLayouter
public class HierarchicGroupLayouter
This layout algorithm arranges grouped graphs in a hierarchic fashion.
This class is an extended variant of HierarchicLayouter that is able to handle groups.
More precisely, this layout algorithm is capable of laying out nested groups of nodes as well as the group nodes themselves.
The grouping information is provided through DataProvider instances, which are registered with the
graph instance using keys GroupingKeys.GROUP_DPKEY,
GroupingKeys.NODE_ID_DPKEY, GroupingKeys.PARENT_NODE_ID_DPKEY.
The nodes are distributed into layers such that most of the edges point to the main layout direction. The order of the nodes within the layers ensures that the number of edge crossings is as small as possible. There are different edge routing styles available. Edges can be orthogonal or polyline.
Hierarchical diagrams are commonly used for the visualization of hierarchical data, since they facilitate the identification of dependencies and relationships among the nodes of the graph. Possible application domains are the following: workflow visualization, call graph visualization, entity-relationship diagrams, biochemical pathways and network management.

Hierarchic group layout obtained with default settings
The layout is being calculated recursively for each group. The size of the group nodes is determined by the area occupied by the children of the group node.
For more details about how each group is being laid out, refer to superclass HierarchicLayouter.
HierarchicGroupLayouter supports all the features of superclass HierarchicLayouter.
In addition, it can be specified whether or not strong port constraints at group nodes should be scaled to the
same amount as the sizes of the group nodes are modified by using setStrongPortsScalingActive(boolean).
Also, a GroupBoundsCalculator that controls the sizes of the group nodes can be specified using
setGroupBoundsCalculator(GroupBoundsCalculator).
![]() |
![]() |
![]() |
![]() |
| Field Summary |
|---|
| Fields inherited from class y.layout.hierarchic.HierarchicLayouter |
|---|
LAYERING_BFS, LAYERING_FROM_SKETCH, LAYERING_HIERARCHICAL_DOWNSHIFT, LAYERING_HIERARCHICAL_OPTIMAL, LAYERING_HIERARCHICAL_TIGHT_TREE, LAYERING_HIERARCHICAL_TOPMOST, LAYERING_STRATEGY_UNKNOWN, LAYERING_USER_DEFINED, LINEAR_SEGMENTS, MEDIAN_SIMPLEX, PENDULUM, POLYLINE, ROUTE_ORTHOGONAL, ROUTE_POLYLINE, SIMPLEX, TREE |
| Fields inherited from interface y.layout.PortConstraintKeys |
|---|
SOURCE_GROUPID_KEY, SOURCE_PORT_CONSTRAINT_KEY, SOURCE_PORT_GROUP_ID_DPKEY, TARGET_GROUPID_KEY, TARGET_PORT_CONSTRAINT_KEY, TARGET_PORT_GROUP_ID_DPKEY |
| Fields inherited from interface y.layout.Layouter |
|---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES |
| Constructor Summary | |
|---|---|
HierarchicGroupLayouter()
Creates an instance of HierarchicGroupLayouter with default settings. |
|
| Method Summary | |
|---|---|
boolean |
canLayoutCore(LayoutGraph graph)
Accepts general graphs without exceptions. |
void |
doLayout(LayoutGraph graph)
Calculates a hierarchic layout for the given graph. |
void |
doLayoutCore(LayoutGraph graph)
Arranges the graph in a hierarchic fashion. |
Drawer |
getDrawer()
Returns the Drawer instance responsible for assigning the coordinates to the nodes (third
phase of the layout algorithm). |
GroupBoundsCalculator |
getGroupBoundsCalculator()
Returns the GroupBoundsCalculator instance. |
protected Grouping |
getGrouping()
Returns the associated Grouping instance. |
Layerer |
getLayerer()
Returns the Layerer instance responsible for generating the layer assignment (first phase of
the layout algorithm). |
protected NodeList[] |
getLayerSequence(LayoutGraph graph,
NodeMap layerID,
int maxLayer)
Determines the order of the nodes within their layers. |
LayerSequencer |
getLayerSequencer()
Returns the LayerSequencer instance responsible for calculating the sequence of nodes within
each layer (second phase of the layout algorithm). |
boolean |
isGlobalSequencingActive()
Returns whether or not a global sequencing heuristic should be applied. |
boolean |
isStrongPortsScalingActive()
Returns whether or not strong port constraints at group nodes should be interpreted as coordinates that should be scaled to the same amount as the sizes of the group nodes are modified. |
protected java.awt.geom.Rectangle2D |
layoutLevel(Node root,
NodeList levelNodes,
boolean buildGraphsOnly)
Calculates the layout of the children of a given root recursively. |
void |
setDrawer(Drawer drawer)
Specifies the Drawer instance responsible for assigning the coordinates to the nodes (third
phase of the layout algorithm). |
void |
setGlobalSequencingActive(boolean globalSequencingActive)
Determines whether or not a global sequencing heuristic should be applied. |
void |
setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
Specifies the GroupBoundsCalculator instance. |
void |
setLayerer(Layerer layerer)
Specifies the Layerer instance responsible for generating the layer assignment (first phase of
the layout algorithm). |
void |
setLayeringStrategy(byte strategy)
Specifies the layering strategy of this layout algorithm. |
void |
setLayerSequencer(LayerSequencer sequencer)
Specifies the LayerSequencer instance responsible for calculating the sequence of nodes within
each layer (second phase of the layout algorithm). |
void |
setLayoutStyle(byte style)
Specifies the layout style of this layout algorithm. |
void |
setStrongPortsScalingActive(boolean strongPortsScalingActive)
Specifies whether or not strong port constraints at group nodes should be interpreted as coordinates that should be scaled to the same amount as the sizes of the group nodes are modified. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HierarchicGroupLayouter()
HierarchicGroupLayouter with default settings.
| Method Detail |
|---|
protected Grouping getGrouping()
Grouping instance.
Grouping instancepublic boolean canLayoutCore(LayoutGraph graph)
canLayoutCore in class HierarchicLayoutergraph - the input graph
true for all input graphspublic void doLayoutCore(LayoutGraph graph)
doLayoutCore in class HierarchicLayoutergraph - the input graph
protected java.awt.geom.Rectangle2D layoutLevel(Node root,
NodeList levelNodes,
boolean buildGraphsOnly)
root - the current root node (parent, invisible during layout)levelNodes - the NodeList containing the nodes that will be laid outbuildGraphsOnly - For internal use only
public void doLayout(LayoutGraph graph)
doLayout in interface LayouterdoLayout in class CanonicMultiStageLayoutergraph - the input graphCanonicMultiStageLayouter.appendStage(LayoutStage),
CanonicMultiStageLayouter.prependStage(LayoutStage),
CanonicMultiStageLayouter.doLayoutCore(LayoutGraph)public void setLayerSequencer(LayerSequencer sequencer)
HierarchicLayouterLayerSequencer instance responsible for calculating the sequence of nodes within
each layer (second phase of the layout algorithm).
setLayerSequencer in class HierarchicLayoutersequencer - the given LayerSequencer instancepublic void setLayerer(Layerer layerer)
HierarchicLayouterLayerer instance responsible for generating the layer assignment (first phase of
the layout algorithm).
setLayerer in class HierarchicLayouterlayerer - the given Layerer instancepublic Layerer getLayerer()
HierarchicLayouterLayerer instance responsible for generating the layer assignment (first phase of
the layout algorithm).
getLayerer in class HierarchicLayouterLayerer instanceHierarchicLayouter.setLayerer(Layerer)public LayerSequencer getLayerSequencer()
HierarchicLayouterLayerSequencer instance responsible for calculating the sequence of nodes within
each layer (second phase of the layout algorithm).
getLayerSequencer in class HierarchicLayouterLayerSequencer instanceHierarchicLayouter.setLayerSequencer(LayerSequencer)public GroupBoundsCalculator getGroupBoundsCalculator()
GroupBoundsCalculator instance.
By specifying an instance of the GroupBoundsCalculator interface, one can control the sizes of the group
nodes. For every group of nodes which is in its open state, the instance will be asked to calculate the bounds
for the given child nodes. The resulting size will be used during the ongoing layout.
GroupBoundsCalculator instancesetGroupBoundsCalculator(GroupBoundsCalculator)public void setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
GroupBoundsCalculator instance.
By specifying an instance of the GroupBoundsCalculator interface, one can control the sizes of the group
nodes. For every group of nodes which is in its open state, the instance will be asked to calculate the bounds
for the given child nodes. The resulting size will be used during the ongoing layout.
groupBoundsCalculator - the GroupBoundsCalculator instancepublic void setDrawer(Drawer drawer)
Drawer instance responsible for assigning the coordinates to the nodes (third
phase of the layout algorithm).
The Drawer is responsible for the layout style of this layout algorithm.
setDrawer in class HierarchicLayouterdrawer - the given Drawer instancepublic Drawer getDrawer()
Drawer instance responsible for assigning the coordinates to the nodes (third
phase of the layout algorithm).
The Drawer is responsible for the layout style of this layout algorithm.
getDrawer in class HierarchicLayouterDrawer instancesetDrawer(Drawer)public void setLayoutStyle(byte style)
setLayoutStyle in class HierarchicLayouterHierarchicLayouter.LINEAR_SEGMENTS. Edges will be drawn with at most two bends per edge.style - one of the predefined layout styles
java.lang.IllegalArgumentException - if an unknown layout style is usedpublic void setLayeringStrategy(byte strategy)
setLayeringStrategy in class HierarchicLayouterHierarchicLayouter.LAYERING_HIERARCHICAL_TIGHT_TREEstrategy - one of the predefined layering strategies
java.lang.IllegalArgumentException - if an unknown strategy is usedpublic boolean isStrongPortsScalingActive()
true if strong port constraints should be scaled, false otherwisesetStrongPortsScalingActive(boolean)public void setStrongPortsScalingActive(boolean strongPortsScalingActive)
strongPortsScalingActive - true if strong port constraints should be scaled, false
otherwise
protected NodeList[] getLayerSequence(LayoutGraph graph,
NodeMap layerID,
int maxLayer)
This method is called in doLayoutCore(LayoutGraph) in order to assign the sizes of the group nodes
after the layering has been completed. At the end, the layer sequence will be calculated by the superclass.
It may be overridden to get a hook into the layout algorithm.
getLayerSequence in class HierarchicLayoutergraph - the input graphlayerID - the NodeMap that returns the zero-based index of the layer to which each node belongsmaxLayer - the number of layers
NodeLists containing nodes that belong to the same layer; the order of the nodes
within each such list represents the sequence of the nodes within their layerpublic boolean isGlobalSequencingActive()
If this heuristic is disabled, the sequence of the nodes in each group will be considered independently, while if it is enabled the sequencing will be performed by taking into consideration all groups.
true if a global sequencing heuristic should be applied, false otherwisesetGlobalSequencingActive(boolean)public void setGlobalSequencingActive(boolean globalSequencingActive)
If this heuristic is disabled, the sequence of the nodes in each group will be considered independently, while if it is enabled the sequencing will be performed by taking into consideration all groups.
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||