|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.tree.AbstractRotatableNodePlacer y.layout.tree.AssistantPlacer
public class AssistantPlacer
The AssistantPlacer
places nodes that are marked as assistants left and right of their parents and all other
nodes below the assistant nodes.
This NodePlacer
delegates the placement of all assistant nodes to an instance of LeftRightPlacer
. The
non-assistant nodes are handled by another node placer
. To be able to do this,
AssistantPlacer
uses a Processor
which prepares the graph for node placing.
A DataProvider
that is registered using ASSISTANT_DPKEY
returns true
for assistant nodes and false
for all other nodes.
PortAssignment
that starts all edges at the same
port. If the ports are distributed along the border, edge crossings may occur.Nested Class Summary |
---|
Nested classes/interfaces inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment |
Field Summary | |
---|---|
static java.lang.Object |
ASSISTANT_DPKEY
A DataProvider key for marking which nodes are placed as assistants
|
Fields inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
createdChildren, graph, modificationMatrix, nodeShapeProvider, spacing, subtreeShapeProvider |
Fields inherited from interface y.layout.tree.NodePlacer |
---|
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST |
Constructor Summary | |
---|---|
AssistantPlacer()
Creates a new AssistantPlacer instance with default settings. |
|
AssistantPlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
Creates a new AssistantPlacer instance that uses the transformation defined by the given matrix. |
Method Summary | |
---|---|
java.util.Comparator |
createComparator()
Delegates the creation of from-sketch comparators
to the two NodePlacer s handling assistant and non-assistant nodes. |
static java.util.Comparator |
createCompoundComparator(java.util.Comparator assistantComparator,
java.util.Comparator childComparator)
Creates a Comparator that compares outgoing edges connecting to assistant nodes and edges connecting to
non-assistant nodes separately. |
Processor |
createProcessor(GenericTreeLayouter layouter,
LayoutGraph graph,
Node currentRoot)
Creates a Processor that prepares the graph for placing assistant node. |
protected byte |
determineChildConnector(Node child)
Determines a connector direction for the given child node. |
void |
determineChildConnectors(Node localRoot,
DataMap connectorMap)
Delegates the calculation of the child connectors to the LeftRightPlacer which arranges the assistant nodes. |
NodePlacer |
getChildNodePlacer()
Returns the NodePlacer instance that places the non-assistant children. |
protected GenericTreeLayouter.SubtreeShape |
getNodeShape(Node node)
Returns the GenericTreeLayouter.SubtreeShape for the given node. |
double |
getSpacing()
Returns the spacing between subtrees for the delegate NodePlacer . |
GenericTreeLayouter.SubtreeShape |
placeSubtree(DataProvider nodeShapeProvider,
DataProvider subtreeShapeProvider,
LayoutGraph graph,
Node localRoot,
byte parentConnectorDirection)
Delegates the arrangement of GenericTreeLayouter.SubtreeShape s to an instance of LeftRightPlacer . |
protected y.layout.tree.SubtreeShapeRotated |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
Arranges the local root relative to the subtree shape of its children. |
void |
setChildNodePlacer(NodePlacer childNodePlacer)
Specifies the NodePlacer instance that places the non-assistant children. |
void |
setSpacing(double spacing)
Specifies the spacing between subtrees for the delegate NodePlacer . |
Methods inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
createFromSketchComparator, createRootNodeShape, createSubtreeShape, getModificationMatrix, getPortConstraint, getSourcePointAbs, translateDirectionToModel, translateDirectionToReal, translatePoint |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object ASSISTANT_DPKEY
DataProvider
key for marking which nodes are placed as assistants
Constructor Detail |
---|
public AssistantPlacer()
AssistantPlacer
instance with default settings.
public AssistantPlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
AssistantPlacer
instance that uses the transformation defined by the given matrix.
modificationMatrix
- the transformation matrix
java.lang.IllegalArgumentException
- if the given transformation matrix is null
Method Detail |
---|
protected byte determineChildConnector(Node child)
determineChildConnector
in class AbstractRotatableNodePlacer
NodePlacer
for the assistant nodes
by determineChildConnectors(Node, DataMap)
.child
- the child node
NodePlacer
interface
java.lang.IllegalStateException
- if this method is calledpublic void determineChildConnectors(Node localRoot, DataMap connectorMap)
LeftRightPlacer
which arranges the assistant nodes.
determineChildConnectors
in interface NodePlacer
determineChildConnectors
in class AbstractRotatableNodePlacer
localRoot
- the local root nodeconnectorMap
- the map that must be used for storing the direction specifiers of the child nodesAbstractRotatableNodePlacer.determineChildConnector(Node)
protected GenericTreeLayouter.SubtreeShape getNodeShape(Node node)
GenericTreeLayouter.SubtreeShape
for the given node.
This is a convenience method that retrieves a GenericTreeLayouter.SubtreeShape
for a single node from the corresponding
DataProvider
.
This method is used in placeSubtree(Node, byte)
for retrieving the GenericTreeLayouter.SubtreeShape
s for the
local root nodes. It may be overridden to return a custom implementation of GenericTreeLayouter.SubtreeShape
.
placeSubtree(Node, byte)
.
Otherwise, the DataProvider
for querying results will not have been initialized yet.node
- the node
GenericTreeLayouter.SubtreeShape
for the given nodepublic Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
Processor
that prepares the graph for placing assistant node.
The pre-processing step adds a dummy node as a child to the current root and changes all edges of non-assistant
children such that they start at this dummy node. That way, AssistantPlacer
is able to delegate the
assistant nodes to a NodePlacer
different from the one used for placing non-assistant nodes. The
child node placer
is assigned to the dummy node. So the non-assistant children are
placed by this delegate placer.
All changes will be cleaned up during the post-processing step.
createProcessor
in interface NodePlacer
createProcessor
in class AbstractRotatableNodePlacer
layouter
- the current GenericTreeLayouter
instancegraph
- the input graphcurrentRoot
- the root node handled by this NodePlacer
Processor
instance that prepares the graph for AssistantPlacer
, or null
if the out-degree of the given root node is zeropublic void setSpacing(double spacing)
NodePlacer
.
The spacing needs to be non-negative.
setSpacing
in class AbstractRotatableNodePlacer
spacing
- the distance between subtrees
java.lang.IllegalArgumentException
- if the given spacing is negativeSpacing 20 using SimpleNodePlacer | Spacing 50 using SimpleNodePlacer |
public double getSpacing()
NodePlacer
.
The spacing needs to be non-negative.
getSpacing
in class AbstractRotatableNodePlacer
setSpacing(double)
public GenericTreeLayouter.SubtreeShape placeSubtree(DataProvider nodeShapeProvider, DataProvider subtreeShapeProvider, LayoutGraph graph, Node localRoot, byte parentConnectorDirection)
GenericTreeLayouter.SubtreeShape
s to an instance of LeftRightPlacer
.
The LeftRightPlacer
places all assistant nodes left and right of the local root node. The
GenericTreeLayouter.SubtreeShape
associated with the dummy node which contains GenericTreeLayouter.SubtreeShape
s of the non-assistant
nodes is placed below the assistant nodes, center-aligned with respect to the local root node.
placeSubtree
in interface NodePlacer
placeSubtree
in class AbstractRotatableNodePlacer
nodeShapeProvider
- the DataProvider
for obtaining an initial shape of the root nodesubtreeShapeProvider
- the DataProvider
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 node
GenericTreeLayouter.SubtreeShape
containing the local root and all assistant nodes and non-assistant nodesAbstractRotatableNodePlacer.placeSubtree(Node, byte)
protected y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot, byte parentConnectorDirection)
placeSubtree
in class AbstractRotatableNodePlacer
NodePlacer
for the assistant nodes and the
placer for non-assistant nodes
by method
placeSubtree(DataProvider, DataProvider, LayoutGraph, Node, byte)
.localRoot
- the local root nodeparentConnectorDirection
- the direction specifier for the connector of the local root node to its parent node
java.lang.IllegalStateException
- if this method is calledpublic void setChildNodePlacer(NodePlacer childNodePlacer)
NodePlacer
instance that places the non-assistant children.
These non-assistant child nodes will be placed below the assistant child nodes and are arranged by
the given NodePlacer
.
Non-assistant child nodes are the ones that are not marked in the DataProvider
registered with ASSISTANT_DPKEY
.
CompactNodePlacer
as placer for non-assistant children is not supported. Instead,
CompactNodePlacer
itself allows to define assistant nodes and in that case places sub-trees using
the same style as AssistantPlacer
does.SimpleNodePlacer
. A SimpleNodePlacer
with
centered
local roots is used.childNodePlacer
- the child node placer for the non-assistant children
java.lang.IllegalArgumentException
- if the given child placer is null
or an instance of class
CompactNodePlacer
.ASSISTANT_DPKEY
public NodePlacer getChildNodePlacer()
NodePlacer
instance that places the non-assistant children.
These non-assistant child nodes will be placed below the assistant child nodes and are arranged by
the given NodePlacer
.
Non-assistant child nodes are the ones that are not marked in the DataProvider
registered with ASSISTANT_DPKEY
.
CompactNodePlacer
as placer for non-assistant children is not supported. Instead,
CompactNodePlacer
itself allows to define assistant nodes and in that case places sub-trees using
the same style as AssistantPlacer
does.setChildNodePlacer(NodePlacer)
,
ASSISTANT_DPKEY
public java.util.Comparator createComparator()
from-sketch comparators
to the two NodePlacer
s handling assistant and non-assistant nodes.
The from-sketch Comparator
s are combined
into a compound comparator.
The one for the edges connecting to assistant nodes is retrieved from a LeftRightPlacer
while the other one
is provided by the child placer
.
createComparator
in class AbstractRotatableNodePlacer
Comparator
to compare edges, considering the initial locations of their target nodessetChildNodePlacer(NodePlacer)
,
createCompoundComparator(Comparator, Comparator)
,
FromSketchNodePlacer.createFromSketchComparator()
public static java.util.Comparator createCompoundComparator(java.util.Comparator assistantComparator, java.util.Comparator childComparator)
Comparator
that compares outgoing edges connecting to assistant nodes and edges connecting to
non-assistant nodes separately.
assistantComparator
- the Comparator
for edges connecting to assistant nodeschildComparator
- the Comparator
for edges connecting to non-assistant nodes
Comparator
that compares edges to assistant nodes separately from edges to non-assistant nodes
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |