public class GroupedNodePlacer extends Object implements INodePlacer
INodePlacer
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 INodePlacer
which will consider grouped children as one child. The children within a
group are placed by another INodePlacer
.
There are three edge groups whose target nodes are placed above each other
Constructor and Description |
---|
GroupedNodePlacer(INodePlacer groupPlacer,
INodePlacer childPlacer)
Creates a new
GroupedNodePlacer instance. |
Modifier and Type | Method and Description |
---|---|
IProcessor |
createProcessor(TreeLayout layouter,
LayoutGraph graph,
Node currentRoot)
Creates a
IProcessor that prepares the graph for edge grouping. |
void |
determineChildConnectors(Node localRoot,
IDataMap connectorMap)
Delegates to the
INodePlacer responsible for arranging the nodes in one group. |
TreeLayout.SubtreeShape |
placeSubtree(IDataProvider nodeShapeProvider,
IDataProvider subtreeShapeProvider,
LayoutGraph graph,
Node localRoot,
ParentConnectorDirection parentConnectorDirection)
Places the groups of
TreeLayout.SubtreeShape s according to their group IDs. |
public GroupedNodePlacer(INodePlacer groupPlacer, INodePlacer childPlacer)
GroupedNodePlacer
instance.groupPlacer
- the INodePlacer
which places the child groupschildPlacer
- the INodePlacer
which places the children within their grouppublic IProcessor createProcessor(TreeLayout layouter, LayoutGraph graph, Node currentRoot)
IProcessor
that prepares the graph for edge grouping.
In a pre-processing step, the IProcessor
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.
createProcessor
in interface INodePlacer
layouter
- the current TreeLayout
instancegraph
- the input graphcurrentRoot
- the root node handled by this INodePlacer
IProcessor
responsible for preparing the graphPortConstraintKeys.SOURCE_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_GROUP_ID_DPKEY
public void determineChildConnectors(Node localRoot, IDataMap connectorMap)
INodePlacer
responsible for arranging the nodes in one group.determineChildConnectors
in interface INodePlacer
localRoot
- the local root nodeconnectorMap
- the map used for storing the direction specifiers of the child nodespublic TreeLayout.SubtreeShape placeSubtree(IDataProvider nodeShapeProvider, IDataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, ParentConnectorDirection parentConnectorDirection)
TreeLayout.SubtreeShape
s according to their group IDs.placeSubtree
in interface INodePlacer
nodeShapeProvider
- the IDataProvider
for obtaining an initial shape of the root nodesubtreeShapeProvider
- the IDataProvider
for accessing the pre-calculated shapes of the subtreesgraph
- the input graphlocalRoot
- the root of the subtree that should be arranged by this methodparentConnectorDirection
- the direction specifier for the connector of the local root node to its parent nodeTreeLayout.SubtreeShape
s of the local root and its childrenPortConstraintKeys.SOURCE_GROUP_ID_DPKEY
,
PortConstraintKeys.TARGET_GROUP_ID_DPKEY