y.layout.grouping
Class InsetsGroupBoundsCalculator

java.lang.Object
  |
  +--y.layout.grouping.InsetsGroupBoundsCalculator
All Implemented Interfaces:
GroupBoundsCalculator

public class InsetsGroupBoundsCalculator
extends Object
implements GroupBoundsCalculator

Convenience implementation which allows for custom insets for each group node. Insets are provided through a DataProvider which must be registered with the graph prior to the invocation of the layout algorithm.


Constructor Summary
InsetsGroupBoundsCalculator()
          Constructs an instance that uses inset provided through the dataprovider registered at the input graph with the public key GroupingKeys.GROUP_NODE_INSETS_DPKEY.
InsetsGroupBoundsCalculator(Insets insets)
          Like InsetsGroupBoundsCalculator.InsetsGroupBoundsCalculator(java.lang.Object, java.awt.Insets).
InsetsGroupBoundsCalculator(Object insetsDataProviderKey)
          Constructs an instance using the given DataProvider key.
InsetsGroupBoundsCalculator(Object insetsDataProviderKey, Insets defaultInsets)
          Constructs an instance using the given DataProvider key and default insets.
 
Method Summary
 Rectangle2D calculateBounds(LayoutGraph graph, Node groupNode, NodeList children)
          This method is called during the layout process.
protected  Rectangle2D getNodeBounds(LayoutGraph graph, NodeList nodes)
          Calculates and returns the united bounds of the given nodes only, no labels or adjacent edges are considered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InsetsGroupBoundsCalculator

public InsetsGroupBoundsCalculator()
Constructs an instance that uses inset provided through the dataprovider registered at the input graph with the public key GroupingKeys.GROUP_NODE_INSETS_DPKEY.


InsetsGroupBoundsCalculator

public InsetsGroupBoundsCalculator(Insets insets)
Like InsetsGroupBoundsCalculator.InsetsGroupBoundsCalculator(java.lang.Object, java.awt.Insets). Additionally an inset object can be specified that will be used as the default if the dataprovider contains no inset information for a specific node.


InsetsGroupBoundsCalculator

public InsetsGroupBoundsCalculator(Object insetsDataProviderKey)
Constructs an instance using the given DataProvider key.


InsetsGroupBoundsCalculator

public InsetsGroupBoundsCalculator(Object insetsDataProviderKey,
                                   Insets defaultInsets)
Constructs an instance using the given DataProvider key and default insets.

Method Detail

calculateBounds

public Rectangle2D calculateBounds(LayoutGraph graph,
                                   Node groupNode,
                                   NodeList children)
Description copied from interface: GroupBoundsCalculator
This method is called during the layout process. It calculates the bounds for the given groupNode instance that contains the children.

Specified by:
calculateBounds in interface GroupBoundsCalculator
Parameters:
graph - the graph instance for which the bounds will be calculated
groupNode - the group node whose bounds will be calculated
children - a list of nodes which reside inside the groupnode
Returns:
a Rectangle2D instance that describes the bounds of the groupnode.

getNodeBounds

protected Rectangle2D getNodeBounds(LayoutGraph graph,
                                    NodeList nodes)
Calculates and returns the united bounds of the given nodes only, no labels or adjacent edges are considered.


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

2003