Search this API

y.layout.hierarchic.incremental
Class AspectRatioComponentLayerer

java.lang.Object
  extended by y.layout.hierarchic.incremental.AspectRatioComponentLayerer
All Implemented Interfaces:
Layerer

public class AspectRatioComponentLayerer
extends Object
implements Layerer

Wrapper Layerer implementation that delegates the actual layering to a delegate Layerer. If the graph consists of multiple components, they will be identified and each of the components will be layered separately using the delegate Layerer instance. After that they will all be merged such that the desired aspect ratio is fulfilled best. Note that for grouped graphs the desired aspect ratio is also considered for each group node separately.

See Also:
setDesiredAspectRatio(double), MultiComponentLayerer

Constructor Summary
AspectRatioComponentLayerer(Layerer singleComponentLayerer)
          Creates a new instance of AspectRatioComponentLayerer using the given delegate.
 
Method Summary
 void assignLayers(LayoutGraph graph, Layers layers, LayoutDataProvider ldp)
          This method assigns all nodes in the graph to layers and registers them in the Layers instance.
 double getDesiredAspectRatio()
          Returns the desired aspect ratio.
 Layerer getSingleComponentLayerer()
          Returns the Layerer instance that is used for delegation.
 boolean isConsiderNodeSize()
          Returns whether the node size should be considered.
 void setConsiderNodeSize(boolean considerNodeSize)
          Whether or not the node size should be considered.
 void setDesiredAspectRatio(double desiredAspectRatio)
          Specifies the desired aspect ratio.
 void setSingleComponentLayerer(Layerer singleComponentLayerer)
          Sets the new delegate Layerer instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AspectRatioComponentLayerer

public AspectRatioComponentLayerer(Layerer singleComponentLayerer)
Creates a new instance of AspectRatioComponentLayerer using the given delegate.

Method Detail

getSingleComponentLayerer

public Layerer getSingleComponentLayerer()
Returns the Layerer instance that is used for delegation.

Returns:
the delegate instance

setSingleComponentLayerer

public void setSingleComponentLayerer(Layerer singleComponentLayerer)
Sets the new delegate Layerer instance.

Throws:
NullPointerException - if the argument is null
Parameters:
singleComponentLayerer - the new instance.

isConsiderNodeSize

public boolean isConsiderNodeSize()
Returns whether the node size should be considered.

See Also:
setConsiderNodeSize(boolean)

setConsiderNodeSize

public void setConsiderNodeSize(boolean considerNodeSize)
Whether or not the node size should be considered. If this option is disabled, all nodes are considered to be of equal size. Hence, the given aspect ratio specifies the ratio between the number of nodes within a layer and the overall number of layers. The default value is true.

Parameters:
considerNodeSize -

getDesiredAspectRatio

public double getDesiredAspectRatio()
Returns the desired aspect ratio.

See Also:
setDesiredAspectRatio(double)

setDesiredAspectRatio

public void setDesiredAspectRatio(double desiredAspectRatio)
Specifies the desired aspect ratio. If the graph consists of multiple components, they will be identified and each of the components will be layered separately using the delegate Layerer instance. After that they will all be merged such that the desired aspect ratio is fulfilled best. Note that for grouped graphs the desired aspect ratio is also considered for each group node separately.

Parameters:
desiredAspectRatio -

assignLayers

public void assignLayers(LayoutGraph graph,
                         Layers layers,
                         LayoutDataProvider ldp)
Description copied from interface: Layerer
This method assigns all nodes in the graph to layers and registers them in the Layers instance. In order to create new layers, the factory method Layers.insert(byte, int) must be used.

Specified by:
assignLayers in interface Layerer
Parameters:
graph - the graph that contains the nodes that should be distributed into the layers
layers - the object that will be filled with the results of the calculation
ldp - LayoutDataProvider that can be used to query information about the nodes - note that positional information (see NodeData.getPosition() and NodeData.getLayer()) cannot be available at any time.
See Also:
Layers.insert(byte, int), Layer.add(y.base.Node)

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