y.layout.tree
Class LayeredNodePlacer

java.lang.Object
  extended by y.layout.tree.AbstractRotatableNodePlacer
      extended by y.layout.tree.LayeredNodePlacer
All Implemented Interfaces:
NodePlacer

public class LayeredNodePlacer
extends AbstractRotatableNodePlacer

This NodePlacer calculates and respects layers. Attention: Changing the orientation within the LayereNodePlacers will result in dubious problems.

 
Your browser does not support SVG content.

Nested Class Summary
 
Nested classes/interfaces inherited from class y.layout.tree.AbstractRotatableNodePlacer
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment
 
Field Summary
static Object DP_KEY_DISTANCE_TO_PARENT_MAP
          References a NodeMap that contains double values.
static int ORTHOGONAL_STYLE
          Layout style constant.
static int PLAIN_STYLE
          Layout style constant.
 
Fields inherited from class y.layout.tree.AbstractRotatableNodePlacer
createdChildren, graph, modificationMatrix, nodeShapeProvider, spacing, subtreeShapeProvider
 
Fields inherited from interface y.layout.tree.NodePlacer
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST
 
Constructor Summary
LayeredNodePlacer()
           
LayeredNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix, Object id)
          Default constructor.
 
Method Summary
 Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
          Creates an processor that distributes the LayerRoot
protected  byte determineChildConnector(Node child)
          This method must be implemented by subclasses.
 double getBusAlignment()
          Returns the actual set bus alignment.
 Object getId()
          Returns the ID.
 double getLayerSpacing()
          The spacing between two layers
 AbstractRotatableNodePlacer.RootAlignment getRootAlignment()
          Returns the actual set root alignment strategy
 int getRoutingStyle()
          Returns the actual set routing style.
 double getVerticalAlignment()
          Returns the vertical alignment.
 boolean isPolylineLabelingEnabled()
          If set to true, the poly line connectors between the parent and its children are added to the shape.
protected  y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot, byte parentConnectorDirection)
          This method must be implemented by subclasses.
 void setBusAlignment(double busAlignment)
          Sets the vertical alignment of the bus
 void setLayerSpacing(double layerSpacing)
          Sets the spacing between to layers.
 void setPolylineLabelingEnabled(boolean polylineLabelingEnabled)
          Setter for the polyline labeling feature.
 void setRootAlignment(AbstractRotatableNodePlacer.RootAlignment rootAlignment)
          Setter for the root alignment
 void setRoutingStyle(int layoutStyle)
          Sets the routing style.
 void setVerticalAlignment(double verticalAlignment)
          Sets the vertical alignment
0: The nodes are aligned on the top
0.5: The nodes are aligned in the middle
1: The nodes are aligned on the bottom
 
Methods inherited from class y.layout.tree.AbstractRotatableNodePlacer
createComparator, createRootNodeShape, createSubtreeShape, determineChildConnectors, getModificationMatrix, getPortConstraint, getSourcePointAbs, getSpacing, placeSubtree, setSpacing, translateDirectionToModel, translateDirectionToReal, translatePoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DP_KEY_DISTANCE_TO_PARENT_MAP

public static final Object DP_KEY_DISTANCE_TO_PARENT_MAP
References a NodeMap that contains double values. Those values represent the distance between the center of the actual node and the center of its children


PLAIN_STYLE

public static final int PLAIN_STYLE
Layout style constant. Draw edges as straight lines

See Also:
Constant Field Values

ORTHOGONAL_STYLE

public static final int ORTHOGONAL_STYLE
Layout style constant. Draw edges orthogonally in a bus-like fashion

See Also:
Constant Field Values
Constructor Detail

LayeredNodePlacer

public LayeredNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix,
                         Object id)
Default constructor. Instantiates a new instance with the given modification matrix.

Parameters:
modificationMatrix - the translation for the NodePlacer

LayeredNodePlacer

public LayeredNodePlacer()
Method Detail

determineChildConnector

protected byte determineChildConnector(Node child)
Description copied from class: AbstractRotatableNodePlacer
This method must be implemented by subclasses. It is used to assigns a connector shape direction to each child.

Specified by:
determineChildConnector in class AbstractRotatableNodePlacer
Parameters:
child - the child node
Returns:
a byte constant as defined in the NodePlacer interface

placeSubtree

protected y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot,
                                                         byte parentConnectorDirection)
Description copied from class: AbstractRotatableNodePlacer
This method must be implemented by subclasses.

Specified by:
placeSubtree in class AbstractRotatableNodePlacer
Parameters:
localRoot - the local root node
parentConnectorDirection - the direction of the connector shape
Returns:
a SubtreeShape instance that describes the shape of the whole subtree

createProcessor

public Processor createProcessor(GenericTreeLayouter layouter,
                                 LayoutGraph graph,
                                 Node currentRoot)
Creates an processor that distributes the LayerRoot

Specified by:
createProcessor in interface NodePlacer
Overrides:
createProcessor in class AbstractRotatableNodePlacer
Parameters:
layouter -
graph - the actual graph
currentRoot - the actual root node for this node placer
Returns:
a Processor or null

getRootAlignment

public AbstractRotatableNodePlacer.RootAlignment getRootAlignment()
Returns the actual set root alignment strategy

Returns:
the root alignment

setRootAlignment

public void setRootAlignment(AbstractRotatableNodePlacer.RootAlignment rootAlignment)
Setter for the root alignment

Parameters:
rootAlignment -

getVerticalAlignment

public double getVerticalAlignment()
Returns the vertical alignment. The vertical alignment describes the position on which the nodes of one layer are vertically aligned.

0: The nodes are aligned on the top
0.5: The nodes are aligned in the middle
1: The nodes are aligned on the bottom

Returns:
The vertical alignment (0 - 1)

setVerticalAlignment

public void setVerticalAlignment(double verticalAlignment)
Sets the vertical alignment
0: The nodes are aligned on the top
0.5: The nodes are aligned in the middle
1: The nodes are aligned on the bottom

Parameters:
verticalAlignment -

getId

public Object getId()
Returns the ID. The ID is used to identify LayereNodePlacers that share informations about their height. Using different IDs offers aligned layouts within different subtrees.

Returns:
The ID

getLayerSpacing

public double getLayerSpacing()
The spacing between two layers

Returns:
The spacing between two layers

setLayerSpacing

public void setLayerSpacing(double layerSpacing)
Sets the spacing between to layers.

Parameters:
layerSpacing -

setRoutingStyle

public void setRoutingStyle(int layoutStyle)
Sets the routing style. The possible values are:

Parameters:
layoutStyle -

getRoutingStyle

public int getRoutingStyle()
Returns the actual set routing style. The possible values are:

Returns:
the routing style

getBusAlignment

public double getBusAlignment()
Returns the actual set bus alignment. The bus alignment represents the position of the "bus" within the spacing between the layers (getLayerSpacing()). 0: the bus is a the top of the space between the layers 0.5: the bus is exactly in the middle 1: the bus is at the bottom

Returns:
the bus alignment (0.0 - 1.0)

setBusAlignment

public void setBusAlignment(double busAlignment)
Sets the vertical alignment of the bus

Parameters:
busAlignment - (between 0 and 1)

isPolylineLabelingEnabled

public boolean isPolylineLabelingEnabled()
If set to true, the poly line connectors between the parent and its children are added to the shape. Labels (of nodes and edges) will not cut them.

Returns:
whether polyline labeling is enabled

setPolylineLabelingEnabled

public void setPolylineLabelingEnabled(boolean polylineLabelingEnabled)
Setter for the polyline labeling feature.

If set to true, the poly line connectors between the parent and its children are added to the shape. Labels (of nodes and edges) will not cut them.


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