|
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.LeftRightPlacer
public class LeftRightPlacer
The LeftRightPlacer
arranges the children in a subtree on the left and the right of a vertical bus.
branch count
, it is possible
to generate multiple vertical buses (i.e. branches) that are placed next to each other, below the root node.
Nested Class Summary | |
---|---|
static class |
LeftRightPlacer.LeftRightDataProvider
A special DataProvider that determines whether a given node is placed left or right of the parent node. |
Nested classes/interfaces inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment |
Field Summary | |
---|---|
static java.lang.Object |
LEFT_RIGHT_DPKEY
A DataProvider key for assigning nodes to the left or the right side of the bus
If no LeftRightPlacer.LeftRightDataProvider is specified using this key, the nodes will be placed alternating from left to right. |
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 | |
---|---|
LeftRightPlacer()
Creates a new LeftRightPlacer instance with default settings. |
|
LeftRightPlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
Creates a new LeftRightPlacer instance using the given modification matrix. |
Method Summary | |
---|---|
java.util.Comparator |
createComparator()
Returns a Comparator for outgoing edges that considers the locations of the target nodes. |
Processor |
createProcessor(GenericTreeLayouter layouter,
LayoutGraph graph,
Node currentRoot)
Creates a processor that distributes the child elements into multiple branches, if necessary. |
protected byte |
determineChildConnector(Node child)
Determines a connector direction for the given child node. |
void |
determineChildConnectors(Node localRoot,
DataMap connectorMap)
Determines the direction of the child connectors according to which side of the bus the child is assigned. |
int |
getBranchCount()
Returns the number of branches (buses) of the subtree layout. |
double |
getHorizontalDistance()
Returns the horizontal distance between nodes or subtrees. |
double |
getVerticalDistance()
Returns the vertical distance between nodes or subtrees. |
boolean |
isPlaceLastOnBottom()
Returns whether or not the last child is placed centered, aligned with the bus and below the other child nodes. |
protected y.layout.tree.SubtreeShapeRotated |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
Places the subtree shapes of the children left and right of a common vertical bus. |
void |
setBranchCount(int branchCount)
Specifies the number of branches (buses) of the subtree layout. |
void |
setHorizontalDistance(double distance)
Specifies the horizontal distance between nodes or subtrees. |
void |
setPlaceLastOnBottom(boolean placeLastOnBottom)
Specifies whether or not the last child is placed centered, aligned with the bus and below the other child nodes. |
void |
setSpacing(double spacing)
Specifies a uniform horizontal and vertical spacing between subtrees. |
void |
setVerticalDistance(double distance)
Specifies the vertical distance between nodes or subtrees. |
Methods inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
createFromSketchComparator, createRootNodeShape, createSubtreeShape, getModificationMatrix, getPortConstraint, getSourcePointAbs, getSpacing, placeSubtree, 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 LEFT_RIGHT_DPKEY
DataProvider
key for assigning nodes to the left or the right side of the bus
If no LeftRightPlacer.LeftRightDataProvider
is specified using this key, the nodes will be placed alternating from left to right.
Constructor Detail |
---|
public LeftRightPlacer()
LeftRightPlacer
instance with default settings.
public LeftRightPlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
LeftRightPlacer
instance using the given modification matrix.
modificationMatrix
- the transformation matrix for this AbstractRotatableNodePlacer
java.lang.IllegalArgumentException
- if the given transformation matrix is null
Method Detail |
---|
public double getHorizontalDistance()
The distance needs to be non-negative.
setHorizontalDistance(double)
public void setHorizontalDistance(double distance)
The distance needs to be non-negative.
public double getVerticalDistance()
The distance needs to be non-negative.
setVerticalDistance(double)
public void setVerticalDistance(double distance)
The distance needs to be non-negative.
public void setSpacing(double spacing)
This method sets the given distance value for the horizontal spacing
and
for the vertical spacing
.
setSpacing
in class AbstractRotatableNodePlacer
spacing
- the distance between subtrees
java.lang.IllegalArgumentException
- if the specified spacing value is negativesetHorizontalDistance(double)
,
setVerticalDistance(double)
public int getBranchCount()
A branch consists of a vertical bus where the child nodes are placed left and right of it. If the subtree handled
by this NodePlacer
consists of multiple branches, they are placed next to each other with the root
node centered above them. Child nodes are equally distributed over the different available branches.
The out-edge order
is considered such that child subtrees are first assigned to the leftmost branch (e.g. if each branch contains
four children, the first four children are in the first, leftmost branch, the second four children
are in the second branch and so on).
out-edge order
, this can be adjusted to
fit more specific requirements.setBranchCount(int)
public void setBranchCount(int branchCount)
A branch consists of a vertical bus where the child nodes are placed left and right of it. If the subtree handled
by this NodePlacer
consists of multiple branches, they are placed next to each other with the root
node centered above them. Child nodes are equally distributed over the different available branches.
The out-edge order
is considered such that child subtrees are first assigned to the leftmost branch (e.g. if each branch contains
four children, the first four children are in the first, leftmost branch, the second four children
are in the second branch and so on).
out-edge order
, this can be adjusted to
fit more specific requirements.branchCount
- the number of branches of the subtree layout
java.lang.IllegalArgumentException
- if the given branch count is smaller than 1
Layout with a single branch consisting of 12 child nodes | Layout with three branches - each branch holds four child nodes |
public void determineChildConnectors(Node localRoot, DataMap connectorMap)
Children on the left will get a connector to the NodePlacer.DIRECTION_EAST
. Children on the right will get one to
the NodePlacer.DIRECTION_WEST
. A connector to the NodePlacer.DIRECTION_NORTH
is assigned for the bottom child.
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 nodessetPlaceLastOnBottom(boolean)
protected byte determineChildConnector(Node child)
Since the connector directions are already determined by determineChildConnectors(Node, DataMap)
, this
method doesn't need to be called.
determineChildConnector
in class AbstractRotatableNodePlacer
child
- the child node
NodePlacer
interface
java.lang.IllegalStateException
- if this method is calledprotected y.layout.tree.SubtreeShapeRotated placeSubtree(Node localRoot, byte parentConnectorDirection)
placeSubtree
in class AbstractRotatableNodePlacer
localRoot
- the local root nodeparentConnectorDirection
- the direction specifier for the connector of the local root node to its parent node
public boolean isPlaceLastOnBottom()
When enabled, the last child will always be centered independent of the number of siblings.
true
if the last child is separated, false
otherwisesetPlaceLastOnBottom(boolean)
public void setPlaceLastOnBottom(boolean placeLastOnBottom)
When enabled, the last child will always be centered independent of the number of siblings.
public java.util.Comparator createComparator()
Comparator
for outgoing edges that considers the locations of the target nodes.
The Comparator
applies the modification matrix
of this
LeftRightPlacer
and then compares the y-coordinates of the target nodes.
createComparator
in class AbstractRotatableNodePlacer
Comparator
that compares outgoing edges according to the locations of their target nodespublic Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
The branch count
defines whether or not the subtree layout will consist of
multiple branches. If so, this method creates a processor to assign the children to the branches.
createProcessor
in interface NodePlacer
createProcessor
in class AbstractRotatableNodePlacer
layouter
- the current GenericTreeLayouter
instancegraph
- the input graphcurrentRoot
- the root node handled by this NodePlacer
null
if only a single-branch
layout is created
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |