|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.AbstractLayoutStage y.layout.grouping.RecursiveGroupLayouter
public class RecursiveGroupLayouter
Recursively traverses a hierarchically organized graph in a bottom-up fashion and applies the given layout algorithm (i.e. the core layouter) to the contents of each group node. The size of the group nodes can be further determined by setting a customized GroupBoundsCalculator implementation.
Note that this class can be run without a core layouter instance.
In this case no layout is calculated, instead the group node bounds are merely
adjusted to fit their respective contents. There are two alternatives for applying different layout styles
to the contents of group nodes:
1. Map each group node to the corresponding layouter using data provider key GROUP_NODE_LAYOUTER_DPKEY
.
The content of the hierarchy root is laid out with the core layouter.
2. Alternatively you can use a LayoutMultiplexer
as core layouter.
Field Summary | |
---|---|
static Object |
GROUP_NODE_LAYOUTER_DPKEY
DataProvider key used to retrieve a Layouter
instance for each group node. |
static Layouter |
NULL_LAYOUTER
A constant that represents a layouter implementation that does nothing. |
Fields inherited from interface y.layout.Layouter |
---|
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES |
Constructor Summary | |
---|---|
RecursiveGroupLayouter()
Creates a new instance of RecursiveGroupLayouter. |
|
RecursiveGroupLayouter(Layouter core)
Creates a new instance of RecursiveGroupLayouter using the given layout algorithm. |
|
RecursiveGroupLayouter(Layouter core,
GroupBoundsCalculator gbc)
Creates a new instance of RecursiveGroupLayouter using the given layout algorithm and GroupBoundsCalculator implementation. |
Method Summary | |
---|---|
boolean |
canLayout(LayoutGraph graph)
Returns true iff the given graph can be laid
out by this algorithm. |
void |
doLayout(LayoutGraph graph)
Main layout routine that assigns new layout information to the given graph. |
GroupBoundsCalculator |
getGroupBoundsCalculator()
Returns the currently installed GroupBoundsCalculator instance. |
boolean |
isAutoAssignPortCandidatesEnabled()
Returns whether or not temporary port candidates should be inserted. |
boolean |
isConsiderEmptyGroupsEnabled()
Returns whether or not group nodes without children are handled the same way as group nodes with children. |
boolean |
isConsiderSketchEnabled()
Whether or not to consider the initial coordinates of the graph elements. |
protected void |
routeInterEdges(LayoutGraph graph,
EdgeList interEdges)
This method is called after calculating the overall layout and reroutes the inter-edges, i.e., edges which traverse the boundary of a group node. |
void |
setAutoAssignPortCandidatesEnabled(boolean autoAssignPortCandidatesEnabled)
Whether or not temporary port candidates should be inserted. |
void |
setConsiderEmptyGroupsEnabled(boolean enabled)
Specifies whether or not group nodes without children are handled the same way as group nodes with children. |
void |
setConsiderSketchEnabled(boolean considerSketchEnabled)
Sets whether or not to consider the initial coordinates of the graph elements. |
void |
setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
Sets a new GroupBoundsCalculator instance that applies to all encountered group nodes. |
Methods inherited from class y.layout.AbstractLayoutStage |
---|
canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Object GROUP_NODE_LAYOUTER_DPKEY
DataProvider
key used to retrieve a Layouter
instance for each group node. The specified layouter instance is applied to the content of the group node.
For the top level elements the core layouter is used.
If the data provider returns "null" the corresponding group node is handled non-recursive, i.e.,
the group node and its content is laid out with the Layouter
instance specified by the nearest predecessor of the group node (with respect to the grouping hierarchy) which is associated with a layouter.
If the content of a group node should not be changed, the group node can be associated with a "null" layouter,
e.g., constant NULL_LAYOUTER
.
public static final Layouter NULL_LAYOUTER
Constructor Detail |
---|
public RecursiveGroupLayouter()
public RecursiveGroupLayouter(Layouter core)
public RecursiveGroupLayouter(Layouter core, GroupBoundsCalculator gbc)
Method Detail |
---|
public boolean isConsiderSketchEnabled()
setConsiderSketchEnabled(boolean)
public void setConsiderSketchEnabled(boolean considerSketchEnabled)
considerSketchEnabled
- whether to consider the initial coordinates of the graph elements.public boolean isAutoAssignPortCandidatesEnabled()
setAutoAssignPortCandidatesEnabled(boolean)
,
routeInterEdges(y.layout.LayoutGraph, y.base.EdgeList)
public void setAutoAssignPortCandidatesEnabled(boolean autoAssignPortCandidatesEnabled)
autoAssignPortCandidatesEnabled
- whether or not temporary port candidates should be inserted.routeInterEdges(y.layout.LayoutGraph, y.base.EdgeList)
public boolean isConsiderEmptyGroupsEnabled()
true
.
true
if group nodes without children are handled
the same way as group nodes with children; false
if group nodes without children are handled the same way as normal
(non-group) nodes.setConsiderEmptyGroupsEnabled(boolean)
,
routeInterEdges(y.layout.LayoutGraph, y.base.EdgeList)
public void setConsiderEmptyGroupsEnabled(boolean enabled)
true
.
enabled
- if true
group nodes without children are
handled the same way as group nodes with children; if false
group nodes without children are handled the same way as normal (non-group)
nodes.isConsiderEmptyGroupsEnabled()
,
routeInterEdges(y.layout.LayoutGraph, y.base.EdgeList)
public boolean canLayout(LayoutGraph graph)
Layouter
true
iff the given graph can be laid
out by this algorithm. Calling doLayout
with
the given graph as its argument will only success if
this method returns true
.
public void doLayout(LayoutGraph graph)
Layouter
protected void routeInterEdges(LayoutGraph graph, EdgeList interEdges)
setAutoAssignPortCandidatesEnabled(boolean)
),
the route of inter-edges always ends at the border/center of the corresponding group node.
This method identifies such edges and routes them straight-line.
graph
- the input graph.interEdges
- the edges which traverse the boundary of a group node.setAutoAssignPortCandidatesEnabled(boolean)
public GroupBoundsCalculator getGroupBoundsCalculator()
public void setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
groupBoundsCalculator
- New GroupBoundsCalculator instance.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |