y.layout.grouping
Class RecursiveGroupLayouter

java.lang.Object
  extended by y.layout.AbstractLayoutStage
      extended by y.layout.grouping.RecursiveGroupLayouter
All Implemented Interfaces:
Layouter, LayoutStage

public class RecursiveGroupLayouter
extends AbstractLayoutStage

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. To apply different layout styles to the contents of each group node LayoutMultiplexer should be used as core layouter.

 
Your browser does not support SVG content.

Field Summary
 
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.
 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
 

Constructor Detail

RecursiveGroupLayouter

public RecursiveGroupLayouter()
Creates a new instance of RecursiveGroupLayouter.


RecursiveGroupLayouter

public RecursiveGroupLayouter(Layouter core)
Creates a new instance of RecursiveGroupLayouter using the given layout algorithm.


RecursiveGroupLayouter

public RecursiveGroupLayouter(Layouter core,
                              GroupBoundsCalculator gbc)
Creates a new instance of RecursiveGroupLayouter using the given layout algorithm and GroupBoundsCalculator implementation.

Method Detail

canLayout

public boolean canLayout(LayoutGraph graph)
Description copied from interface: Layouter
Returns true iff the given graph can be laid out by this algorithm. Calling doLayout with the given graph as it's argument will only success if this method returns true.


doLayout

public void doLayout(LayoutGraph graph)
Description copied from interface: Layouter
Main layout routine that assigns new layout information to the given graph.


getGroupBoundsCalculator

public GroupBoundsCalculator getGroupBoundsCalculator()
Returns the currently installed GroupBoundsCalculator instance.

Returns:
The GroupBoundsCalculator instance.

setGroupBoundsCalculator

public void setGroupBoundsCalculator(GroupBoundsCalculator groupBoundsCalculator)
Sets a new GroupBoundsCalculator instance that applies to all encountered group nodes.

Parameters:
groupBoundsCalculator - New GroupBoundsCalculator instance.

© Copyright 2000-2008,
yWorks GmbH.
All rights reserved.