|
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)
Initializes a new GroupLayoutConfigurator instance for the
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 DataProvider |
createGroupNodeInsetsProvider(Graph2D graph,
HierarchyManager hierarchyManager)
Returns a data provider for insets of group nodes from the given graph. |
protected DataProvider |
createGroupProvider(Graph2D graph,
HierarchyManager hierarchyManager)
Creates a data provider that maps each node to a boolean flag indicating whether or not the node is a group node. |
protected DataProvider |
createMinNodeSizesProvider(Graph2D graph,
HierarchyManager hierarchyManager)
Returns a data provider for minimal sizes of nodes from the given graph. |
Graph2D |
getGraph()
Returns the graph associated to this GroupLayoutConfigurator
instance. |
protected YInsets |
getGroupNodeInsets(Graph2D graph,
Node node)
Determines the group node insets that have to be taken into account by layout algorithms. |
HierarchyManager |
getHierarchyManager()
Returns the hierarchy manager associated to this configurator's graph. |
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 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)
GroupLayoutConfigurator
instance for the
given graph
graph
- the graph structure that will be processed by layout
algorithms. May not be null
.Method Detail |
---|
public final Graph2D getGraph()
GroupLayoutConfigurator
instance.
public final HierarchyManager getHierarchyManager()
HierarchyManager
instance associated to this
configurator's graph or null
if this configurator's
graph does not support nesting.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)
GroupingKeys.GROUP_DPKEY
.
graph
- the Graph2D instance.
protected DataProvider createGroupProvider(Graph2D graph, HierarchyManager hierarchyManager)
Called from createGroupDP(Graph2D)
.
public void prepareGroupNodeInsets()
AutoBoundsFeature
available for layout algorithms.
The default implementation registers the data provider created by
createGroupNodeInsetsProvider(Graph2D, HierarchyManager)
.
restoreGroupNodeInsets()
protected DataProvider createGroupNodeInsetsProvider(Graph2D graph, HierarchyManager hierarchyManager)
The default implementation returns a data provider that delegates queries
to getGroupNodeInsets(Graph2D, Node)
.
Called from prepareGroupNodeInsets()
.
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()
The default implementation registers the data provider created by
createMinNodeSizesProvider(Graph2D, HierarchyManager)
.
restoreMinGroupNodeSizes()
protected DataProvider createMinNodeSizesProvider(Graph2D graph, HierarchyManager hierarchyManager)
Called from prepareMinGroupNodeSizes()
.
GroupLayoutConfigurator.MinNodeSizeDataProvider
.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-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |