|
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.DefaultNodePlacer
public class DefaultNodePlacer
Versatile default implementation of NodePlacer
used by
GenericTreeLayouter
. This implementation provides
a couple of related styles for laying out subtrees in a tree layout.
The styles can be customized easily using a wealth of different options.
This implementation is capable of dealing with PortConstraints correctly.
Field Summary | |
---|---|
static byte |
ALIGNMENT_CENTER
Alignment byte constant used for the rootAlignment property. |
static byte |
ALIGNMENT_LEADING
Alignment byte constant used for the rootAlignment property. |
static byte |
ALIGNMENT_LEADING_OFFSET
Alignment byte constant used for the rootAlignment property. |
static byte |
ALIGNMENT_LEADING_ON_BUS
Alignment byte constant used for the rootAlignment property. |
static byte |
ALIGNMENT_MEDIAN
Alignment byte constant used for the rootAlignment property. |
static byte |
ALIGNMENT_TRAILING
Alignment byte constant used for the rootAlignment property. |
static byte |
ALIGNMENT_TRAILING_OFFSET
Alignment byte constant used for the rootAlignment property. |
static byte |
ALIGNMENT_TRAILING_ON_BUS
Alignment byte constant used for the rootAlignment property. |
static byte |
PLACEMENT_HORIZONTAL_DOWNWARD
Placement byte constant used for the childPlacement property. |
static byte |
PLACEMENT_HORIZONTAL_UPWARD
Placement byte constant used for the childPlacement property. |
static byte |
PLACEMENT_VERTICAL_TO_LEFT
Placement byte constant used for the childPlacement property. |
static byte |
PLACEMENT_VERTICAL_TO_RIGHT
Placement byte constant used for the childPlacement property. |
static byte |
ROUTING_FORK
Routing style byte constant used for the routingStyle property. |
static byte |
ROUTING_FORK_AT_ROOT
Routing style byte constant used for the routingStyle property. |
static byte |
ROUTING_POLY_LINE
Routing style byte constant used for the routingStyle property. |
static byte |
ROUTING_STRAIGHT
Routing style byte constant used for the routingStyle property. |
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 | |
---|---|
DefaultNodePlacer()
Creates a new DefaultNodePlacer with default alignment ( ALIGNMENT_CENTER ),
default child placement (PLACEMENT_HORIZONTAL_DOWNWARD ),
and default edge routing (ROUTING_FORK ) and a horizontal and vertical distance
of 40.0d . |
|
DefaultNodePlacer(byte childPlacement,
byte rootAlignment,
byte routingStyle,
double verticalDistance,
double horizontalDistance)
Creates a new DefaultNodePlacer. |
|
DefaultNodePlacer(byte childPlacement,
byte rootAlignment,
byte routingStyle,
double verticalDistance,
double horizontalDistance,
double minFirstSegmentLength,
double minLastSegmentLength,
double minSlope,
double minSlopeHeight)
Creates a new DefaultNodePlacer. |
|
DefaultNodePlacer(byte childPlacement,
byte rootAlignment,
double verticalDistance,
double horizontalDistance)
Creates a new DefaultNodePlacer with default edge routing ( ROUTING_FORK ). |
|
DefaultNodePlacer(byte childPlacement,
double verticalDistance,
double horizontalDistance)
Creates a new DefaultNodePlacer with default alignment ( ALIGNMENT_CENTER )
and default edge routing (ROUTING_FORK ). |
Method Summary | |
---|---|
protected void |
calcParentConnector(LayoutGraph graph,
Node localRoot,
NodeLayout rootLayout,
GenericTreeLayouter.SubtreeShape subtreeShape,
Edge parentEdge,
EdgeLayout parentEdgeLayout,
byte direction)
Calculates the connector the the parent node. |
protected void |
calcSlopedSourceEdgeLayout(NodeLayout rootLayout,
GenericTreeLayouter.SubtreeShape childShape,
Edge edge,
double childForkCoordinate,
double rootForkCoordinate)
Performs the routing of the source side of the edge to the given child node. |
protected void |
calcSourceEdgeLayout(NodeLayout rootLayout,
GenericTreeLayouter.SubtreeShape childShape,
Edge edge)
Performs the routing of the source side of the edge to the given child node. |
protected void |
calcTargetEdgeLayout(NodeLayout rootLayout,
GenericTreeLayouter.SubtreeShape childShape,
Edge edge)
Performs the routing of the target side of the edge to the given child node. |
Comparator |
createComparator()
Returns a Comparator instance that can be used to register with the GenericTreeLayouter. |
Comparator |
createFromSketchComparator()
Creates a comparator for edges. |
protected byte |
determineChildConnector(Node child)
This method must be implemented by subclasses. |
byte |
getChildPlacement()
Returns the child node placement policy. |
double |
getHorizontalDistance()
Returns the horizontal distance this NodePlacer should use for the
arrangement of the elements. |
double |
getMinFirstSegmentLength()
Returns the minimum length of the segment between the parent node port and the first bend of the edge. |
double |
getMinLastSegmentLength()
Returns the minimum length of the segment between the last bend of the slope and the port of the child node.. |
double |
getMinSlope()
Returns the minimum slope of edges. |
double |
getMinSlopeHeight()
Returns the minimum height for slopes of edges. |
byte |
getRootAlignment()
Returns the root node alignment policy. |
byte |
getRoutingStyle()
Returns the current routing style byte constant. |
double |
getVerticalDistance()
Returns the vertical distance this NodePlacer should use for the arrangement of the elements. |
protected GenericTreeLayouter.SubtreeShape |
placeSubtree(Node localRoot,
byte parentConnectorDirection)
The main placeSubtree method that must be implemented by subclasses. |
void |
setChildPlacement(byte childPlacement)
Sets the child node placement policy. |
void |
setHorizontalDistance(double horizontalDistance)
Sets the horizontal distance this NodePlacer should use for the
arrangement of the elements. |
void |
setMinFirstSegmentLength(double minFirstSegmentLength)
Sets the minimum length of the segment between the parent node port and the first bend of the edge. |
void |
setMinLastSegmentLength(double minLastSegmentLength)
Sets the minimum length of the segment between the last bend of the slope and the port of the child node. |
void |
setMinSlope(double minSlope)
Sets the minimum slope of edges. |
void |
setMinSlopeHeight(double minSlopeHeight)
Sets the minimum height for slopes of edges. |
void |
setRootAlignment(byte rootAlignment)
Sets the root node alignment policy. |
void |
setRoutingStyle(byte routingStyle)
Specifies the current routing style. |
void |
setVerticalDistance(double verticalDistance)
Sets the vertical distance this NodePlacer should use for the arrangement of the elements. |
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 PLACEMENT_VERTICAL_TO_LEFT
childPlacement
property.
This placement strategy arranges child subtrees vertically beneath each other
to the left of the root node.
setChildPlacement(byte)
,
getChildPlacement()
,
Constant Field Valuespublic static final byte PLACEMENT_VERTICAL_TO_RIGHT
childPlacement
property.
This placement strategy arranges child subtrees vertically beneath each other
to the right of the root node.
setChildPlacement(byte)
,
getChildPlacement()
,
Constant Field Valuespublic static final byte PLACEMENT_HORIZONTAL_UPWARD
childPlacement
property.
This placement strategy arranges child subtrees horizontally next to each other
above the root node.
setChildPlacement(byte)
,
getChildPlacement()
,
Constant Field Valuespublic static final byte PLACEMENT_HORIZONTAL_DOWNWARD
childPlacement
property.
This placement strategy arranges child subtrees horizontally next to each other
below the root node.
setChildPlacement(byte)
,
getChildPlacement()
,
Constant Field Valuespublic static final byte ALIGNMENT_LEADING_OFFSET
rootAlignment
property.
This constant places the root ahead of all the child subtrees.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ALIGNMENT_LEADING
rootAlignment
property.
This constant aligns the root with the first of its subtrees.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ALIGNMENT_CENTER
rootAlignment
property.
This constant aligns the root at the center of its subtrees.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ALIGNMENT_MEDIAN
rootAlignment
property.
This constant aligns the root at the median of the connection points to its subtrees.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ALIGNMENT_TRAILING
rootAlignment
property.
This constant aligns the root at with the last of its subtrees.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ALIGNMENT_TRAILING_OFFSET
rootAlignment
property.
This constant places the root after all of its subtrees.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ALIGNMENT_TRAILING_ON_BUS
rootAlignment
property.
This constant places the root after all of its subtrees and centered on the bus.
Note: The vertical/horizontal distance between the root node and the subtree shapes depend on the value of parameters verticalDistance/horizontalDistance passed to the Constructor.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ALIGNMENT_LEADING_ON_BUS
rootAlignment
property.
This constant places the root ahead of all the child subtrees and centered on the bus.
Note: The vertical/horizontal distance between the root node and the subtree shapes depend on the value of parameters verticalDistance/horizontalDistance passed to the Constructor.
setRootAlignment(byte)
,
getRootAlignment()
,
Constant Field Valuespublic static final byte ROUTING_FORK
routingStyle
property.
Using this value will result in orthogonally routed child node
connectors where the bends are placed in the channel between the
root node and the child nodes.
setRoutingStyle(byte)
,
getRoutingStyle()
,
Constant Field Valuespublic static final byte ROUTING_FORK_AT_ROOT
routingStyle
property.
Using this value will result in orthogonally routed child node
connectors with one bend each placed next to the root node.
setRoutingStyle(byte)
,
getRoutingStyle()
,
Constant Field Valuespublic static final byte ROUTING_STRAIGHT
routingStyle
property.
Using this value will result in straight connections to the child nodes.
Edges may overlap nodes in this case.
setRoutingStyle(byte)
,
getRoutingStyle()
,
Constant Field Valuespublic static final byte ROUTING_POLY_LINE
routingStyle
property.
Using this value will result in straight connections to the connector of the subtree.
setRoutingStyle(byte)
,
getRoutingStyle()
,
Constant Field ValuesConstructor Detail |
---|
public DefaultNodePlacer()
ALIGNMENT_CENTER
),
default child placement (PLACEMENT_HORIZONTAL_DOWNWARD
),
and default edge routing (ROUTING_FORK
) and a horizontal and vertical distance
of 40.0d
.
public DefaultNodePlacer(byte childPlacement, double verticalDistance, double horizontalDistance)
ALIGNMENT_CENTER
)
and default edge routing (ROUTING_FORK
).
childPlacement
- placement constant describing the style of the arrangementverticalDistance
- the vertical distance between the root node and the subtree shapes or between
subtree shapes in case of vertical child placementhorizontalDistance
- the horizontal distance between the root node and the subtree shapes or between
subtree shapes in case of horizontal child placementpublic DefaultNodePlacer(byte childPlacement, byte rootAlignment, double verticalDistance, double horizontalDistance)
ROUTING_FORK
).
childPlacement
- placement constant describing the style of the arrangementrootAlignment
- alignment constant describing the position of the root nod
with respect to the subtreesverticalDistance
- the vertical distance between the root node and the subtree shapes or between
subtree shapes in case of vertical child placementhorizontalDistance
- the horizontal distance between the root node and the subtree shapes or between
subtree shapes in case of horizontal child placementpublic DefaultNodePlacer(byte childPlacement, byte rootAlignment, byte routingStyle, double verticalDistance, double horizontalDistance)
routingStyle
- routing style constantchildPlacement
- placement constant describing the style of the arrangementrootAlignment
- alignment constant describing the position of the root nod
with respect to the subtreesverticalDistance
- the vertical distance between the root node and the subtree shapes or between
subtree shapes in case of vertical child placementhorizontalDistance
- the horizontal distance between the root node and the subtree shapes or between
subtree shapes in case of horizontal child placementpublic DefaultNodePlacer(byte childPlacement, byte rootAlignment, byte routingStyle, double verticalDistance, double horizontalDistance, double minFirstSegmentLength, double minLastSegmentLength, double minSlope, double minSlopeHeight)
routingStyle
- routing style constantchildPlacement
- placement constant describing the style of the arrangementrootAlignment
- alignment constant describing the position of the root nod
with respect to the subtreesverticalDistance
- the vertical distance between the root node and the subtree shapes or between
subtree shapes in case of vertical child placementhorizontalDistance
- the horizontal distance between the root node and the subtree shapes or between
subtree shapes in case of horizontal child placementminFirstSegmentLength
- the minimum length of the segment from the parent node port to the bend of the slopeminLastSegmentLength
- the minimum length of the segment from the last bend of the slope to the port of the child nodeminSlope
- the minimum slope between the root node and the subtree shapesminSlopeHeight
- the minimum height of slopes between the root node and the subtree shapesMethod Detail |
---|
protected GenericTreeLayouter.SubtreeShape placeSubtree(Node localRoot, byte parentConnectorDirection)
AbstractNodePlacer
placeSubtree
in class AbstractNodePlacer
localRoot
- the local root nodeparentConnectorDirection
- the direction of the connector shape
protected void calcParentConnector(LayoutGraph graph, Node localRoot, NodeLayout rootLayout, GenericTreeLayouter.SubtreeShape subtreeShape, Edge parentEdge, EdgeLayout parentEdgeLayout, byte direction)
graph
- the graphlocalRoot
- the root whose connector must be calculated and stored in the
subtreeShaperootLayout
- the NodeLayout of the root nodesubtreeShape
- the shape to be used for the connector informationparentEdge
- the edge that will later be routed according to the
information in the subtreeShapeparentEdgeLayout
- the current EdgeLayout of the edgedirection
- the direction byte constant as defined in the
NodePlacer
interface which should be used for
the connectorprotected void calcTargetEdgeLayout(NodeLayout rootLayout, GenericTreeLayouter.SubtreeShape childShape, Edge edge)
rootLayout
- the NodeLayout of the local root nodechildShape
- the SubtreeShape instance of the corresponding child's
subtreeedge
- the edgeprotected void calcSlopedSourceEdgeLayout(NodeLayout rootLayout, GenericTreeLayouter.SubtreeShape childShape, Edge edge, double childForkCoordinate, double rootForkCoordinate)
calcSourceEdgeLayout(y.layout.NodeLayout, y.layout.tree.GenericTreeLayouter.SubtreeShape, y.base.Edge)
if routingStyle
is not ROUTING_FORK
This method calculates the source bends according to
the current routingStyle
, and connects the bends of the child
SubtreeShape connector to the EdgeLayout.
rootLayout
- the NodeLayout of the local root nodechildShape
- the SubtreeShape instance of the corresponding child's subtreeedge
- the edgerootForkCoordinate
- the y-coordinate of the first bend of the edge if the placement is horizontal and the x-coordinate otherwise.childForkCoordinate
- the y-coordinate of the second (= last) bend of the edge if the placement is horizontal and the x-coordinate otherwise.protected void calcSourceEdgeLayout(NodeLayout rootLayout, GenericTreeLayouter.SubtreeShape childShape, Edge edge)
routingStyle
, and connects the bends of the child
SubtreeShape connector to the EdgeLayout.
rootLayout
- the NodeLayout of the local root nodechildShape
- the SubtreeShape instance of the corresponding child's
subtreeedge
- the edgepublic byte getChildPlacement()
public void setChildPlacement(byte childPlacement)
public byte getRootAlignment()
public void setRootAlignment(byte rootAlignment)
protected byte determineChildConnector(Node child)
AbstractNodePlacer
determineChildConnector
in class AbstractNodePlacer
child
- the child node
NodePlacer
interfacepublic byte getRoutingStyle()
public void setRoutingStyle(byte routingStyle)
routingStyle
- the set routing style byte constant.public double getVerticalDistance()
public void setVerticalDistance(double verticalDistance)
public double getMinFirstSegmentLength()
public void setMinFirstSegmentLength(double minFirstSegmentLength)
public double getMinLastSegmentLength()
public void setMinLastSegmentLength(double minLastSegmentLength)
public double getMinSlope()
public void setMinSlope(double minSlope)
public double getMinSlopeHeight()
public void setMinSlopeHeight(double minSlopeHeight)
public double getHorizontalDistance()
NodePlacer
should use for the
arrangement of the elements.
public void setHorizontalDistance(double horizontalDistance)
NodePlacer
should use for the
arrangement of the elements.
public Comparator createComparator()
public Comparator createFromSketchComparator()
FromSketchNodePlacer
createFromSketchComparator
in interface FromSketchNodePlacer
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |