Search this API

y.layout.tree
Class GroupedNodePlacer

java.lang.Object
  extended by y.layout.tree.GroupedNodePlacer
All Implemented Interfaces:
NodePlacer

public class GroupedNodePlacer
extends java.lang.Object
implements NodePlacer

This NodePlacer places the children of a local root in groups.

The groups are determined by the grouping of the edges that connect the children to its root. The placement of the groups is specified by a NodePlacer which will consider grouped children as one child. The children within a group are placed by another NodePlacer.


There are three edge groups whose target nodes are placed above each other

See Also:
PortConstraintKeys.SOURCE_GROUPID_KEY, PortConstraintKeys.TARGET_GROUPID_KEY
 

Field Summary
 
Fields inherited from interface y.layout.tree.NodePlacer
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST
 
Constructor Summary
GroupedNodePlacer(NodePlacer groupPlacer, NodePlacer childPlacer)
          Creates a new GroupedNodePlacer instance.
 
Method Summary
 Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
          Creates a Processor that prepares the graph for edge grouping.
 void determineChildConnectors(Node localRoot, DataMap connectorMap)
          Delegates to the NodePlacer responsible for arranging the nodes in one group.
 GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider, DataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, byte parentConnectorDirection)
          Places the groups of GenericTreeLayouter.SubtreeShapes according to their group IDs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupedNodePlacer

public GroupedNodePlacer(NodePlacer groupPlacer,
                         NodePlacer childPlacer)
Creates a new GroupedNodePlacer instance.

Parameters:
groupPlacer - the NodePlacer which places the child groups
childPlacer - the NodePlacer which places the children within their group
Method Detail

determineChildConnectors

public void determineChildConnectors(Node localRoot,
                                     DataMap connectorMap)
Delegates to the NodePlacer responsible for arranging the nodes in one group.

Specified by:
determineChildConnectors in interface NodePlacer
Parameters:
localRoot - the local root node
connectorMap - the map used for storing the direction specifiers of the child nodes

placeSubtree

public GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider,
                                                     DataProvider subtreeShapeProvider,
                                                     LayoutGraph graph,
                                                     Node localRoot,
                                                     byte parentConnectorDirection)
Places the groups of GenericTreeLayouter.SubtreeShapes according to their group IDs.

Specified by:
placeSubtree in interface NodePlacer
Parameters:
nodeShapeProvider - the DataProvider for obtaining an initial shape of the root node
subtreeShapeProvider - the DataProvider for accessing the pre-calculated shapes of the subtrees
graph - the input graph
localRoot - the root of the subtree that should be arranged by this method
parentConnectorDirection - the direction specifier for the connector of the local root node to its parent node
Returns:
the merged GenericTreeLayouter.SubtreeShapes of the local root and its children
See Also:
PortConstraintKeys.SOURCE_GROUPID_KEY, PortConstraintKeys.TARGET_GROUPID_KEY

createProcessor

public Processor createProcessor(GenericTreeLayouter layouter,
                                 LayoutGraph graph,
                                 Node currentRoot)
Creates a Processor that prepares the graph for edge grouping.

In a pre-processing step, the Processor inserts a dummy node for each edge group and connects it to the local root and the edges of the according group. The child node placer is assigned to those dummy nodes and will arrange them during the layout calculation.

The changes to the graph are restored in a post-processing step.

Specified by:
createProcessor in interface NodePlacer
Parameters:
layouter - the current GenericTreeLayouter instance
graph - the input graph
currentRoot - the root node handled by this NodePlacer
Returns:
the Processor responsible for preparing the graph
See Also:
PortConstraintKeys.SOURCE_GROUPID_KEY, PortConstraintKeys.TARGET_GROUPID_KEY

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