|
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.AbstractNodePlacer y.layout.tree.ARNodePlacer
public class ARNodePlacer
This NodePlacer
places the subtrees such that the overall aspect ratio of the arranged subtree will
be close to a preferred aspect ratio.
The aspect ratio describes the relation between width and height of the subtree. To achieve the desired aspect ratio,
this NodePlacer
divides the child GenericTreeLayouter.SubtreeShape
s into as much rows as needed. The edges are
either routed along the rows or along the columns.
Field Summary | |
---|---|
static byte |
FILL_STYLE_CENTERED
Style specifier which defines that rows/columns are aligned with their center. |
static byte |
FILL_STYLE_JUSTIFY
Style specifier which defines that rows/columns are justified to have the same width/height. |
static byte |
FILL_STYLE_LEADING
Style specifier which defines that rows/columns are aligned with their leading side. |
static byte |
FILL_STYLE_TRAILING
Style specifier which defines that rows/columns are aligned with their trailing side. |
Fields inherited from class y.layout.tree.AbstractNodePlacer |
---|
graph |
Fields inherited from interface y.layout.tree.NodePlacer |
---|
DIRECTION_ANY, DIRECTION_EAST, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_SOUTH, DIRECTION_WEST |
Constructor Summary | |
---|---|
ARNodePlacer()
Creates a new instance of ARNodePlacer with default settings. |
|
ARNodePlacer(boolean horizontal,
double aspectRatio,
byte fillStyle,
double horizontalDistance,
double verticalDistance)
Creates a new instance of ARNodePlacer with given settings. |
Method Summary | |
---|---|
java.util.Comparator |
createFromSketchComparator()
Creates an edge Comparator which takes the initial coordinates of the nodes into account. |
protected byte |
determineChildConnector(Node child)
Determines a connector direction for the given child node depending on whether or not the child nodes are arranged horizontally . |
double |
getAspectRatio()
Returns the preferred aspect ratio (width/height) for the subtrees. |
byte |
getFillStyle()
Returns how rows/columns are aligned with each other. |
double |
getHorizontalDistance()
Returns the horizontal distance between the GenericTreeLayouter.SubtreeShape s. |
double |
getVerticalDistance()
Returns the vertical distance between the GenericTreeLayouter.SubtreeShape s. |
boolean |
isHorizontal()
Returns whether child nodes are distributed in horizontal rows or vertical columns. |
protected GenericTreeLayouter.SubtreeShape |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
Arranges the SubtreeShapes of children of the local root node in rows or columns
that fit the specified aspect ratio . |
void |
setAspectRatio(double aspectRatio)
Specifies the preferred aspect ratio (width/height) for the subtrees. |
void |
setFillStyle(byte fillStyle)
Specifies how rows/columns are aligned with each other. |
void |
setHorizontal(boolean horizontal)
Specifies whether child nodes are distributed in horizontal rows or vertical columns. |
void |
setHorizontalDistance(double horizontalDistance)
Specifies the horizontal distance between the GenericTreeLayouter.SubtreeShape s. |
void |
setVerticalDistance(double verticalDistance)
Specifies the vertical distance between the GenericTreeLayouter.SubtreeShape s. |
Methods inherited from class y.layout.tree.AbstractNodePlacer |
---|
clone, createProcessor, determineChildConnectors, getNodeShape, getSubtreeShape, placeSubtree |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface y.layout.tree.NodePlacer |
---|
createProcessor, determineChildConnectors, placeSubtree |
Field Detail |
---|
public static final byte FILL_STYLE_LEADING
public static final byte FILL_STYLE_CENTERED
public static final byte FILL_STYLE_JUSTIFY
public static final byte FILL_STYLE_TRAILING
Constructor Detail |
---|
public ARNodePlacer()
ARNodePlacer
with default settings.
public ARNodePlacer(boolean horizontal, double aspectRatio, byte fillStyle, double horizontalDistance, double verticalDistance)
ARNodePlacer
with given settings.
horizontal
- true
for horizontal row mode, false
for vertical row modehorizontalDistance
- horizontal distance between adjacent elementsverticalDistance
- vertical distance between adjacent elementsaspectRatio
- the aspectRatio for the subtreefillStyle
- a fill style constant describing the node distribution
java.lang.IllegalArgumentException
- if the specified aspect ratio is 0
or negative or if an unknown fill style is specified or
if the horizontal/vertical distance is negativeMethod Detail |
---|
protected byte determineChildConnector(Node child)
horizontally
.
If the child nodes are distributed horizontally, the edge should connect north
,
otherwise it should connect west
.
determineChildConnector
in class AbstractNodePlacer
child
- the child node
NodePlacer.DIRECTION_NORTH
if nodes are placed in rows, NodePlacer.DIRECTION_WEST
otherwiseprotected GenericTreeLayouter.SubtreeShape placeSubtree(Node localRoot, byte parentConnectorDirection)
SubtreeShapes
of children of the local root node in rows or columns
that fit the specified aspect ratio
.
placeSubtree
in class AbstractNodePlacer
localRoot
- the local root nodeparentConnectorDirection
- the direction of the connector
GenericTreeLayouter.SubtreeShape
containing the local root and all its subtreespublic boolean isHorizontal()
true
for horizontal rows, false
for vertical columnssetHorizontal(boolean)
public void setHorizontal(boolean horizontal)
public double getVerticalDistance()
GenericTreeLayouter.SubtreeShape
s.
The nodes will be placed below each other, keeping this distance.
The distance needs to be non-negative.
setVerticalDistance(double)
public void setVerticalDistance(double verticalDistance)
GenericTreeLayouter.SubtreeShape
s.
The nodes will be placed below each other, keeping this distance.
The distance needs to be non-negative.
public double getHorizontalDistance()
GenericTreeLayouter.SubtreeShape
s. The nodes will be placed next to each other,
keeping this distance.
The distance needs to be non-negative.
setHorizontalDistance(double)
public void setHorizontalDistance(double horizontalDistance)
GenericTreeLayouter.SubtreeShape
s. The nodes will be placed next to each other,
keeping this distance.
The distance needs to be non-negative.
public double getAspectRatio()
The aspect ratio needs to be positive.
setAspectRatio(double)
public void setAspectRatio(double aspectRatio)
The aspect ratio needs to be positive.
public byte getFillStyle()
setFillStyle(byte)
public void setFillStyle(byte fillStyle)
FILL_STYLE_LEADING
fillStyle
- one of the predefined fill styles
java.lang.IllegalArgumentException
- if an unknown fill style is specifiedpublic java.util.Comparator createFromSketchComparator()
Comparator
which takes the initial coordinates of the nodes into account.
This Comparator
defines the order of the outgoing edges of a node before the actual placement of the
node's subtree is calculated. It also considers whether or not the rows are placed
horiontally
.
createFromSketchComparator
in interface FromSketchNodePlacer
Comparator
for the edges
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |