Search this API

y.layout.tree
Class LeafPlacer

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

public class LeafPlacer
extends Object
implements NodePlacer

This implementation can be used to "place" leafs. It only routes the first incoming edge.


Field Summary
 
Fields inherited from interface y.layout.tree.NodePlacer
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST
 
Constructor Summary
LeafPlacer()
           
 
Method Summary
 Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
          Creates an optional Processor for pre- and post-processing.
 void determineChildConnectors(Node localRoot, DataMap connectorMap)
          This method is called by GenericTreeLayouter before the subtree shapes of this local root node's children are calculated.
 GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider, DataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, byte parentConnectorDirection)
          The main method of the tree layout algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeafPlacer

public LeafPlacer()
Method Detail

createProcessor

public Processor createProcessor(GenericTreeLayouter layouter,
                                 LayoutGraph graph,
                                 Node currentRoot)
Description copied from interface: NodePlacer
Creates an optional Processor for pre- and post-processing.

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

determineChildConnectors

public void determineChildConnectors(Node localRoot,
                                     DataMap connectorMap)
Description copied from interface: NodePlacer
This method is called by GenericTreeLayouter before the subtree shapes of this local root node's children are calculated. This method must provide for each child node a byte constant indicating the preferred direction of the connector to the subtree shape.

Specified by:
determineChildConnectors in interface NodePlacer
Parameters:
localRoot - the local root node whose child nodes will be provided with a byte constant indicating the direction of the connector
connectorMap - the map that should be used for storing the byte constant with the child nodes.

placeSubtree

public GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider,
                                                     DataProvider subtreeShapeProvider,
                                                     LayoutGraph graph,
                                                     Node localRoot,
                                                     byte parentConnectorDirection)
Description copied from interface: NodePlacer
The main method of the tree layout algorithm. This method arranges the SubtreeShapes and the shape of the local root, routes the edges to the SubtreeShapes, calculates the resulting SubtreeShape and returns it.

Specified by:
placeSubtree in interface NodePlacer
Parameters:
nodeShapeProvider - this instance can be used to obtain an initial shape of the root node. This shape can then be merged with all the subtrees' shapes and finally be returned by this method.
subtreeShapeProvider - provides access to the pre-calculated shapes of the subtrees. It is guaranteed that at the time of the invocation of this method for every child node the subtree shape has already been calculated
graph - the graph which is to be laid out
localRoot - the root of the subtree that should be laid out by this method
parentConnectorDirection - the direction byte constant as it is defined in this interface, that must be used for initializing the connector of the localRoot node to the parent node of the localRoot node
Returns:
the shape of the whole subtree

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