Search this API

y.layout.tree
Class GenericTreeLayouter

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

public class GenericTreeLayouter
extends CanonicMultiStageLayouter

This layout algorithm arranges graphs with a tree structure.

Layout Style

GenericTreeLayouter provides multiple different arrangements of trees and subtrees. It is easy to customize the order of edges, the port assignment and the arrangement of the nodes for each subtree.

Tree layout algorithms are commonly applied to visualize relational data and produce diagrams of high quality that are able to reveal possible hierarchic properties of the graph. More precisely, they find applications in dataflow analysis, software engineering, bioinformatics and business administration.


Example graph with a layout calculated by GenericTreeLayouter using default settings


Tree layout using different NodePlacers and rotations

Concept

The layout algorithm starts from the leaves and continues with their parents, then with the parents of the parents and so on. When a node is processed, the algorithm will use the corresponding NodePlacer instance to move its children (along with their subtrees) to a suitable position and to route the outgoing edges of this node. Then, the next local root node will be processed.

To avoid moving all nodes several times and to know the area that the subtrees occupy, the layout algorithm uses GenericTreeLayouter.SubtreeShapes. These GenericTreeLayouter.SubtreeShapes are moved and merged during layout calculation.

Features

Each subtree can have a different style of node placement. NodePlacers are responsible for arranging subtrees and their common root node. They can be specified separately for each local root with a DataProvider registered with the graph using key NODE_PLACER_DPKEY.

A custom node can be defined as root of the tree using a DataProvider registered with the graph with key SELECTED_ROOT_DPKEY.

The layout algorithm can be configured to reserve space for node labels and place the edge labels along edges such that the labels won't overlap with other graph elements. Edge labels are placed according to the information stored in a PreferredPlacementDescriptor instance. However, the placement along the edge will only affect the order of multiple labels at the same edge. The algorithm will always place the labels close to the target node.

Grouping of nodes can also be handled by this layout algorithm. It is important that a group node contains a whole subtree. Otherwise, the group nodes may overlap with each other or with other nodes. Furthermore, the user may specify minimum size constraints for each group node using DataProvider key GroupingKeys.MINIMUM_NODE_SIZE_DPKEY.

GenericTreeLayouter supports custom sorting of the outgoing edges of a node. For example, a NodePlacer instance that implements FromSketchNodePlacer provides a comparator that keeps the current order of siblings, allowing to extend the graph incrementally.

This layout algorithm can only handle graphs with a tree structure. To apply it to a general graph, a TreeReductionStage can be appended. This stage will temporarily remove some edges of the input graph until a tree is obtained. After the layout calculation, the stage will reinsert the edges that were removed and route them separately.

 

Nested Class Summary
static class GenericTreeLayouter.SubtreeShape
          A GenericTreeLayouter.SubtreeShape represents the position and the borders of a subtree.
 
Field Summary
static java.lang.Object CHILD_COMPARATOR_DPKEY
          A DataProvider key for specifying the comparator for the outgoing edges.
static java.lang.Object CRITICAL_EDGE_DPKEY
          A DataProvider key for defining the priority of critical edges.
protected  LayoutGraph graph
          The input graph for which a layout is calculated.
static java.lang.Object MULTI_PARENT_DESCRIPTOR_DPKEY
          A DataProvider key for retrieving descriptors for nodes in multi-parent structures.
static java.lang.Object NODE_PLACER_DPKEY
          A DataProvider key for specifying a child node placer for each node.
static java.lang.Object PORT_ASSIGNMENT_DPKEY
          A DataProvider key for assigning ports to nodes.
static java.lang.Object SELECTED_ROOT_DPKEY
          A DataProvider key for marking the node that will be used as root node of the tree.
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
GenericTreeLayouter()
          Creates a new GenericTreeLayouter instance with default settings.
 
Method Summary
protected  boolean canLayoutCore(LayoutGraph graph)
          Accepts only graphs that are trees.
protected  EdgeList directTree()
          Returns a list of edges that need to be reversed in order to obtain a valid rooted and directed tree from the input graph.
protected  void doLayoutCore(LayoutGraph graph)
          Arranges the given graph as a tree.
protected  java.util.Comparator getChildNodeInEdgeComparator(Node localRoot)
          Returns the Comparator instance that will sort the outgoing edges connecting to the given node.
 java.util.Comparator getDefaultChildComparator()
          Returns the default Comparator instance that sorts the outgoing edges in all subtrees that do not have a specific Comparator assigned using a DataProvider.
 NodePlacer getDefaultLeafPlacer()
          Returns the default NodePlacer instance that places the leaf nodes of the tree.
 NodePlacer getDefaultNodePlacer()
          Returns the default NodePlacer instance that arranges all subtrees that do not have a specific NodePlacer assigned using a DataProvider.
 PortAssignment getDefaultPortAssignment()
          Returns the default PortAssignment instance for all subtrees that do not have a specific PortAssignment assigned using a DataProvider.
protected  NodePlacer getNodePlacer(Node localRoot)
          Returns the NodePlacer instance that is used for the placement of the local root node and the GenericTreeLayouter.SubtreeShapes.
protected  GenericTreeLayouter.SubtreeShape getNodeShape(Node node)
          Creates a GenericTreeLayouter.SubtreeShape for the given node that consists only of the bounds of this particular node.
protected  PortAssignment getPortAssignment(Node localRoot)
          Returns the PortAssignment instance that places the ports of the connecting edges of the given node.
protected  Node[] getRootsArray(Node root)
          Returns an array of the nodes that will be laid out.
protected  DataAcceptor getSourceGroupDataAcceptor()
          Returns a DataAcceptor that can be used for temporarily overwriting the source group information used during the layout.
protected  DataAcceptor getSourcePortConstraintDataAcceptor()
          Returns a DataAcceptor that can overwrite the source port contraint temporarily used during the layout.
protected  GenericTreeLayouter.SubtreeShape getSubtreeShape(Node localRoot)
          Provides access to the GenericTreeLayouter.SubtreeShape for the given node.
protected  DataAcceptor getTargetGroupDataAcceptor()
          Returns a DataAcceptor that can be used for temporarily overwriting the target group information used during the layout.
protected  DataAcceptor getTargetPortConstraintDataAcceptor()
          Returns a DataAcceptor that can overwrite the target port contraint temporarily used during the layout.
 boolean isGroupingSupported()
          Returns whether or not group nodes are handled by the layout algorithm.
 boolean isIntegratedEdgeLabeling()
          Returns whether or not edge labels are placed by the layout algorithm.
 boolean isIntegratedNodeLabeling()
          Returns whether or not the layout algorithm reserves space for node labels.
 boolean isMultiParentAllowed()
          Determines whether or not multi-parent structures are allowed for this tree layout.
protected  GenericTreeLayouter.SubtreeShape layoutRoot(Node localRoot)
          Calculates the layout for the given root node and its subtrees.
protected  void reverseEdges(EdgeList reversedEdges)
          Reverses the direction of given edges.
 void setComponentLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for arranging the components of the graph is activated.
 void setDefaultChildComparator(java.util.Comparator defaultChildComparator)
          Specifies the default Comparator instance that sorts the outgoing edges in all subtrees that do not have a specific Comparator assigned using a DataProvider.
 void setDefaultLeafPlacer(NodePlacer defaultLeafPlacer)
          Specifies the default NodePlacer instance that places the leaf nodes of the tree.
 void setDefaultNodePlacer(NodePlacer defaultNodePlacer)
          Specifies the default NodePlacer instance that arranges all subtrees that do not have a specific NodePlacer assigned using a DataProvider.
 void setDefaultPortAssignment(PortAssignment defaultPortAssignment)
          Specifies the default PortAssignment instance for all subtrees that do not have a specific PortAssignment assigned using a DataProvider.
 void setGroupingSupported(boolean groupingSupported)
          Specifies whether or not group nodes are handled by the layout algorithm.
 void setIntegratedEdgeLabeling(boolean integratedEdgeLabeling)
          Specifies whether or not edge labels are placed by the layout algorithm.
 void setIntegratedNodeLabeling(boolean integratedNodeLabeling)
          Specifies whether or not the layout algorithm reserves space for node labels.
 void setMultiParentAllowed(boolean multiParentAllowed)
          Specifies whether or not multi-parent structures should be allowed for this tree layout.
 void setParallelEdgeLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for routing parallel edges is activated.
 void setSelfLoopLayouterEnabled(boolean enabled)
          Specifies whether or not the LayoutStage used for routing self-loops is activated.
 
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, setGroupNodeHider, setGroupNodeHidingEnabled, setLabelLayouter, setLabelLayouterEnabled, setLayoutOrientation, setOrientationLayouter, setOrientationLayouterEnabled, setParallelEdgeLayouter, setSelfLoopLayouter, setSubgraphLayouter, setSubgraphLayouterEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_PLACER_DPKEY

public static final java.lang.Object NODE_PLACER_DPKEY
A DataProvider key for specifying a child node placer for each node.

See Also:
setDefaultNodePlacer(NodePlacer)

PORT_ASSIGNMENT_DPKEY

public static final java.lang.Object PORT_ASSIGNMENT_DPKEY
A DataProvider key for assigning ports to nodes.

See Also:
setDefaultPortAssignment(PortAssignment)

CHILD_COMPARATOR_DPKEY

public static final java.lang.Object CHILD_COMPARATOR_DPKEY
A DataProvider key for specifying the comparator for the outgoing edges.

See Also:
setDefaultChildComparator(Comparator)

CRITICAL_EDGE_DPKEY

public static final java.lang.Object CRITICAL_EDGE_DPKEY
A DataProvider key for defining the priority of critical edges.

The layout algorithm tries to align each node pair that is connected by a critical edge (integer value > 0). This feature can, for example, be used for highlighting different edge paths that are important for a user. Conflicts between different critical edges are always resolved in favor of the higher priority.

This feature is only supported by the following NodePlacers:

 
The critical edge may not be straight if subtrees are rotated or port constraints are assigned.
Sample Graphs:

Layout result without specifying critical edges

Layout result when we specify the marked edges as critical, i.e., assign a priority of 1 to them

MULTI_PARENT_DESCRIPTOR_DPKEY

public static final java.lang.Object MULTI_PARENT_DESCRIPTOR_DPKEY
A DataProvider key for retrieving descriptors for nodes in multi-parent structures.

The returned descriptor affects the layout of the multi-parent structure.

 
This key is only considered if multi-parent structures are allowed, see setMultiParentAllowed(boolean). Furthermore, all nodes that belong to the same multi-parent structure should return the same descriptor.
See Also:
setMultiParentAllowed(boolean)

SELECTED_ROOT_DPKEY

public static final java.lang.Object SELECTED_ROOT_DPKEY
A DataProvider key for marking the node that will be used as root node of the tree.


graph

protected LayoutGraph graph
The input graph for which a layout is calculated.

Constructor Detail

GenericTreeLayouter

public GenericTreeLayouter()
Creates a new GenericTreeLayouter instance with default settings.

Method Detail

isGroupingSupported

public boolean isGroupingSupported()
Returns whether or not group nodes are handled by the layout algorithm.

 
If this option is disabled, group nodes will be temporarily hidden and reinserted to enclose their content. This may lead to node overlaps.
 
Grouping only works correctly, if each group contains a complete subtree. This means that for each group there is a node such that the group contains exactly this node and all its descendants.
Returns:
true if grouping is supported, false otherwise
See Also:
setGroupingSupported(boolean)

setGroupingSupported

public void setGroupingSupported(boolean groupingSupported)
Specifies whether or not group nodes are handled by the layout algorithm.

 
If this option is disabled, group nodes will be temporarily hidden and reinserted to enclose their content. This may lead to node overlaps.
 
Grouping only works correctly, if each group contains a complete subtree. This means that for each group there is a node such that the group contains exactly this node and all its descendants.
Default Value:
The default value is true. Grouping is enabled.
Parameters:
groupingSupported - true if grouping should be supported, false otherwise
Sample Graph:

setComponentLayouterEnabled

public void setComponentLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for arranging the components of the graph is activated.

Overrides:
setComponentLayouterEnabled in class CanonicMultiStageLayouter
 
GenericTreeLayouter can only handle single components. Disabling ComponentLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that arranges connected graph components is activated.
Parameters:
enabled - true if the stage that arranges the graph components is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isComponentLayouterEnabled(), CanonicMultiStageLayouter.setComponentLayouter(LayoutStage), ComponentLayouter

setParallelEdgeLayouterEnabled

public void setParallelEdgeLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing parallel edges is activated.

Overrides:
setParallelEdgeLayouterEnabled in class CanonicMultiStageLayouter
 
GenericTreeLayouter cannot handle parallel edges. Disabling ParallelEdgeLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that routes parallel edges is activated.
Parameters:
enabled - true if the stage responsible for routing parallel edges is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isParallelEdgeLayouterEnabled(), CanonicMultiStageLayouter.setParallelEdgeLayouter(LayoutStage), ParallelEdgeLayouter

setSelfLoopLayouterEnabled

public void setSelfLoopLayouterEnabled(boolean enabled)
Specifies whether or not the LayoutStage used for routing self-loops is activated.

Overrides:
setSelfLoopLayouterEnabled in class CanonicMultiStageLayouter
 
GenericTreeLayouter cannot handle self-loops. Disabling SelfLoopLayouter will lead to errors during execution.
Default Value:
The default value is true. The stage that routes self-loops is activated.
Parameters:
enabled - true if the stage responsible for routing self-loops is activated, false otherwise
See Also:
CanonicMultiStageLayouter.isSelfLoopLayouterEnabled(), CanonicMultiStageLayouter.setSelfLoopLayouter(LayoutStage), SelfLoopLayouter

canLayoutCore

protected boolean canLayoutCore(LayoutGraph graph)
Accepts only graphs that are trees.

If the layout algorithm is configured to handle multi-parent structures, also trees containing multi-parents are accepted.

Specified by:
canLayoutCore in class CanonicMultiStageLayouter
 
To use this layout algorithm for general graphs, append TreeReductionStage.
Parameters:
graph - the input graph
Returns:
true if the given graph is a tree (or multi-parent tree), false otherwise
See Also:
isMultiParentAllowed()

doLayoutCore

protected void doLayoutCore(LayoutGraph graph)
Arranges the given graph as a tree.

Specified by:
doLayoutCore in class CanonicMultiStageLayouter
Parameters:
graph - the input graph

getSubtreeShape

protected GenericTreeLayouter.SubtreeShape getSubtreeShape(Node localRoot)
Provides access to the GenericTreeLayouter.SubtreeShape for the given node.

The GenericTreeLayouter.SubtreeShape contains information about the current extent and location of the subtree rooted at the node. It should only be modified during the layout of the parent node. Also, it won't be initialized before the layout of the corresponding subtree is calculated.

This method updates the GenericTreeLayouter.SubtreeShape in layoutRoot(Node).

Parameters:
localRoot - the root of the subtree
Returns:
the GenericTreeLayouter.SubtreeShape instance if it has already been calculated, null otherwise

layoutRoot

protected GenericTreeLayouter.SubtreeShape layoutRoot(Node localRoot)
Calculates the layout for the given root node and its subtrees.

This method is invoked for each node in the tree exactly once. Thus, children are always handled before their parents. In this manner, the subtrees already have a layout and can be arranged with their parent.

To retrieve the shapes of the subtrees of all children of the local root, this method uses getSubtreeShape(Node).

The method may be overridden to add configuration code.

Parameters:
localRoot - the root of the subtree that whose layout is calculated
Returns:
the combined GenericTreeLayouter.SubtreeShape of the local root node and all of its children and connecting edges

getPortAssignment

protected PortAssignment getPortAssignment(Node localRoot)
Returns the PortAssignment instance that places the ports of the connecting edges of the given node.

The method may be overridden to return customized PortAssignment instances. It is possible to return a shared instance for multiple different nodes because the instances are not used after subsequent calls to this method.

The current implementation returns the PortAssignment defined by the DataProvider registered with key CHILD_COMPARATOR_DPKEY. It falls back to the default PortAssignment if there is no specific PortAssignment for the given node.

Parameters:
localRoot - the root of the local subtree
Returns:
the PortAssignment instance that assigns the ports of the edges at the given node
See Also:
PORT_ASSIGNMENT_DPKEY, getDefaultPortAssignment()

getChildNodeInEdgeComparator

protected java.util.Comparator getChildNodeInEdgeComparator(Node localRoot)
Returns the Comparator instance that will sort the outgoing edges connecting to the given node. The Comparator can be null in case the initial edge order shall be used.

The method may be overridden to return custom Comparator instances. It is possible to return a shared instance for multiple different nodes because the instances are not used after subsequent calls to this method.

The current implementation returns the Comparator defined in the DataProvider registered with key CHILD_COMPARATOR_DPKEY. It falls back to the default Comparator if there is no specific Comparator for the given node.

Parameters:
localRoot - the root of the local subtree
Returns:
the Comparator or null that sorts the outgoing edges of the given node
See Also:
CHILD_COMPARATOR_DPKEY, getDefaultChildComparator()

getNodePlacer

protected NodePlacer getNodePlacer(Node localRoot)
Returns the NodePlacer instance that is used for the placement of the local root node and the GenericTreeLayouter.SubtreeShapes.

The method may be overridden to return custom NodePlacer instances. It is possible to return a shared instance for multiple different nodes because the instances are not used after subsequent calls to this method.

The current implementation returns the NodePlacer defined by the DataProvider registered with key NODE_PLACER_DPKEY. It falls back to the default NodePlacer if there is no specific NodePlacer for the given node.

Parameters:
localRoot - the root of the local subtree
Returns:
the NodePlacer instance that places the subtree below the given local root node
See Also:
NODE_PLACER_DPKEY, getDefaultNodePlacer()

getNodeShape

protected GenericTreeLayouter.SubtreeShape getNodeShape(Node node)
Creates a GenericTreeLayouter.SubtreeShape for the given node that consists only of the bounds of this particular node. It may also include node labels or NodeHalos.

This method may be overridden to return a custom GenericTreeLayouter.SubtreeShape for the given node.

Parameters:
node - the given node
Returns:
a GenericTreeLayouter.SubtreeShape instance

getRootsArray

protected Node[] getRootsArray(Node root)
Returns an array of the nodes that will be laid out. The given node will be considered as the root of the tree. The order of the elements ensures that no parent is processed before one of its successors.

This method may be overridden to change the order in which the nodes (and their subtrees) are handled. However, it is important to keep the parents after the successors. Only siblings can change places.

Parameters:
root - the node to be considered as root of the tree
Returns:
an array of nodes that will be laid out

directTree

protected EdgeList directTree()
Returns a list of edges that need to be reversed in order to obtain a valid rooted and directed tree from the input graph.

The root node of the tree is either a node marked by a DataProvider registered with the graph with key SELECTED_ROOT_DPKEY or is defined according to Trees.getRoot(y.base.Graph).

This method is called initially to calculate a rooted tree from the input graph. It may be overridden to apply a custom algorithm that determines which edges need to be reversed.

Returns:
a list of edges that need to be reversed
See Also:
reverseEdges(EdgeList)

getSourcePortConstraintDataAcceptor

protected DataAcceptor getSourcePortConstraintDataAcceptor()
Returns a DataAcceptor that can overwrite the source port contraint temporarily used during the layout.

This method sets temporary source PortConstraints, e.g., after edge reversal. It may be overridden to handle those PortConstraints separately.

Returns:
a DataAcceptor to associate source PortConstraints with Edges
See Also:
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY

getTargetPortConstraintDataAcceptor

protected DataAcceptor getTargetPortConstraintDataAcceptor()
Returns a DataAcceptor that can overwrite the target port contraint temporarily used during the layout.

This method sets temporary target PortConstraints, e.g., after edge reversal. It may be overridden to handle those PortConstraints separately.

Returns:
a DataAcceptor to associate target PortConstraints with Edges
See Also:
PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY

getSourceGroupDataAcceptor

protected DataAcceptor getSourceGroupDataAcceptor()
Returns a DataAcceptor that can be used for temporarily overwriting the source group information used during the layout.

This method may be overridden to handle those edge groups separately.

Returns:
a DataAcceptor to associate source edge groups with Edges
See Also:
PortConstraintKeys.SOURCE_GROUPID_KEY

getTargetGroupDataAcceptor

protected DataAcceptor getTargetGroupDataAcceptor()
Returns a DataAcceptor that can be used for temporarily overwriting the target group information used during the layout.

This method may be overridden to handle those edge groups separately.

Returns:
a DataAcceptor to associate target edge groups with Edges
See Also:
PortConstraintKeys.TARGET_GROUPID_KEY

reverseEdges

protected void reverseEdges(EdgeList reversedEdges)
Reverses the direction of given edges.

This method will be called initially after the directTree() method and finally after the layout has been calculated. It may be overridden to additionally reverse data that depends on the direction of the edges.

Parameters:
reversedEdges - the edges that will be reversed

getDefaultNodePlacer

public NodePlacer getDefaultNodePlacer()
Returns the default NodePlacer instance that arranges all subtrees that do not have a specific NodePlacer assigned using a DataProvider.

Returns:
the default NodePlacer instance
See Also:
setDefaultNodePlacer(NodePlacer), NODE_PLACER_DPKEY

setDefaultNodePlacer

public void setDefaultNodePlacer(NodePlacer defaultNodePlacer)
Specifies the default NodePlacer instance that arranges all subtrees that do not have a specific NodePlacer assigned using a DataProvider.

Default Value:
The default value is DefaultNodePlacer
Parameters:
defaultNodePlacer - the default NodePlacer instance
Throws:
java.lang.IllegalArgumentException - if the default NodePlacer is set to null
See Also:
NODE_PLACER_DPKEY

getDefaultLeafPlacer

public NodePlacer getDefaultLeafPlacer()
Returns the default NodePlacer instance that places the leaf nodes of the tree.

Returns:
the default NodePlacer instance
See Also:
setDefaultNodePlacer(NodePlacer)

setDefaultLeafPlacer

public void setDefaultLeafPlacer(NodePlacer defaultLeafPlacer)
Specifies the default NodePlacer instance that places the leaf nodes of the tree.

Default Value:
The default value is LeafPlacer
Parameters:
defaultLeafPlacer - the default NodePlacer instance
Throws:
java.lang.IllegalArgumentException - if the default NodePlacer is set to null

getDefaultPortAssignment

public PortAssignment getDefaultPortAssignment()
Returns the default PortAssignment instance for all subtrees that do not have a specific PortAssignment assigned using a DataProvider.

Returns:
the default PortAssignment instance
See Also:
setDefaultPortAssignment(PortAssignment), PORT_ASSIGNMENT_DPKEY

setDefaultPortAssignment

public void setDefaultPortAssignment(PortAssignment defaultPortAssignment)
Specifies the default PortAssignment instance for all subtrees that do not have a specific PortAssignment assigned using a DataProvider.

Default Value:
The default value is DefaultPortAssignment
Parameters:
defaultPortAssignment - the default PortAssignment instance
Throws:
java.lang.IllegalArgumentException - if the default PortAssignment is set to null
See Also:
PORT_ASSIGNMENT_DPKEY

getDefaultChildComparator

public java.util.Comparator getDefaultChildComparator()
Returns the default Comparator instance that sorts the outgoing edges in all subtrees that do not have a specific Comparator assigned using a DataProvider.

 
When a Comparator for outgoing edges is null, the order of the edges will be maintained.
Returns:
the new default instance or null if no specific sorting should be done
See Also:
setDefaultChildComparator(Comparator), CHILD_COMPARATOR_DPKEY

setDefaultChildComparator

public void setDefaultChildComparator(java.util.Comparator defaultChildComparator)
Specifies the default Comparator instance that sorts the outgoing edges in all subtrees that do not have a specific Comparator assigned using a DataProvider.

 
When a Comparator for outgoing edges is null, the order of the edges will be maintained.
Default Value:
The default value is null. No sorting is executed.
Parameters:
defaultChildComparator - the new default instance or null if no specific sorting should be done
See Also:
CHILD_COMPARATOR_DPKEY

setIntegratedNodeLabeling

public void setIntegratedNodeLabeling(boolean integratedNodeLabeling)
Specifies whether or not the layout algorithm reserves space for node labels.

If this feature is enabled, the GenericTreeLayouter.SubtreeShape of the nodes will also hold the shapes of its labels.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Default Value:
The default value is false. Node labels are not considered.
Parameters:
integratedNodeLabeling - true if node labels should be considered, false otherwise
Sample Graphs:

false

true

isIntegratedNodeLabeling

public boolean isIntegratedNodeLabeling()
Returns whether or not the layout algorithm reserves space for node labels.

If this is enabled, the GenericTreeLayouter.SubtreeShape of the nodes will be extended by the shapes of its labels.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Returns:
true if node labels are considered, false otherwise
See Also:
setIntegratedNodeLabeling(boolean)

isIntegratedEdgeLabeling

public boolean isIntegratedEdgeLabeling()
Returns whether or not edge labels are placed by the layout algorithm.

If this is enabled, the GenericTreeLayouter.SubtreeShapes of the subtrees are extended by the edge labels.

The layout algorithm uses the information of PreferredPlacementDescriptor for an edge label to determine the corresponding placement. However, edge labels are always placed at the target side of the edge. The placement along the edge only affects the order of the edge labels at the same edge.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Returns:
true if the layout algorithm places edge labels, false otherwise
See Also:
setIntegratedEdgeLabeling(boolean)

setIntegratedEdgeLabeling

public void setIntegratedEdgeLabeling(boolean integratedEdgeLabeling)
Specifies whether or not edge labels are placed by the layout algorithm.

If this is enabled, the GenericTreeLayouter.SubtreeShapes of the subtrees are extended by the edge labels.

The layout algorithm uses the information of PreferredPlacementDescriptor for an edge label to determine the corresponding placement. However, edge labels are always placed at the target side of the edge. The placement along the edge only affects the order of the edge labels at the same edge.

 
When enabling this property, any previously specified labeling algorithm will be overwritten and when disabling it, any currently specified labeling algorithm will be disabled via property CanonicMultiStageLayouter.setLabelLayouterEnabled(boolean). Therefore, it is recommended to only use this convenience property instead of manually changing the mentioned other properties.
Default Value:
The default value is false. Edge labels are ignored.
Parameters:
integratedEdgeLabeling - true if the layout algorithm should place edge labels, false otherwise
Sample Graphs:

false

true

isMultiParentAllowed

public boolean isMultiParentAllowed()
Determines whether or not multi-parent structures are allowed for this tree layout.

If multi-parent structures are allowed, the directed input graph may contain structures of multiple nodes that share the same predecessors as well as the same successors. All nodes belonging to such a structure are placed side by side and the incident edges are routed in a bus-style manner.

 
As for the different ways in which the NodePlacers route their edges, multi-parent structures only work for some NodePlacer implementations:
 
If the input graph contains groups, all nodes belonging to the same multi-parent structure must be associated with the same group node, i.e., it is not possible to assign these nodes to different group nodes.
Returns:
true if multi-parent structures are allowed, false otherwise
See Also:
setMultiParentAllowed(boolean)

setMultiParentAllowed

public void setMultiParentAllowed(boolean multiParentAllowed)
Specifies whether or not multi-parent structures should be allowed for this tree layout.

If multi-parent structures are allowed, the directed input graph may contain structures of multiple nodes that share the same predecessors as well as the same successors. All nodes belonging to such a structure are placed side by side and the incident edges are routed in a bus-style manner.

 
As for the different ways in which the NodePlacers route their edges, multi-parent structures only work for some NodePlacer implementations:
 
If the input graph contains groups, all nodes belonging to the same multi-parent structure must be associated with the same group node, i.e., it is not possible to assign these nodes to different group nodes.
Default Value:
The default value is false. Multi-parent structures are not allowed.
Parameters:
multiParentAllowed - true if multi-parent structures should be allowed, false otherwise
Sample Graph:

*

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