|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.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_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 |
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,
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 |
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. |
Object |
clone()
Overwritten to support cloning. |
Comparator |
createComparator()
Returns a Comparator instance that can be used to register with the GenericTreeLayouter. |
protected byte |
determineChildConnector(Node child)
This method must be implemented by subclasses. |
byte |
getChildPlacement()
Returns the current placement byte constant. |
double |
getHorizontalDistance()
Returns the current horizontal distance this NodePlacer should use for the arrangement of the elements. |
byte |
getRootAlignment()
Returns the current rootAlignment byte constant. |
byte |
getRoutingStyle()
Returns the current routingStyle byte constant. |
double |
getVerticalDistance()
Returns the current 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 new placement byte constant. |
void |
setHorizontalDistance(double horizontalDistance)
Sets the new horizontalDistance distance this NodePlacer should use for the arrangement of the elements. |
void |
setRootAlignment(byte rootAlignment)
Sets the new rootAlignment byte constant. |
void |
setRoutingStyle(byte routingStyle)
Setter for property routingStyle. |
void |
setVerticalDistance(double verticalDistance)
Sets the new vertical distance this NodePlacer should use for the arrangement of the elements. |
| Methods inherited from class y.layout.tree.AbstractNodePlacer |
|---|
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.
public 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.
public static final byte PLACEMENT_HORIZONTAL_UPWARD
childPlacement property.
This placement strategy arranges child subtrees horizontally next to each other
above the root node.
public static final byte PLACEMENT_HORIZONTAL_DOWNWARD
childPlacement property.
This placement strategy arranges child subtrees horizontally next to each other
below the root node.
public static final byte ALIGNMENT_LEADING_OFFSET
rootAlignment property.
This constant places the root ahead of all the child subtrees.
public static final byte ALIGNMENT_LEADING
rootAlignment property.
This constant aligns the root with the first of its subtrees.
public static final byte ALIGNMENT_CENTER
rootAlignment property.
This constant aligns the root at the center of its subtrees.
public static final byte ALIGNMENT_MEDIAN
rootAlignment property.
This constant aligns the root at the median of the connection points to its subtrees.
public static final byte ALIGNMENT_TRAILING
rootAlignment property.
This constant aligns the root at with the last of its subtrees.
public static final byte ALIGNMENT_TRAILING_OFFSET
rootAlignment property.
This constant places the root after all of its subtrees.
public 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.
public 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.
public 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.
public static final byte ROUTING_POLY_LINE
routingStyle property.
Using this value will result in straight connections to the connector of the subtree.
| Constructor 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 placement
public 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 placement
public 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 placement| Method Detail |
|---|
protected GenericTreeLayouter.SubtreeShape placeSubtree(Node localRoot,
byte parentConnectorDirection)
AbstractNodePlacer
placeSubtree in class AbstractNodePlacerlocalRoot - 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 connector
protected 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 edge
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)
childPlacement - New value of property childPlacement.public byte getRootAlignment()
public void setRootAlignment(byte rootAlignment)
rootAlignment - the new valueprotected byte determineChildConnector(Node child)
AbstractNodePlacer
determineChildConnector in class AbstractNodePlacerchild - the child node
NodePlacer interfacepublic byte getRoutingStyle()
public void setRoutingStyle(byte routingStyle)
routingStyle - New value of property routingStyle.public double getVerticalDistance()
public void setVerticalDistance(double verticalDistance)
verticalDistance - the new valuepublic double getHorizontalDistance()
public void setHorizontalDistance(double horizontalDistance)
horizontalDistance - the new valuepublic Comparator createComparator()
public Object clone()
clone in class Object
|
© Copyright 2000-2008, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||