Search this API

y.layout.tree
Interface NodePlacer

All Known Subinterfaces:
FromSketchNodePlacer
All Known Implementing Classes:
AbstractNodePlacer, AbstractRotatableNodePlacer, ARNodePlacer, AssistantPlacer, BusPlacer, DefaultNodePlacer, DelegatingNodePlacer, DendrogramPlacer, DoubleLinePlacer, FreePlacer, GridNodePlacer, LayeredNodePlacer, LeafPlacer, LeftRightPlacer, SimpleNodePlacer, TreeDrawer.HierarchicTreePlacer

public interface NodePlacer

This interface is used by GenericTreeLayouter. Classes implementing this interface are responsible for the arrangement of a root node and all of its subtrees. Subtrees are represented as shapes with a connecting edge to the root of the subtree.
Instances have to:

Instances may modify the subtree shape instances of the subtrees of the current root node and use the subtree shape obtained by the DataProvider as the return value.


Field Summary
static byte DIRECTION_ANY
          Byte constant that is an argument to the main method, indicating that any connector direction can be used for the connection to the parent node.
static byte DIRECTION_EAST
          Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into east direction.
static byte DIRECTION_NONE
          Byte constant that is as argument to the main method, indicating that no connector should be calculated.
static byte DIRECTION_NORTH
          Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into north direction.
static byte DIRECTION_SOUTH
          Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into south direction.
static byte DIRECTION_WEST
          Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into west direction.
 
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.
 

Field Detail

DIRECTION_NONE

static final byte DIRECTION_NONE
Byte constant that is as argument to the main method, indicating that no connector should be calculated.

See Also:
Constant Field Values

DIRECTION_ANY

static final byte DIRECTION_ANY
Byte constant that is an argument to the main method, indicating that any connector direction can be used for the connection to the parent node.

See Also:
Constant Field Values

DIRECTION_NORTH

static final byte DIRECTION_NORTH
Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into north direction.

See Also:
Constant Field Values

DIRECTION_EAST

static final byte DIRECTION_EAST
Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into east direction.

See Also:
Constant Field Values

DIRECTION_SOUTH

static final byte DIRECTION_SOUTH
Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into south direction.

See Also:
Constant Field Values

DIRECTION_WEST

static final byte DIRECTION_WEST
Byte constant that is an argument to the main method, indicating that the connector direction to the parent node should end in a segment that can be extended by a segment that goes into west direction.

See Also:
Constant Field Values
Method Detail

determineChildConnectors

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. This method must provide for each child node a byte constant indicating the preferred direction of the connector to the subtree shape.

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

GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider,
                                              DataProvider subtreeShapeProvider,
                                              LayoutGraph graph,
                                              Node localRoot,
                                              byte parentConnectorDirection)
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.

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

createProcessor

Processor createProcessor(GenericTreeLayouter layouter,
                          LayoutGraph graph,
                          Node currentRoot)
Creates an optional Processor for pre- and post-processing.

Parameters:
layouter -
graph - the actual graph
currentRoot - the actual root node for this node placer
Returns:
a Processor or null

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