|
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.GridNodePlacer
public class GridNodePlacer
The GridNodePlacer
arranges the shapes of the children of a local root in a grid.
The grid consists of a number of rows. The subtrees are assigned to the rows using a DataProvider
that is
registered with the graph with GRID_DPKEY
. If there is no row mapping provided, all subtrees are assigned
to a single row. Furthermore, if property setAutomaticRowAssignmentEnabled(boolean)
is enabled, the
row assignment is made automatically - the produced grid will be square-like with respect to the child count,
ignoring actual subtree sizes. For example, if there are nine children, a grid with three rows is generated.
The edges from the children to the local root are routed in a bus-like way. The placement of the bus
can be configured using the property setBusPlacement(int)
. The alignment of the root
node can be configured using setRootAlignment(AbstractRotatableNodePlacer.RootAlignment)
.
To align the root node with the bus, use BUS_ALIGNED
. A bus-aligned root in conjunction with
BUS_PLACEMENT_CENTER
produces a symmetric grid with the bus and root aligned in the middle.
Child nodes in a grid with three rows, with a bus-aligned root and the bus placed in the center
Child nodes placed in a grid using three rows and four columns where the root alignment and bus placement are leading.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment |
Field Summary | |
---|---|
static AbstractRotatableNodePlacer.RootAlignment |
BUS_ALIGNED
Horizontal RootAlignment with the bus of the grid so that the position of the root
depends on the selected bus placement . |
static int |
BUS_PLACEMENT_CENTER
A bus placement that places the bus that connects the child nodes in the center of the child subtrees. |
static int |
BUS_PLACEMENT_LEADING
A bus placement that places the bus that connects the child nodes in a leading way, left of the child subtrees. |
static int |
BUS_PLACEMENT_TRAILING
A bus placement that places the bus that connects the child nodes in a trailing way, right of the child subtrees. |
static java.lang.Object |
GRID_DPKEY
A DataProvider key for assigning nodes to the rows in the grid
If no DataProvider is registered with this key, all nodes will be placed in the same row. |
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 | |
---|---|
GridNodePlacer()
Creates a new GridNodePlacer with default settings. |
|
GridNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
Creates a new GridNodePlacer instance whose direction is specified by the given modification matrix. |
|
GridNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix,
AbstractRotatableNodePlacer.RootAlignment rootAlignment)
Creates a new GridNodePlacer instance with the given modification matrix
and root alignment . |
Method Summary | |
---|---|
java.util.Comparator |
createFromSketchComparator()
Creates a Comparator that sorts the outgoing edges according to the rows and x-coordinates of their target
nodes. |
protected byte |
determineChildConnector(Node child)
Returns NodePlacer.DIRECTION_NORTH for every given child node. |
int |
getBusPlacement()
Returns the placement of the bus with respect to the child node grid. |
AbstractRotatableNodePlacer.RootAlignment |
getRootAlignment()
Returns the RootAlginment that defines how the root node
is aligned with its children and their shapes. |
boolean |
isAutomaticRowAssignmentEnabled()
Returns whether or not the nodes are automatically assigned to the rows of the grid. |
protected y.layout.tree.SubtreeShapeRotated |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
Places the children of a local root node in a grid. |
void |
setAutomaticRowAssignmentEnabled(boolean automaticRowAssignmentEnabled)
Specifies whether or not the nodes are automatically assigned to the rows of the grid. |
void |
setBusPlacement(int busPlacement)
Specifies the placement of the bus with respect to the child node grid. |
void |
setRootAlignment(AbstractRotatableNodePlacer.RootAlignment rootAlignment)
Specifies the RootAlginment that defines how the root node
is aligned with its children and their shapes. |
Methods inherited from class y.layout.tree.AbstractRotatableNodePlacer |
---|
createComparator, createProcessor, 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 java.lang.Object GRID_DPKEY
DataProvider
key for assigning nodes to the rows in the grid
If no DataProvider
is registered with this key, all nodes will be placed in the same row.
public static final int BUS_PLACEMENT_LEADING
public static final int BUS_PLACEMENT_TRAILING
public static final int BUS_PLACEMENT_CENTER
For a row with n > 1
children, the bus segment is placed after the (n/2)th
child.
If a row consists of a single child, it is placed right of the bus.
public static final AbstractRotatableNodePlacer.RootAlignment BUS_ALIGNED
RootAlignment
with the bus of the grid so that the position of the root
depends on the selected bus placement
.
The root node is simply center-aligned with the bus of the subtree grid created by GridNodePlacer
.
The given shapes of the children and the spacing are not considered in any way.
GridNodePlacer
.Constructor Detail |
---|
public GridNodePlacer()
GridNodePlacer
with default settings.
public GridNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix)
GridNodePlacer
instance whose direction is specified by the given modification matrix.
modificationMatrix
- the transformation matrix for this AbstractRotatableNodePlacer
java.lang.IllegalArgumentException
- if the given transformation matrix is null
public GridNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix, AbstractRotatableNodePlacer.RootAlignment rootAlignment)
GridNodePlacer
instance with the given modification matrix
and root alignment
.
modificationMatrix
- the transformation matrix for this AbstractRotatableNodePlacer
rootAlignment
- the alignment of the local root with its subtrees
java.lang.IllegalArgumentException
- if the given root alignment or the given transformation
matrix is null
Method Detail |
---|
public int getBusPlacement()
setBusPlacement(int)
public void setBusPlacement(int busPlacement)
BUS_PLACEMENT_LEADING
. The bus is placed leading, left of the grid structure.busPlacement
- one of the predefined bus placements
java.lang.IllegalArgumentException
- if the given bus placement is unknownpublic boolean isAutomaticRowAssignmentEnabled()
If enabled, the nodes are assigned to rows automatically. User-specified row indices are ignored. The grid will be square-like with respect to the child count, ignoring actual subtree sizes. For example, if there are nine children, a grid with three rows - each row containing three nodes - is generated.
from-sketch order
is ignored.true
if nodes are automatically assigned to rows, false
otherwisesetAutomaticRowAssignmentEnabled(boolean)
public void setAutomaticRowAssignmentEnabled(boolean automaticRowAssignmentEnabled)
If enabled, the nodes are assigned to rows automatically. User-specified row indices are ignored. The grid will be square-like with respect to the child count, ignoring actual subtree sizes. For example, if there are nine children, a grid with three rows - each row containing three nodes - is generated.
from-sketch order
is ignored.automaticRowAssignmentEnabled
- true
if nodes should be automatically assigned to rows,
false
otherwiseprotected 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 java.util.Comparator createFromSketchComparator()
Comparator
that sorts the outgoing edges according to the rows and x-coordinates of their target
nodes.
Edges that connect to nodes in different rows are ordered by the row index. If two edges connect to the same row, they are sorted by the x-coordinates of their target nodes.
createFromSketchComparator
in interface FromSketchNodePlacer
createFromSketchComparator
in class AbstractRotatableNodePlacer
automatically assigned
, the created
from-sketch Comparator
does not have an effect.Comparator
that orders edges lexicographically by row and x-coordinates of their target nodesGRID_DPKEY
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.
BUS_ALIGNED
rootAlignment
- the AbstractRotatableNodePlacer.RootAlignment
instance specifying the location
relative to the subtrees
java.lang.IllegalArgumentException
- if the given root alignment is null
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |