|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.hierarchy.GroupLayoutConfigurator
public class GroupLayoutConfigurator
This convenience class helps to prepare a hierarchically grouped Graph2D
for an automatic assignment of layout information. Basically, it translates
the hierarchy information maintained by an HierarchyManager
to
data provider-based hierarchy information that is understood by automatic
layout algorithms (see GroupingKeys
).
This class is used heavily by Graph2DLayoutExecutor
but could be used on its own as well:
// initialize grouping information GroupLayoutConfigurator glc = new GroupLayoutConfigurator(getGraph2D()); try { // register grouping relevant DataProviders glc.prepareAll(); // launch layouter in buffered mode new BufferedLayouter(getLayouter()).doLayout(getGraph2D()); } finally { // make sure the DataProviders will always be unregistered glc.restoreAll(); }
Graph2DLayoutExecutor
,
HierarchyManager
,
GroupingKeys
Nested Class Summary | |
---|---|
static class |
GroupLayoutConfigurator.MinNodeSizeDataProvider
A data provider that returns minimal sizes of node realizers that are provided through the node realizer's SizeConstraintProvider, see NodeRealizer.getSizeConstraintProvider() |
Constructor Summary | |
---|---|
GroupLayoutConfigurator(Graph2D graph)
Creates a new instance of GroupLayoutConfigurator for a given graph |
Method Summary | |
---|---|
protected DataProvider |
createGroupDP(Graph2D graph)
Creates a data provider that maps each node to a boolean flag indicating whether the node is a group node or not. |
protected YInsets |
getGroupNodeInsets(Graph2D graph,
Node node)
Determines the group node insets that have to be taken into account by layout algorithms. |
boolean |
isTreatEmptyGroupNodesAsNormalNodesEnabled()
Returns whether or not empty group nodes are handled like normal nodes. |
void |
prepareAll()
Convenience method that performs all necessary layout preparations on the input graph. |
void |
prepareAutoBoundsFeatures()
Disables the auto bounds feature in all NodeRealizers that implement AutoBoundsFeature . |
void |
prepareGroupDataProviders()
Binds all data providers to the input graph, that define the hierarchically grouped structure of the graph. |
void |
prepareGroupNodeBounds()
Makes sure that the current bounds of the group nodes are up to date, i.e. |
void |
prepareGroupNodeInsets()
Makes the auto bounds insets of group nodes that implement AutoBoundsFeature available for layout algorithms. |
void |
prepareMinGroupNodeSizes()
Makes the minimum node bounds available for layout algorithms. |
void |
restoreAll()
Cleanup method that undoes the steps performed by prepareAll() . |
void |
restoreAutoBoundsFeatures()
Cleanup method that undoes the steps performed by prepareAutoBoundsFeatures() . |
void |
restoreGroupDataProviders()
Cleanup method that undoes the steps performed by prepareGroupDataProviders() . |
void |
restoreGroupNodeInsets()
Cleanup method that undoes the steps performed by prepareGroupNodeInsets() . |
void |
restoreMinGroupNodeSizes()
Cleanup method that undoes the steps performed by prepareMinGroupNodeSizes() . |
void |
setTreatEmptyGroupNodesAsNormalNodesEnabled(boolean enabled)
If this option is enabled, empty group nodes are handled like normal nodes, that is they are not marked as group nodes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GroupLayoutConfigurator(Graph2D graph)
Method Detail |
---|
public boolean isTreatEmptyGroupNodesAsNormalNodesEnabled()
true
if empty group nodes are handled like normal
nodes; false
otherwise.setTreatEmptyGroupNodesAsNormalNodesEnabled(boolean)
,
HierarchyManager.isGroupNode(y.base.Node)
,
HierarchyManager.isNormalNode(y.base.Node)
public void setTreatEmptyGroupNodesAsNormalNodesEnabled(boolean enabled)
enabled
- whether or not this option
should be enabled.isTreatEmptyGroupNodesAsNormalNodesEnabled()
,
HierarchyManager.isGroupNode(y.base.Node)
,
HierarchyManager.isNormalNode(y.base.Node)
public void prepareGroupDataProviders()
protected DataProvider createGroupDP(Graph2D graph)
graph
- the Graph2D instance.
public void prepareGroupNodeInsets()
AutoBoundsFeature
available for layout algorithms.
restoreGroupNodeInsets()
protected YInsets getGroupNodeInsets(Graph2D graph, Node node)
Note: Unlike the other methods declared in this class,
getGroupNodeInsets
is queried during layout
calculation.
graph
- the graph for which this configurator is responsible.node
- the node whose insets have to be returned.
public void prepareMinGroupNodeSizes()
restoreMinGroupNodeSizes()
public void prepareGroupNodeBounds()
disable and reenable
the AutoBoundsFeature
of all nodes in the graph in order to trigger a
recalculation of their bounds, if it is necessary
GroupNodeRealizer.recalculateBounds()
public void restoreGroupDataProviders()
prepareGroupDataProviders()
.
public void prepareAutoBoundsFeatures()
AutoBoundsFeature
. This way an automatic layout algorithm will be able
to resize such nodes during the layout process.
public void restoreGroupNodeInsets()
prepareGroupNodeInsets()
.
public void restoreMinGroupNodeSizes()
prepareMinGroupNodeSizes()
.
public void restoreAutoBoundsFeatures()
prepareAutoBoundsFeatures()
.
public void prepareAll()
public void restoreAll()
prepareAll()
.
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |