Search this API

y.layout.tree
Class AbstractRotatableNodePlacer.RootAlignment

java.lang.Object
  extended by y.layout.tree.AbstractRotatableNodePlacer.RootAlignment
Enclosing class:
AbstractRotatableNodePlacer

public abstract static class AbstractRotatableNodePlacer.RootAlignment
extends java.lang.Object

A AbstractRotatableNodePlacer.RootAlignment describes how a local root node is arranged in relation to its children.

The actual placement depends on the orientation of the subtree rooted at the current local root node. All descriptions of the provided alignments refer to the top-to-bottom orientation described by AbstractRotatableNodePlacer.Matrix.DEFAULT. In this case, the subtrees are placed below the local root and the local root is aligned horizontally above them.

 
Your browser does not support SVG content.

Field Summary
static AbstractRotatableNodePlacer.RootAlignment[] ALL
          An array containing all supported AbstractRotatableNodePlacer.RootAlignments.
static AbstractRotatableNodePlacer.RootAlignment CENTER
          Horizontal AbstractRotatableNodePlacer.RootAlignment at the center of the subtrees.
static AbstractRotatableNodePlacer.RootAlignment CENTER_OVER_CHILDREN
          Horizontal alignment at the center of the children.
static AbstractRotatableNodePlacer.RootAlignment LEADING
          Horizontal AbstractRotatableNodePlacer.RootAlignment left of the children.
static AbstractRotatableNodePlacer.RootAlignment LEFT
          Horizontal AbstractRotatableNodePlacer.RootAlignment at the left side.
static AbstractRotatableNodePlacer.RootAlignment MEDIAN
          Horizontal AbstractRotatableNodePlacer.RootAlignment at the median child node.
static AbstractRotatableNodePlacer.RootAlignment RIGHT
          Horizontal AbstractRotatableNodePlacer.RootAlignment at the right side.
static AbstractRotatableNodePlacer.RootAlignment TRAILING
          Horizontal AbstractRotatableNodePlacer.RootAlignment right of the children.
 
Constructor Summary
AbstractRotatableNodePlacer.RootAlignment()
           
 
Method Summary
protected static java.awt.geom.Rectangle2D getBounds(java.util.List shapes)
          Calculates the common bounds of the given subtree shapes.
protected abstract  void placeParentHorizontal(y.layout.tree.SubtreeShapeRotated rootShape, java.util.List shapes, java.awt.geom.Rectangle2D shapeBounds, double spacing)
          Moves the shape of the local root to a suitable position relative to the children's shapes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTER

public static final AbstractRotatableNodePlacer.RootAlignment CENTER
Horizontal AbstractRotatableNodePlacer.RootAlignment at the center of the subtrees. The root node is placed centered above its whole subgraph. To determine the alignment, only NodeLayouts are considered. Node labels are not included although they are also contained in GenericTreeLayouter.SubtreeShapes.


MEDIAN

public static final AbstractRotatableNodePlacer.RootAlignment MEDIAN
Horizontal AbstractRotatableNodePlacer.RootAlignment at the median child node. The root node is placed above the median of its children. To determine the alignment, only NodeLayouts are considered. Node labels are not included although they are also contained in GenericTreeLayouter.SubtreeShapes.

 
This alignment is only suited for NodePlacers that place all children in a single row.

LEADING

public static final AbstractRotatableNodePlacer.RootAlignment LEADING
Horizontal AbstractRotatableNodePlacer.RootAlignment left of the children. The local root node leaves a distance specified by the given spacing to the leftmost child. To determine the alignment, only NodeLayouts are considered. Node labels are not included although they are also contained in GenericTreeLayouter.SubtreeShapes.


TRAILING

public static final AbstractRotatableNodePlacer.RootAlignment TRAILING
Horizontal AbstractRotatableNodePlacer.RootAlignment right of the children. The root node leaves a distance specified by the given spacing to the rightmost child. To determine the alignment, only NodeLayouts are considered. Node labels are not included although they are also contained in GenericTreeLayouter.SubtreeShapes.


LEFT

public static final AbstractRotatableNodePlacer.RootAlignment LEFT
Horizontal AbstractRotatableNodePlacer.RootAlignment at the left side. The root node is placed left aligned with its leftmost child. To determine the alignment, only NodeLayouts are considered. Node labels are not included although they are also contained in GenericTreeLayouter.SubtreeShapes.


RIGHT

public static final AbstractRotatableNodePlacer.RootAlignment RIGHT
Horizontal AbstractRotatableNodePlacer.RootAlignment at the right side. The root node is placed right aligned with its rightmost child. To determine the alignment, only NodeLayouts are considered. Node labels are not included although they are also contained in GenericTreeLayouter.SubtreeShapes.


CENTER_OVER_CHILDREN

public static final AbstractRotatableNodePlacer.RootAlignment CENTER_OVER_CHILDREN
Horizontal alignment at the center of the children. The root node is placed centered over its direct children. To determine the alignment, only NodeLayouts are considered. Node labels are not included although they are also contained in GenericTreeLayouter.SubtreeShapes.


ALL

public static final AbstractRotatableNodePlacer.RootAlignment[] ALL
An array containing all supported AbstractRotatableNodePlacer.RootAlignments.

Constructor Detail

AbstractRotatableNodePlacer.RootAlignment

public AbstractRotatableNodePlacer.RootAlignment()
Method Detail

placeParentHorizontal

protected abstract void placeParentHorizontal(y.layout.tree.SubtreeShapeRotated rootShape,
                                              java.util.List shapes,
                                              java.awt.geom.Rectangle2D shapeBounds,
                                              double spacing)
Moves the shape of the local root to a suitable position relative to the children's shapes. The movement should only be done on the x-axis (horizontally).

This method is called by AbstractRotatableNodePlacers when they place the subtrees.

Parameters:
rootShape - the shape of the local root node that will be moved
shapes - a list of rotated subtree shapes, representing the shapes of the child nodes
shapeBounds - accumulated bounds of the shapes of all child nodes
spacing - the spacing value that should be used

getBounds

protected static java.awt.geom.Rectangle2D getBounds(java.util.List shapes)
Calculates the common bounds of the given subtree shapes.

This method can be used when placing the local root above its subtrees in method placeParentHorizontal(SubtreeShapeRotated, List, Rectangle2D, double).

Parameters:
shapes - a list of rotated subtree shapes
Returns:
the rectangle describing the bounds containing all given shapes

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