public class GridNodePlacer extends AbstractRotatableNodePlacer
GridNodePlacer
arranges the shapes of the children of a local root in a grid.
IDataProvider
that is registered with the graph with ROW_INDEX_DPKEY
.
Child nodes placed in a grid using three rows and four columns
AbstractRotatableNodePlacer.Matrix, AbstractRotatableNodePlacer.RootAlignment
Modifier and Type | Field and Description |
---|---|
static NodeDpKey<Integer> |
ROW_INDEX_DPKEY
A
DataProvider key for assigning nodes to the rows in the grid
If no IDataProvider is registered with this key, all nodes will be placed in the same row. |
createdChildren, graph, nodeShapeProvider, subtreeShapeProvider
Constructor and Description |
---|
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)
|
Modifier and Type | Method and Description |
---|---|
Comparator<Object> |
createFromSketchComparator()
Creates a
Comparator that sorts the outgoing edges according to the rows and x-coordinates of their target
nodes. |
protected ParentConnectorDirection |
determineChildConnector(Node child)
Returns
ParentConnectorDirection.NORTH for every given child node. |
AbstractRotatableNodePlacer.RootAlignment |
getRootAlignment()
Gets the
RootAlginment that defines how the root node is aligned with
its children and their shapes. |
protected RotatedSubtreeShape |
placeSubtree(Node localRoot,
ParentConnectorDirection parentConnectorDirection)
Places the children of a local root node in a grid.
|
void |
setRootAlignment(AbstractRotatableNodePlacer.RootAlignment value)
Sets the
RootAlginment that defines how the root node is aligned with
its children and their shapes. |
createComparator, createProcessor, determineChildConnectors, getModificationMatrix, getNodeShape, getPortConstraint, getSourcePointAbs, getSpacing, getSubtreeShape, placeSubtree, setSpacing, translateDirectionToModel, translateDirectionToReal, translatePoint
public static final NodeDpKey<Integer> ROW_INDEX_DPKEY
DataProvider
key for assigning nodes to the rows in the grid
If no IDataProvider
is registered with this key, all nodes will be placed in the same row.
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
public GridNodePlacer(AbstractRotatableNodePlacer.Matrix modificationMatrix, AbstractRotatableNodePlacer.RootAlignment rootAlignment)
modificationMatrix
- the transformation matrix for this AbstractRotatableNodePlacer
rootAlignment
- the alignment of the local root with its subtreespublic Comparator<Object> 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 IFromSketchNodePlacer
createFromSketchComparator
in class AbstractRotatableNodePlacer
Comparator
that orders edges lexicographically by row and x-coordinates of their target nodesROW_INDEX_DPKEY
protected ParentConnectorDirection determineChildConnector(Node child)
ParentConnectorDirection.NORTH
for every given child node.
Edges always connect to the top of the child nodes.
determineChildConnector
in class AbstractRotatableNodePlacer
child
- the child nodeParentConnectorDirection.NORTH
public AbstractRotatableNodePlacer.RootAlignment getRootAlignment()
RootAlginment
that defines how the root node is aligned with
its children and their shapes.AbstractRotatableNodePlacer.RootAlignment.CENTER
AbstractRotatableNodePlacer.RootAlignment
instance specifying the location relative to the subtreessetRootAlignment(AbstractRotatableNodePlacer.RootAlignment)
protected RotatedSubtreeShape placeSubtree(Node localRoot, ParentConnectorDirection parentConnectorDirection)
placeSubtree
in class AbstractRotatableNodePlacer
localRoot
- the local root nodeparentConnectorDirection
- the direction specifier for the connector of the local root node to its parent nodepublic void setRootAlignment(AbstractRotatableNodePlacer.RootAlignment value)
RootAlginment
that defines how the root node is aligned with
its children and their shapes.AbstractRotatableNodePlacer.RootAlignment.CENTER
value
- AbstractRotatableNodePlacer.RootAlignment
instance specifying the location relative to the subtreesgetRootAlignment()