Packagecom.yworks.yfiles.layout.tree
Classpublic class TreeLayouter
InheritanceTreeLayouter Inheritance CanonicMultiStageLayouter Inheritance YObject Inheritance Object

Implementation of a layout algorithm for trees.

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

See also

ORTHOGONAL_STYLE


Public Properties
 PropertyDefined By
  busAlignment : Number
Specifies the vertical bus alignment for orthogonally routed edge buses.
TreeLayouter
  childPlacementPolicy : int
Specifies the layout policy for leaf nodes.
TreeLayouter
  comparator : Comparator
Specifies the comparator for outgoing edges at a node This comparator defines the relative order of the child nodes in the layout to be calculated.
TreeLayouter
 InheritedcomponentLayouter : LayoutStage
Specifies the LayoutStage responsible for laying out the connected components of the graph.
CanonicMultiStageLayouter
 InheritedcomponentLayouterEnabled : Boolean
Getter: Returns whether or not ComponentLayouter is enabled.
CanonicMultiStageLayouter
  enforceGlobalLayering : Boolean
Specifies whether or not global layering is enforced.
TreeLayouter
  groupingSupported : Boolean
Whether or not grouping support should be enabled.
TreeLayouter
 InheritedgroupNodeHider : LayoutStage
Specifies the LayoutStage that is responsible for hiding away grouping information for the layout algorithm.
CanonicMultiStageLayouter
 InheritedhideGroupNodes : Boolean
Specifies whether or not to hide away group nodes before the layout begins.
CanonicMultiStageLayouter
  integratedEdgeLabeling : Boolean
Specifies whether integrated edge labeling is enabled.
TreeLayouter
  integratedNodeLabeling : Boolean
Specifies whether integrated node labeling is enabled.
TreeLayouter
 InheritedlabelLayouter : LayoutStage
Getter: Returns the algorithm used for placing labels.
CanonicMultiStageLayouter
 InheritedlabelLayouterEnabled : Boolean
Getter: Returns whether or not LabelLayouter is enabled.
CanonicMultiStageLayouter
 InheritedlayoutOrientation : int
Specifies the main layout orientation.
CanonicMultiStageLayouter
  layoutStyle : int
Specifies the layout style of this layouter.
TreeLayouter
  minimalLayerDistance : Number
Specifies the minimal distance between adjacent layers for the layout.
TreeLayouter
  minimalNodeDistance : Number
Getter: Returns the minimum horizontal distance between adjacent nodes for this layouter.
TreeLayouter
  modificationMatrix : AbstractRotatableNodePlacer_Matrix
Specifies the modification matrix that is used to rotate / mirror the tree layout.
TreeLayouter
 InheritedorientationLayouter : LayoutStage
Specifies the LayoutStage that is responsible for changing the orientation of the computed layout.
CanonicMultiStageLayouter
 InheritedorientationLayouterEnabled : Boolean
Getter: Returns whether or not the OrientationLayouter is enabled.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouter : LayoutStage
Getter: Returns the LayoutStage responsible for routing parallel edges.
CanonicMultiStageLayouter
 InheritedparallelEdgeLayouterEnabled : Boolean
Getter: Returns whether or not the ParallelEdgeLayouter is enabled.
CanonicMultiStageLayouter
  portStyle : int
Specifies the port assignment style.
TreeLayouter
 InheritedselfLoopLayouter : LayoutStage
Getter: Returns the LayoutStage used for routing Self-loops.
CanonicMultiStageLayouter
 InheritedselfLoopLayouterEnabled : Boolean
Getter: Returns whether or not the SelfLoopLayouter is enabled.
CanonicMultiStageLayouter
 InheritedsubgraphLayouter : LayoutStage
Specifies the LayoutStage that is responsible for constraining the layout process to a subgraph of the target graph.
CanonicMultiStageLayouter
 InheritedsubgraphLayouterEnabled : Boolean
Getter: Returns whether or not the SubgraphLayouter is enabled.
CanonicMultiStageLayouter
  verticalAlignment : Number
Specifies the relative vertical alignment of nodes within their respective layers.
TreeLayouter
Public Methods
 MethodDefined By
  
TreeLayouter(init:Boolean = true)
Creates a new instance of TreeLayouter.
TreeLayouter
 Inherited
Appends a stage to the layout pipeline.
CanonicMultiStageLayouter
 Inherited
Returns a layout for the given layout graph.
CanonicMultiStageLayouter
 Inherited
Returns a layout for the given graph interface and layout.
CanonicMultiStageLayouter
 Inherited
canLayout(graph:LayoutGraph):Boolean
Tests whether or not the given graph can be laid out by this layouter.
CanonicMultiStageLayouter
  
canLayoutCore(graph:LayoutGraph):Boolean
[override] Returns true if the core layouter can layout the given graph structure.
TreeLayouter
 Inherited
doLayout(layoutGraph:LayoutGraph):void
Calculates a layout for the given graph.
CanonicMultiStageLayouter
 Inherited
Calculates a layout for the given graph interface and layout.
CanonicMultiStageLayouter
  
[override] Starts the tree layout process
TreeLayouter
 Inherited
Disables all layout stages and performs only the core layouter.
CanonicMultiStageLayouter
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
TreeLayouter
 Inherited
hashCode():int
YObject
  
[static] Creates a new instance of TreeLayouter.
TreeLayouter
 Inherited
Prepends a stage to the layout pipeline.
CanonicMultiStageLayouter
 Inherited
Removes a LayoutStage that has been previously added by the methods appendStage() or prependStage().
CanonicMultiStageLayouter
Protected Methods
 MethodDefined By
 Inherited
checkGroupNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given group node object is zero.
CanonicMultiStageLayouter
 Inherited
checkNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given node object is zero.
CanonicMultiStageLayouter
 Inherited
CanonicMultiStageLayouter
  
Initializes this object.
TreeLayouter
Public Constants
 ConstantDefined By
  BORDER_CENTER_PORTS : int = 1
[static] Port style constant.
TreeLayouter
  BORDER_DISTRIBUTED_PORTS : int = 2
[static] Port style constant.
TreeLayouter
  CHILD_PLACEMENT_POLICY_ALL_LEAVES_ON_SAME_LAYER : int = 4
[static] Symbolic child placement policy specifier.
TreeLayouter
  CHILD_PLACEMENT_POLICY_LEAVES_STACKED : int = 0
[static] Symbolic child placement policy specifier.
TreeLayouter
  CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT : int = 1
[static] Symbolic child placement policy specifier.
TreeLayouter
  CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHT : int = 3
[static] Symbolic child placement policy specifier.
TreeLayouter
  CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHT : int = 2
[static] Symbolic child placement policy specifier.
TreeLayouter
  CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYER : int = 5
[static] Symbolic child placement policy specifier.
TreeLayouter
  NODE_CENTER_PORTS : int = 0
[static] Port style constant.
TreeLayouter
  ORTHOGONAL_STYLE : int = 1
[static] Layout style constant.
TreeLayouter
  PLAIN_STYLE : int = 0
[static] Layout style constant.
TreeLayouter
  PORT_CONSTRAINTS_AWARE : int = 3
[static] Port style constant.
TreeLayouter
Property Detail
busAlignmentproperty
busAlignment:Number

Specifies the vertical bus alignment for orthogonally routed edge buses. The bus alignment determines the relative position of an edge bus in between two subsequent layers of nodes. A value of 0 places the bus at the top right below the parent node; a value of 0.5 places the bus in the middle between parent and child nodes; and a value of 1 places the bus at the bottom right above the child nodes.

Bus alignment is taken into account only for

Defaults to 0.3.


Implementation
    public function get busAlignment():Number
    public function set busAlignment(value:Number):void

See also

childPlacementPolicyproperty 
childPlacementPolicy:int

Specifies the layout policy for leaf nodes.

Defaults to CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYER.


Implementation
    public function get childPlacementPolicy():int
    public function set childPlacementPolicy(value:int):void

Throws
IllegalArgumentException — if the specified policy does not match one of the leaf layout policy constants.

See also

comparatorproperty 
comparator:Comparator

Specifies the comparator for outgoing edges at a node This comparator defines the relative order of the child nodes in the layout to be calculated. By default com.yworks.yfiles.layout.tree.XCoordComparator is set.


Implementation
    public function get comparator():Comparator
    public function set comparator(value:Comparator):void

See also

enforceGlobalLayeringproperty 
enforceGlobalLayering:Boolean

Specifies whether or not global layering is enforced. If this feature is enabled, the algorithm ensures that nodes never span more than one layer. Otherwise, a large node might span two, three, etc layers of smaller nodes to produce a more compact layout.

Disabling this feature to generate more compact layouts will usually result in the algorithm ignoring the specified relative vertical alignment for nodes.

By default, this feature is enabled.


Implementation
    public function get enforceGlobalLayering():Boolean
    public function set enforceGlobalLayering(value:Boolean):void

See also

groupingSupportedproperty 
groupingSupported:Boolean

Whether or not grouping support should be enabled. Note that the grouping only works correctly, if each group represents a complete subtree. This means that for each group there is a node v such that the group contains exactly v and all its descendants.


Implementation
    public function get groupingSupported():Boolean
    public function set groupingSupported(value:Boolean):void
integratedEdgeLabelingproperty 
integratedEdgeLabeling:Boolean

Specifies whether integrated edge labeling is enabled.


Implementation
    public function get integratedEdgeLabeling():Boolean
    public function set integratedEdgeLabeling(value:Boolean):void
integratedNodeLabelingproperty 
integratedNodeLabeling:Boolean

Specifies whether integrated node labeling is enabled.


Implementation
    public function get integratedNodeLabeling():Boolean
    public function set integratedNodeLabeling(value:Boolean):void
layoutStyleproperty 
layoutStyle:int

Specifies the layout style of this layouter.


Implementation
    public function get layoutStyle():int
    public function set layoutStyle(value:int):void

See also

minimalLayerDistanceproperty 
minimalLayerDistance:Number

Specifies the minimal distance between adjacent layers for the layout. Default value is 40.0.


Implementation
    public function get minimalLayerDistance():Number
    public function set minimalLayerDistance(value:Number):void
minimalNodeDistanceproperty 
minimalNodeDistance:Number

Getter: Returns the minimum horizontal distance between adjacent nodes for this layouter.

Setter: Sets the minimum distance between adjacent nodes within a layer. Default value is 20.0.


Implementation
    public function get minimalNodeDistance():Number
    public function set minimalNodeDistance(value:Number):void
modificationMatrixproperty 
modificationMatrix:AbstractRotatableNodePlacer_Matrix

Specifies the modification matrix that is used to rotate / mirror the tree layout.


Implementation
    public function get modificationMatrix():AbstractRotatableNodePlacer_Matrix
    public function set modificationMatrix(value:AbstractRotatableNodePlacer_Matrix):void
portStyleproperty 
portStyle:int

Specifies the port assignment style.


Implementation
    public function get portStyle():int
    public function set portStyle(value:int):void

See also

verticalAlignmentproperty 
verticalAlignment:Number

Specifies the relative vertical alignment of nodes within their respective layers. A value of 0 means nodes are top aligned; a value of 1 means nodes are bottom aligned.

If global layering is not enforced, the value of this property is usually ignored.

Defaults to 0.5, i.e. nodes are center aligned.


Implementation
    public function get verticalAlignment():Number
    public function set verticalAlignment(value:Number):void

See also

Constructor Detail
TreeLayouter()Constructor
public function TreeLayouter(init:Boolean = true)

Creates a new instance of TreeLayouter.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
canLayoutCore()method
override public function canLayoutCore(graph:LayoutGraph):Boolean

Returns true if the core layouter can layout the given graph structure. This is the case if the graph is a tree.

Parameters

graph:LayoutGraph

Returns
Boolean
doLayoutCore()method 
override public function doLayoutCore(graph:LayoutGraph):void

Starts the tree layout process

Parameters

graph:LayoutGraph

getClass()method 
override public function getClass():Class

Returns
Class
initTreeLayouter()method 
protected final function initTreeLayouter():void

Initializes this object. See the documentation of the corresponding factory method newTreeLayouter() for details.

See also

newTreeLayouter()method 
public static function newTreeLayouter():TreeLayouter

Creates a new instance of TreeLayouter.

Returns
TreeLayouter
Constant Detail
BORDER_CENTER_PORTSConstant
public static const BORDER_CENTER_PORTS:int = 1

Port style constant. Ports will lie at the center of a node border.

See also

BORDER_DISTRIBUTED_PORTSConstant 
public static const BORDER_DISTRIBUTED_PORTS:int = 2

Port style constant. Ports will be distributed evenly on the side of a node.

See also

CHILD_PLACEMENT_POLICY_ALL_LEAVES_ON_SAME_LAYERConstant 
public static const CHILD_PLACEMENT_POLICY_ALL_LEAVES_ON_SAME_LAYER:int = 4

Symbolic child placement policy specifier. This results in a Dendrogram-style layout with all leaf nodes being placed in one layer (i.e. all leaves are being placed on one horizontal line in a top to bottom or bottom to top layout). A Dendrogram layout is often applied in computational biology in order to show clustering of genes.

See also

CHILD_PLACEMENT_POLICY_LEAVES_STACKEDConstant 
public static const CHILD_PLACEMENT_POLICY_LEAVES_STACKED:int = 0

Symbolic child placement policy specifier. This setting configures the algorithm for a stacked style of leaf nodes. In this context, stacked means that leaf nodes that connect to the same root node are placed one upon the other. This results in horizontally compact layouts. Additionally, this policy tries to balance stack heights. I.e. for each subtree that consists of leaf nodes only, CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHT or CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHT will be used depending on the number of leaves in the subtree.

See also

CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFTConstant 
public static const CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT:int = 1

Symbolic child placement policy specifier. This setting configures the algorithm for a stacked style of leaf nodes. In this context, stacked means that leaf nodes that connect to the same root node are placed one upon the other. This results in horizontally compact layouts. Moreover, the stack of leaf nodes is on the left.

See also

CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHTConstant 
public static const CHILD_PLACEMENT_POLICY_LEAVES_STACKED_LEFT_AND_RIGHT:int = 3

Symbolic child placement policy specifier. This setting configures the algorithm for a stacked style of leaf nodes. In this context, stacked means that leaf nodes that connect to the same root node are placed one upon the other. This results in horizontally compact layouts. Moreover, leaf nodes are distributed among two stacks, one on the left and one on the right.

See also

CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHTConstant 
public static const CHILD_PLACEMENT_POLICY_LEAVES_STACKED_RIGHT:int = 2

Symbolic child placement policy specifier. This setting configures the algorithm for a stacked style of leaf nodes. In this context, stacked means that leaf nodes that connect to the same root node are placed one upon the other. This results in horizontally compact layouts. Moreover, the stack of leaf nodes is on the right.

See also

CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYERConstant 
public static const CHILD_PLACEMENT_POLICY_SIBLINGS_ON_SAME_LAYER:int = 5

Symbolic child placement policy specifier. This setting configures the algorithm to place siblings (leaf nodes with the same parent node) in the same layer (i.e. siblings are being placed on one horizontal line in a top to bottom or bottom to top layout).

See also

NODE_CENTER_PORTSConstant 
public static const NODE_CENTER_PORTS:int = 0

Port style constant. Uses (0,0) as port offset.

See also

ORTHOGONAL_STYLEConstant 
public static const ORTHOGONAL_STYLE:int = 1

Layout style constant. Draw edges orthogonally in a bus-like fashion.

See also

PLAIN_STYLEConstant 
public static const PLAIN_STYLE:int = 0

Layout style constant. Draw edges as straight lines.

See also

PORT_CONSTRAINTS_AWAREConstant 
public static const PORT_CONSTRAINTS_AWARE:int = 3

Port style constant. The specified port constraints will be considered.

See also