The HierarchyManager
object
that is associated with a hierarchically organized graph maintains all data
describing the graph structure as well as a number of additional aspects.
Since this information is not directly accessible for a layout algorithm, it
has to be properly prepared before a layout can be calculated.
Class GroupLayoutConfigurator
converts relevant parts of the HierarchyManager's model into data
accessor-based information that is understood by layout algorithms from the
yFiles library package
y.layout
.
In particular, this information includes which nodes are group nodes, and the auto bounds and insets settings for each group node. API Excerpt 7.6, “Convenience methods from class GroupLayoutConfigurator” shows the methods that are used to prepare and restore all relevant graph hierarchy aspects.
Additionally, GroupLayoutConfigurator also prepares information on minimum size constraints for group nodes.
API Excerpt 7.6. Convenience methods from class GroupLayoutConfigurator
// Prepares all relevant information for a layout algorithm. void prepareAll() // Restores all group node specific sizes and insets after a layout algorithm // has been run, and updates the model accordingly. void restoreAll()
Example 7.7, “Layout preparation with graph hierarchies” demonstrates how to use GroupLayoutConfigurator's methods.
Example 7.7. Layout preparation with graph hierarchies
// 'graph' is of type y.view.Graph2D. HierarchicGroupLayouter hgl = new HierarchicGroupLayouter(); GroupLayoutConfigurator glc = new GroupLayoutConfigurator(graph); // Prepares all relevant information for a layout algorithm. glc.prepareAll(); new BufferedLayouter(hgl).doLayout(graph); // Restores all group node specific sizes and insets after a layout algorithm // has been run, and updates the model accordingly. glc.restoreAll();
|
Copyright ©2004-2008, yWorks GmbH. All rights reserved. |