|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.hierarchic.AlignmentDrawer
public class AlignmentDrawer
This class rearranges the nodes within the layers calculated by the HierarchicLayouter
such that they are aligned according to the user's specifications.
This class can be used for wrapping another Drawer implementation.
It will rearrange nodes that belong to the same layer such that they are aligned within the layer with
respect to a given alignment point, given by a registered AlignmentDrawer.TopAlignmentDataProvider that may provide double values that
are interpreted as relative coordinates to the center of the node.
![]() |
![]() |
| Nested Class Summary | |
|---|---|
static class |
AlignmentDrawer.BottomAlignmentDataProvider
A DataProvider that will make all nodes bottom-aligned (in top-to-bottom layouts) when registered. |
static class |
AlignmentDrawer.LeftAlignmentDataProvider
A DataProvider that will make all nodes left-aligned (in left-to-right layouts) when registered. |
static class |
AlignmentDrawer.RightAlignmentDataProvider
A DataProvider that will make all nodes right-aligned (in left-to-right layouts) when registered. |
static class |
AlignmentDrawer.TopAlignmentDataProvider
A DataProvider that will make all nodes top-aligned (in top-to-bottom layouts) when registered. |
| Field Summary | |
|---|---|
static java.lang.Object |
NODE_ALIGNMENT_POINT_DPKEY
A DataProvider key for depicting the center anchored offset to the alignment point.
|
| Fields inherited from interface y.layout.hierarchic.Drawer |
|---|
NODE_BORDER_BOTTOM, NODE_BORDER_LEFT, NODE_BORDER_RIGHT, NODE_BORDER_TOP, NODE_DISTANCE |
| Constructor Summary | |
|---|---|
AlignmentDrawer(Drawer inner)
Creates an AlignmentDrawer instance using the given Drawer instance as the actual drawer. |
|
| Method Summary | |
|---|---|
protected void |
alignNodes(LayoutGraph graph,
NodeList[] layerLists)
Modifies the given drawing by modifying the y-coordinates only. |
void |
assignCoordinates(LayoutGraph graph,
NodeList[] layerLists,
DataProvider layerID)
Modifies the coordinates retrieved from the wrapped drawer in order to make the y-coordinates comply with the desired node alignment within the layers. |
void |
setDummyMap(NodeMap dummyMap)
Specifies a NodeMap instance for identifying the dummy nodes from the real ones. |
void |
setMinimalEdgeDistance(double d)
Specifies the minimum distance between two edges that span the same layer. |
void |
setMinimalLayerDistance(double d)
Specifies the minimum distance between two layers. |
void |
setMinimalMultiEdgeDistance(double d)
Specifies the minimum distance between two edges sharing source/target in the same layer. |
void |
setMinimalNodeDistance(double d)
Specifies the minimum distance between two nodes in the same layer. |
| 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 NODE_ALIGNMENT_POINT_DPKEY
DataProvider key for depicting the center anchored offset to the alignment point.
More precisely, this AlignmentDrawer.TopAlignmentDataProvider returns a value representing the desired alignment for each node, e.g.,
0.5 * height(node) corresponds to bottom alignment, -0.5 * height(node) corresponds to
top alignment, 0.5 * width(node) corresponds to right alignment, -0.5 * width(node)
corresponds to left alignment and 0 to center alignment.
| Constructor Detail |
|---|
public AlignmentDrawer(Drawer inner)
AlignmentDrawer instance using the given Drawer instance as the actual drawer.
inner - the given Drawer instance
java.lang.IllegalArgumentException - if the given instance is null| Method Detail |
|---|
protected void alignNodes(LayoutGraph graph,
NodeList[] layerLists)
This method recalculates the height of each layer based on the heights of the nodes that belong to each layer and the desired alignment. It also modifies the y-coordinates of the nodes such that they comply with the desired alignment.
It is called by assignCoordinates(LayoutGraph, NodeList[], DataProvider) and can be overridden for custom
calculation of the y-coordinates.
graph - the graphlayerLists - an array of NodeLists each of which contains nodes that belong to the same layer
public void assignCoordinates(LayoutGraph graph,
NodeList[] layerLists,
DataProvider layerID)
assignCoordinates in interface Drawergraph - the graphlayerLists - the array of NodeLists each of which contains nodes that belong to the same layerlayerID - the AlignmentDrawer.TopAlignmentDataProvider that returns the zero-based index of the layer to which each node belongspublic void setDummyMap(NodeMap dummyMap)
DrawerNodeMap instance for identifying the dummy nodes from the real ones.
setDummyMap in interface DrawerdummyMap - the NodeMap that returns the original edge for each dummy node or
null for real nodespublic void setMinimalEdgeDistance(double d)
Minimum distance must be non-negative.
setMinimalEdgeDistance in interface Drawerpublic void setMinimalLayerDistance(double d)
Minimum distance must be non-negative.
setMinimalLayerDistance in interface Drawerpublic void setMinimalMultiEdgeDistance(double d)
Minimum distance must be non-negative.
setMinimalMultiEdgeDistance in interface Drawerpublic void setMinimalNodeDistance(double d)
Minimum distance must be non-negative.
setMinimalNodeDistance in interface Drawer
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||