y.layout.tree
Class HVTreeLayouter

java.lang.Object
  |
  +--y.layout.CanonicMultiStageLayouter
        |
        +--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
           
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.
 double getHorizontalSpace()
          Returns the horizontal distance between adjacent nodes.
 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 layed out horizontally.
protected  boolean isVerticalRoot(Node v)
          Returns whether or not the subtree rooted at the given node should be layed out vertically.
 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, 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 layed out with this key. The looked up data provider should provide either HVTreeLayouter.HORIZONTAL_SUBTREE, HVTreeLayouter.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 layed 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 layed out vertically.


graph

protected LayoutGraph graph
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:
HVTreeLayouter.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:
HVTreeLayouter.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 layed out vertically.


isHorizontalRoot

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


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

2003