y.layout.tree
Class TreeLayouter

java.lang.Object
  |
  +--y.layout.CanonicMultiStageLayouter
        |
        +--y.layout.tree.TreeLayouter
All Implemented Interfaces:
Layouter

public class TreeLayouter
extends CanonicMultiStageLayouter

This class is an layouter for trees.

Here is an sample output of the layouter using left to right orientation and TreeLayouter.ORTHOGONAL_STYLE layout style.


Field Summary
static int BORDER_CENTER_PORTS
          Port style constant.
static int BORDER_DISTRIBUTED_PORTS
          Port style constant.
static int NODE_CENTER_PORTS
          Port style constant.
static int ORTHOGONAL_STYLE
          Layout style constant.
static int PLAIN_STYLE
          Layout style constant.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
TreeLayouter()
          Creates a new instance of TreeLayouter.
 
Method Summary
 boolean canLayoutCore(LayoutGraph graph)
          Returns true iff the core layouter can layout the given graph structure.
 void doLayoutCore(LayoutGraph graph)
          Starts the tree layout process
 Comparator getComparator()
          Returns the comparator for outgoing edges at a node This comparator defines the relative order of the child nodes in the layout to be calculated.
 int getLayoutStyle()
          Returns the current layout style of this layouter
 double getMinimalLayerDistance()
          Returns the minimal distance between adjacent layers for the layout.
 double getMinimalNodeDistance()
          Returns the minimum horizontal distance between adjacent nodes for this layouter.
 int getPortStyle()
          Gets the port assignment style.
 void setComparator(Comparator c)
          Sets the comparator for outgoing edges at a node This comparator defines the relative order of the child nodes in the layout to be calculated.
 void setLayoutStyle(int style)
          Sets the layout style of this layouter.
 void setMinimalLayerDistance(double dist)
          Sets the minimal distance between adjacent layers for the layout.
 void setMinimalNodeDistance(double dist)
          Sets the minimum distance between adjacent nodes within a layer.
 void setPortStyle(int style)
          Sets the port assignment style.
 
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

NODE_CENTER_PORTS

public static final int NODE_CENTER_PORTS
Port style constant. Uses (0,0) as port offset.

See Also:
TreeLayouter.setPortStyle(int), Constant Field Values

BORDER_CENTER_PORTS

public static final int BORDER_CENTER_PORTS
Port style constant. Ports will lie at the center of a node border.

See Also:
TreeLayouter.setPortStyle(int), Constant Field Values

BORDER_DISTRIBUTED_PORTS

public static final int BORDER_DISTRIBUTED_PORTS
Port style constant. Ports will be distributed evenly on the side of a node.

See Also:
TreeLayouter.setPortStyle(int), Constant Field Values

PLAIN_STYLE

public static final int PLAIN_STYLE
Layout style constant. Draw edges as straight lines

See Also:
Constant Field Values

ORTHOGONAL_STYLE

public static final int ORTHOGONAL_STYLE
Layout style constant. Draw edges orthogonally in a bus-like fashion

See Also:
Constant Field Values
Constructor Detail

TreeLayouter

public TreeLayouter()
Creates a new instance of TreeLayouter.

Method Detail

setComparator

public void setComparator(Comparator c)
Sets the comparator for outgoing edges at a node This comparator defines the relative order of the child nodes in the layout to be calculated. Bye default XCoordComparator is set.


getComparator

public Comparator getComparator()
Returns the comparator for outgoing edges at a node This comparator defines the relative order of the child nodes in the layout to be calculated.


setPortStyle

public void setPortStyle(int style)
Sets the port assignment style.

Parameters:
style - one of the constants TreeLayouter.NODE_CENTER_PORTS, TreeLayouter.BORDER_CENTER_PORTS, or TreeLayouter.BORDER_DISTRIBUTED_PORTS.

getPortStyle

public int getPortStyle()
Gets the port assignment style.

See Also:
TreeLayouter.setPortStyle(int)

setLayoutStyle

public void setLayoutStyle(int style)
Sets the layout style of this layouter.

See Also:
TreeLayouter.PLAIN_STYLE, TreeLayouter.ORTHOGONAL_STYLE

getLayoutStyle

public int getLayoutStyle()
Returns the current layout style of this layouter


setMinimalNodeDistance

public void setMinimalNodeDistance(double dist)
Sets the minimum distance between adjacent nodes within a layer. Default value is 20.0.


getMinimalNodeDistance

public double getMinimalNodeDistance()
Returns the minimum horizontal distance between adjacent nodes for this layouter.


setMinimalLayerDistance

public void setMinimalLayerDistance(double dist)
Sets the minimal distance between adjacent layers for the layout. Default value is 40.0.


getMinimalLayerDistance

public double getMinimalLayerDistance()
Returns the minimal distance between adjacent layers for the layout.


canLayoutCore

public boolean canLayoutCore(LayoutGraph graph)
Returns true iff the core layouter can layout the given graph structure. This is the case iff the graph is a tree.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter

doLayoutCore

public void doLayoutCore(LayoutGraph graph)
Starts the tree layout process

Specified by:
doLayoutCore in class CanonicMultiStageLayouter

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

2003