Search this API

y.layout.tree
Class DelegatingNodePlacer

java.lang.Object
  extended by y.layout.tree.AbstractRotatableNodePlacer
      extended by y.layout.tree.DelegatingNodePlacer
All Implemented Interfaces:
FromSketchNodePlacer, NodePlacer

public class DelegatingNodePlacer
extends AbstractRotatableNodePlacer

The DelegatingNodePlacer may be used to layout the children of the actual node with two different NodePlacers.


Nested Class Summary
 
Nested classes/interfaces inherited from class y.layout.tree.AbstractRotatableNodePlacer
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment
 
Field Summary
static byte HORIZONTAL
          Orientation specifier.
static byte VERTICAL
          Orientation specifier.
 
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
DelegatingNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix, NodePlacer placerUpperLeft, NodePlacer placerLowerRight)
          Creates a new instance using the given modification matrix an the node placers "this" delegates to.
 
Method Summary
 Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
          Creates a processor that partitions child nodes of the specified root node into two subsets, one to be arranged by the "upper left" NodePlacer and one to be arranged by the "lower right" NodePlacer.
protected  byte determineChildConnector(Node child)
          This method must be implemented by subclasses.
 void determineChildConnectors(Node localRoot, DataMap connectorMap)
          This method initializes internal data structures, then uses the abstract method AbstractRotatableNodePlacer.determineChildConnector(y.base.Node) to determine the child node connector directions.
protected  NodeList getLowerRightChildren(Node localRoot)
          Determines the lower right children of the specified root node.
 byte getOrientation()
          Returns the orientation according to which node shapes are aligned by this placer.
 NodePlacer getPlacerLowerRight()
          Returns the NodePlacer that is used to layout the nodes on the "lower right"
 NodePlacer getPlacerUpperLeft()
          Returns the NodePlacer that is used to layout the nodes on the "upper left"
protected  NodeList getUpperLeftChildren(Node localRoot)
          Determines the upper left children of the specified root node.
 GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider, DataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, byte parentConnectorDirection)
          Places the shapes of the children using the two node placers getUpperLeftChildren(y.base.Node) and getLowerRightChildren(y.base.Node).
protected  y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot, byte parentConnectorDirection)
          This method must be implemented by subclasses.
 void setOrientation(byte orientation)
          Specifies the orientation according to which node shapes are aligned by this placer.
 
Methods inherited from class y.layout.tree.AbstractRotatableNodePlacer
createComparator, createFromSketchComparator, createRootNodeShape, createSubtreeShape, getModificationMatrix, getPortConstraint, getSourcePointAbs, getSpacing, setSpacing, translateDirectionToModel, translateDirectionToReal, translatePoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final byte HORIZONTAL
Orientation specifier. Node shapes will be aligned on the x-axis.

See Also:
setOrientation(byte), getOrientation(), Constant Field Values

VERTICAL

public static final byte VERTICAL
Orientation specifier. Node shapes will be aligned on the y-axis.

See Also:
setOrientation(byte), getOrientation(), Constant Field Values
Constructor Detail

DelegatingNodePlacer

public DelegatingNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix,
                            NodePlacer placerUpperLeft,
                            NodePlacer placerLowerRight)
Creates a new instance using the given modification matrix an the node placers "this" delegates to.

Method Detail

createProcessor

public Processor createProcessor(GenericTreeLayouter layouter,
                                 LayoutGraph graph,
                                 Node currentRoot)
Creates a processor that partitions child nodes of the specified root node into two subsets, one to be arranged by the "upper left" NodePlacer and one to be arranged by the "lower right" NodePlacer.

Specified by:
createProcessor in interface NodePlacer
Overrides:
createProcessor in class AbstractRotatableNodePlacer
graph - the actual graph
currentRoot - the actual root node for this node placer
Returns:
a Processor or null
See Also:
getPlacerLowerRight(), getPlacerUpperLeft()

determineChildConnectors

public void determineChildConnectors(Node localRoot,
                                     DataMap connectorMap)
Description copied from class: AbstractRotatableNodePlacer
This method initializes internal data structures, then uses the abstract method AbstractRotatableNodePlacer.determineChildConnector(y.base.Node) to determine the child node connector directions.

Specified by:
determineChildConnectors in interface NodePlacer
Overrides:
determineChildConnectors in class AbstractRotatableNodePlacer
Parameters:
localRoot - the local root node
connectorMap - the map that will be used to store the values
See Also:
AbstractRotatableNodePlacer.determineChildConnector(Node)

placeSubtree

public GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider,
                                                     DataProvider subtreeShapeProvider,
                                                     LayoutGraph graph,
                                                     Node localRoot,
                                                     byte parentConnectorDirection)
Places the shapes of the children using the two node placers getUpperLeftChildren(y.base.Node) and getLowerRightChildren(y.base.Node).

Specified by:
placeSubtree in interface NodePlacer
Overrides:
placeSubtree in class AbstractRotatableNodePlacer
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 subtree shape for the given local root.
See Also:
AbstractRotatableNodePlacer.placeSubtree(Node, byte)

getLowerRightChildren

protected NodeList getLowerRightChildren(Node localRoot)
Determines the lower right children of the specified root node. These nodes are placed using the NodePlacer returned by getPlacerLowerRight().

Returns:
a NodeList containing the lower right nodes.

getUpperLeftChildren

protected NodeList getUpperLeftChildren(Node localRoot)
Determines the upper left children of the specified root node. These nodes are placed using the NodePlacer returned by getPlacerUpperLeft().

Returns:
a NodeList containing the upper left nodes.

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

setOrientation

public void setOrientation(byte orientation)
Specifies the orientation according to which node shapes are aligned by this placer. Depending on the orientation the shapes are aligned on the x- or y-axis.

Parameters:
orientation - one of
See Also:
getOrientation()

getOrientation

public byte getOrientation()
Returns the orientation according to which node shapes are aligned by this placer.

Returns:
The orientation according to which node shapes are aligned by this placer.
See Also:
setOrientation(byte)

getPlacerLowerRight

public NodePlacer getPlacerLowerRight()
Returns the NodePlacer that is used to layout the nodes on the "lower right"

Returns:
the NodePlacer that is used to layout the nodes on the "lower right".

getPlacerUpperLeft

public NodePlacer getPlacerUpperLeft()
Returns the NodePlacer that is used to layout the nodes on the "upper left"

Returns:
the NodePlacer that is used to layout the nodes on the "upper left"

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