Search this API

y.layout.tree
Class HVTreeLayouter

java.lang.Object
  extended by y.layout.CanonicMultiStageLayouter
      extended by y.layout.tree.HVTreeLayouter
All Implemented Interfaces:
Layouter

public class HVTreeLayouter
extends CanonicMultiStageLayouter

This tree layouter allows to layout a tree such that each subgraph rooted at a node can either have a horizontal or vertical layout.

Here is an sample output of the layouter


Field Summary
protected  LayoutGraph graph
          The layout graph being acted upon.
static Object HORIZONTAL_SUBTREE
          Subtree orientation specifier.
static Object SUBTREE_ORIENTATION
          The data provider key used to specify the subtree orientation of each node in the tree.
static Object VERTICAL_SUBTREE
          Subtree orientation specifier.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
HVTreeLayouter()
           
 
Method Summary
 boolean canLayoutCore(LayoutGraph graph)
          The core layouter can layout trees.
 void doLayoutCore(LayoutGraph graph)
          Core layout routine.
 Comparator getComparator()
          Returns the Comparator that will be used to sort the outgoing edges of each local root in the tree before they are being arranged.
 double getHorizontalSpace()
          Returns the horizontal distance between adjacent nodes.
protected  NodeCursor getSuccessors(Node localParent)
           
 double getVerticalSpace()
          Returns the vertical distance between adjacent nodes.
protected  boolean isHorizontalRoot(Node v)
          Returns whether or not the subtree rooted at the given node should be laid out horizontally.
protected  boolean isVerticalRoot(Node v)
          Returns whether or not the subtree rooted at the given node should be laid out vertically.
 void setComparator(Comparator comparator)
          Sets the Comparator that will be used to sort the outgoing edges of each local root in the tree before they are being arranged.
 void setHorizontalSpace(double hspace)
          Sets the horizontal distance between adjacent nodes.
 void setVerticalSpace(double vspace)
          Sets the vertical distance between adjacent nodes.
 
Methods inherited from class y.layout.CanonicMultiStageLayouter
appendStage, calcLayout, calcLayout, canLayout, checkGroupNodeSize, checkNodeSize, doLayout, doLayout, enableOnlyCore, getComponentLayouter, getGroupNodeHider, getLabelLayouter, getLayoutOrientation, getOrientationLayouter, getParallelEdgeLayouter, getSelfLoopLayouter, getSubgraphLayouter, isComponentLayouterEnabled, isGroupNodeHidingEnabled, isLabelLayouterEnabled, isOrientationLayouterEnabled, isParallelEdgeLayouterEnabled, isSelfLoopLayouterEnabled, isSubgraphLayouterEnabled, prependStage, removeStage, setComponentLayouter, setComponentLayouterEnabled, setGroupNodeHider, setGroupNodeHidingEnabled, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setOrientationLayouterEnabled, setParallelEdgeLayouter, setParallelEdgeLayouterEnabled, setSelfLoopLayouter, setSelfLoopLayouterEnabled, setSubgraphLayouter, setSubgraphLayouterEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBTREE_ORIENTATION

public static final Object SUBTREE_ORIENTATION
The data provider key used to specify the subtree orientation of each node in the tree. This layout algorithm will try to retrieve a data provider from the tree to be laid out with this key. The looked up data provider should provide either HORIZONTAL_SUBTREE, VERTICAL_SUBTREE


HORIZONTAL_SUBTREE

public static final Object HORIZONTAL_SUBTREE
Subtree orientation specifier. This specifier indicated that the subtree rooted at the associated node should be laid out horizontally.


VERTICAL_SUBTREE

public static final Object VERTICAL_SUBTREE
Subtree orientation specifier. This specifier indicated that the subtree rooted at the associated node should be laid out vertically.


graph

protected LayoutGraph graph
The layout graph being acted upon.

Constructor Detail

HVTreeLayouter

public HVTreeLayouter()
Method Detail

setHorizontalSpace

public void setHorizontalSpace(double hspace)
Sets the horizontal distance between adjacent nodes. By default a value of 10 is set.


getHorizontalSpace

public double getHorizontalSpace()
Returns the horizontal distance between adjacent nodes.

See Also:
setHorizontalSpace(double)

setVerticalSpace

public void setVerticalSpace(double vspace)
Sets the vertical distance between adjacent nodes. By default a value of 10 is set.


getVerticalSpace

public double getVerticalSpace()
Returns the vertical distance between adjacent nodes.

See Also:
setVerticalSpace(double)

doLayoutCore

public void doLayoutCore(LayoutGraph graph)
Core layout routine.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter

canLayoutCore

public boolean canLayoutCore(LayoutGraph graph)
The core layouter can layout trees.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter

isVerticalRoot

protected boolean isVerticalRoot(Node v)
Returns whether or not the subtree rooted at the given node should be laid out vertically.


isHorizontalRoot

protected boolean isHorizontalRoot(Node v)
Returns whether or not the subtree rooted at the given node should be laid out horizontally.


getSuccessors

protected NodeCursor getSuccessors(Node localParent)

getComparator

public Comparator getComparator()
Returns the Comparator that will be used to sort the outgoing edges of each local root in the tree before they are being arranged. The default value is null which indicates that the algorithm should use its built-in logic.

Returns:
The comparator to use or null if the default order should be used.
See Also:
setComparator(java.util.Comparator)

setComparator

public void setComparator(Comparator comparator)
Sets the Comparator that will be used to sort the outgoing edges of each local root in the tree before they are being arranged. The default value is null which indicates that the algorithm should use its built-in logic.

Parameters:
comparator - the new comparator to use or null if the default order should be used.
See Also:
getComparator()

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