|
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.LayeredNodePlacer
public class LayeredNodePlacer
A LayeredNodePlacer
arranges the nodes of a subtree respecting layers.
Nodes that have the same depth in the tree will be placed in the same horizontal layer. They will be vertically
aligned
.
orientation
within the LayeredNodePlacer
is strongly
discouraged because it causes problems with the layering.Nested Class Summary |
---|
Nested classes/interfaces inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment |
Field Summary | |
---|---|
static int |
ORTHOGONAL_STYLE
Routing style specifier which defines that edges are routed in an orthogonal, bus-like fashion. |
static int |
PLAIN_STYLE
Routing style specifier which defines that edges consist of one straight segment. |
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 | |
---|---|
LayeredNodePlacer()
Creates a new LayeredNodePlacer instance with the default settings. |
|
LayeredNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix,
java.lang.Object id)
Creates a new LayeredNodePlacer instance whose direction is specified by the given modification matrix. |
Method Summary | |
---|---|
Processor |
createProcessor(GenericTreeLayouter layouter,
LayoutGraph graph,
Node currentRoot)
Creates a Processor that distributes the nodes over the layers. |
protected byte |
determineChildConnector(Node child)
Returns NodePlacer.DIRECTION_NORTH for every given child node. |
double |
getBusAlignment()
Returns the vertical bus alignment for orthogonally routed edges. |
java.lang.Object |
getId()
Returns the ID of this LayeredNodePlacer . |
double |
getLayerSpacing()
Returns the distance between two adjacent layers. |
AbstractRotatableNodePlacer.RootAlignment |
getRootAlignment()
Returns the RootAlginment that defines how the root node
is aligned with its children and their shapes. |
int |
getRoutingStyle()
Returns the routing style for the edges in the subtree. |
double |
getVerticalAlignment()
Returns the relative vertical alignment of nodes within their respective layers. |
boolean |
isDendrogramStyleEnabled()
Returns whether or not the layering is done dendrogram-like. |
boolean |
isPolylineLabelingEnabled()
Returns whether or not straight edges are extended to avoid label overlaps. |
protected y.layout.tree.SubtreeShapeRotated |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
Places the children of local root in layers. |
void |
setBusAlignment(double busAlignment)
Specifies the vertical bus alignment for orthogonally routed edges. |
void |
setDendrogramStyleEnabled(boolean enabled)
Specifies whether or not the layering is done dendrogram-like. |
void |
setLayerSpacing(double layerSpacing)
Specifies the distance between two adjacent layers. |
void |
setPolylineLabelingEnabled(boolean polylineLabelingEnabled)
Specifies whether or not straight edges are extended to avoid label overlaps. |
void |
setRootAlignment(AbstractRotatableNodePlacer.RootAlignment rootAlignment)
Specifies the RootAlginment that defines how the root node
is aligned with its children and their shapes. |
void |
setRoutingStyle(int routingStyle)
Specifies the routing style for the edges in the subtree. |
void |
setVerticalAlignment(double verticalAlignment)
Specifies the relative vertical alignment of nodes within their respective layers. |
Methods inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
createComparator, createFromSketchComparator, createRootNodeShape, createSubtreeShape, determineChildConnectors, getModificationMatrix, getPortConstraint, getSourcePointAbs, getSpacing, placeSubtree, setSpacing, 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 int PLAIN_STYLE
public static final int ORTHOGONAL_STYLE
Constructor Detail |
---|
public LayeredNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix, java.lang.Object id)
LayeredNodePlacer
instance whose direction is specified by the given modification matrix.
The given ID identifies different LayeredNodePlacer
instances that share the same layer heights.
modificationMatrix
- the transformation matrix for this AbstractRotatableNodePlacer
id
- the LayeredNodePlacer
ID
java.lang.IllegalArgumentException
- if the given transformation matrix or id is null
public LayeredNodePlacer()
LayeredNodePlacer
instance with the default settings.
Method Detail |
---|
public boolean isDendrogramStyleEnabled()
When enabled, leaves are placed in the same layer and remaining tree nodes are assigned to a layer as close to their children as possible.
true
if the graph is layered as a dendrogram, false
otherwisesetDendrogramStyleEnabled(boolean)
public void setDendrogramStyleEnabled(boolean enabled)
When enabled, leaves are placed in the same layer and remaining tree nodes are assigned to a layer as close to their children as possible.
protected byte determineChildConnector(Node child)
NodePlacer.DIRECTION_NORTH
for every given child node. Edges always connect to the top of the child
nodes.
determineChildConnector
in class AbstractRotatableNodePlacer
child
- the child node
NodePlacer.DIRECTION_NORTH
protected 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 Processor createProcessor(GenericTreeLayouter layouter, LayoutGraph graph, Node currentRoot)
Processor
that distributes the nodes over the layers.
The Processor
is chosen depending on the layout style
.
createProcessor
in interface NodePlacer
createProcessor
in class AbstractRotatableNodePlacer
graph
- the input graphcurrentRoot
- the current root node for this node placerlayouter
- the current GenericTreeLayouter
instance
Processor
or null
if the layer information is already assigned to the current rootsetDendrogramStyleEnabled(boolean)
public AbstractRotatableNodePlacer.RootAlignment getRootAlignment()
RootAlginment
that defines how the root node
is aligned with its children and their shapes.
AbstractRotatableNodePlacer.RootAlignment
instance specifying the location relative to the
subtreessetRootAlignment(AbstractRotatableNodePlacer.RootAlignment)
public void setRootAlignment(AbstractRotatableNodePlacer.RootAlignment rootAlignment)
RootAlginment
that defines how the root node
is aligned with its children and their shapes.
AbstractRotatableNodePlacer.RootAlignment.CENTER_OVER_CHILDREN
rootAlignment
- the AbstractRotatableNodePlacer.RootAlignment
instance specifying the location
relative to the subtrees
java.lang.IllegalArgumentException
- if the given root alignment is null
public double getVerticalAlignment()
A value of 0
means that nodes are top-aligned;
a value of 0.5
means that nodes are center-aligned;
a value of 1
means that nodes are bottom-aligned;
Values for a valid vertical alignment are in the range [0..1]
.
setVerticalAlignment(double)
public void setVerticalAlignment(double verticalAlignment)
A value of 0
means that nodes are top-aligned;
a value of 0.5
means that nodes are center-aligned;
a value of 1
means that nodes are bottom-aligned;
Values for a valid vertical alignment are in the range [0..1]
.
public java.lang.Object getId()
LayeredNodePlacer
.
The ID is used for identifying LayeredNodePlacer
s that share information about the layer height. Using
different IDs allows aligned layouts within different subtrees.
public double getLayerSpacing()
The spacing needs to be non-negative.
setLayerSpacing(double)
public void setLayerSpacing(double layerSpacing)
The spacing needs to be non-negative.
public void setRoutingStyle(int routingStyle)
PLAIN_STYLE
routingStyle
- one of the predefined edge routing styles
java.lang.IllegalArgumentException
- if the specified routing style specifier is unknownpublic int getRoutingStyle()
setRoutingStyle(int)
public double getBusAlignment()
The bus alignment determines the relative position of an edge bus in between two subsequent layers of nodes.
Values for a valid vertical alignment are in the range [0..1]
, such that:
0.0
places the bus at the top, right below the parent node.0.5
places the bus in the middle between parent and child nodes.1.0
places the bus at the bottom, right above the child nodes.
routing style
is set
to ORTHOGONAL_STYLE
.setBusAlignment(double)
public void setBusAlignment(double busAlignment)
The bus alignment determines the relative position of an edge bus in between two subsequent layers of nodes.
Values for a valid vertical alignment are in the range [0..1]
, such that:
0.0
places the bus at the top, right below the parent node.0.5
places the bus in the middle between parent and child nodes.1.0
places the bus at the bottom, right above the child nodes.
public boolean isPolylineLabelingEnabled()
If enabled, polyline connectors between the parent and its children are added to the according subtree shape. Node or edge labels will not be crossed.
routing style
is
PLAIN_STYLE
.true
if polyline connectors are added, false
otherwisesetPolylineLabelingEnabled(boolean)
public void setPolylineLabelingEnabled(boolean polylineLabelingEnabled)
If enabled, polyline connectors between the parent and its children are added to the according subtree shape. Node or edge labels will not be crossed.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |