|
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.DefaultPortAssignment
public class DefaultPortAssignment
This class provides simple default port assignment strategies.
Field Summary | |
---|---|
static byte |
MODE_NONE
Mode constant describing the strategy where all ports are reset to the center of their nodes. |
static byte |
MODE_PORT_CONSTRAINTS
Mode constant describing the strategy where edges having a weak port constraint, i.e., effectively a side constraint, will be anchored at the center of that side no port constraint set will be anchored at the center of the node Edges having a strong port constraint are anchored at that coordinates. |
static byte |
MODE_PORT_DISTRIBUTED_EAST
Mode constant describing the strategy where edges are distributed evenly at the eastern side of their nodes. |
static byte |
MODE_PORT_DISTRIBUTED_NORTH
Mode constant describing the strategy where edges are distributed evenly at the northern side of their nodes. |
static byte |
MODE_PORT_DISTRIBUTED_SOUTH
Mode constant describing the strategy where edges are distributed evenly at the southern side of their nodes. |
static byte |
MODE_PORT_DISTRIBUTED_WEST
Mode constant describing the strategy where edges are distributed evenly at the western side of their nodes. |
Constructor Summary | |
---|---|
DefaultPortAssignment()
Creates a new DefaultPortAssignment instance using mode MODE_NONE . |
|
DefaultPortAssignment(byte mode)
Creates a new DefaultPortAssignment instance using the given mode and the default value for the ratio of the gap between the border and the ports and the gap between the ports themselves. |
|
DefaultPortAssignment(byte mode,
double ratio)
Creates a new DefaultPortAssignment instance using the given mode and a given value for the ratio of the gap between the border and the ports and the gap between the ports themselves. |
Method Summary | |
---|---|
protected void |
assignChildEdgeSourcePort(LayoutGraph graph,
Node node,
Edge edge,
int index)
This method assigns the source port of an edge that goes to a child node. |
protected void |
assignParentEdgeTargetPort(LayoutGraph graph,
Node node,
Edge edge)
This method assigns the target port of the edge that goes to the parent node. |
void |
assignPorts(LayoutGraph graph,
Node node)
Called by GenericTreeLayouter before the actual layout
of the graph takes place. |
double |
getBorderGapToPortGapRatio()
Returns the ratio of the gap between the border of the node and the next port and the gap between the ports. |
byte |
getMode()
Returns the port assignment mode. |
protected double |
getPortBorderGap(double sideLength,
int edgeCount)
Callback method used to determine the port border gap for each node and side. |
protected double |
getPortDistanceDelta(double sideLength,
int edgeCount,
double portBorderGap)
Callback method used to determine the distance between two adjacent ports |
protected PortConstraint |
getSourcePortConstraint(LayoutGraph graph,
Edge edge,
int index)
Returns the PortConstraint for the given edge or null if no
PortConstraint is set. |
protected PortConstraint |
getTargetPortConstraint(LayoutGraph graph,
Edge edge)
Returns the PortConstraint for the given edge or null if no
PortConstraint is set. |
boolean |
isReversedPortOrder()
Indicates if the port assignment is set to reversed order. |
void |
setBorderGapToPortGapRatio(double borderGapToPortGapRatio)
Sets the ratio of the gap between the border of the node and the next port and the gap between the ports. |
void |
setMode(byte mode)
Sets the port assignment mode. |
void |
setReversedPortOrder(boolean reversedPortOrder)
Sets if the port assignment should use a reversed order. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte MODE_PORT_CONSTRAINTS
public static final byte MODE_PORT_DISTRIBUTED_NORTH
public static final byte MODE_PORT_DISTRIBUTED_SOUTH
public static final byte MODE_PORT_DISTRIBUTED_EAST
public static final byte MODE_PORT_DISTRIBUTED_WEST
public static final byte MODE_NONE
Constructor Detail |
---|
public DefaultPortAssignment()
MODE_NONE
.
public DefaultPortAssignment(byte mode)
mode
are:
MODE_NONE
: all ports lie on the same point.MODE_PORT_DISTRIBUTED_NORTH
: ports are distributed among the northern side of the node.MODE_PORT_DISTRIBUTED_SOUTH
: ports are distributed among the southern side of the node.MODE_PORT_DISTRIBUTED_EAST
: ports are distributed among the eastern side of the node.MODE_PORT_DISTRIBUTED_WEST
: ports are distributed among the western side of the node.MODE_PORT_CONSTRAINTS
: ports are distributed as specified.
public DefaultPortAssignment(byte mode, double ratio)
mode
are:
MODE_NONE
: all ports lie on the same point.MODE_PORT_DISTRIBUTED_NORTH
: ports are distributed among the northern side of the node.MODE_PORT_DISTRIBUTED_SOUTH
: ports are distributed among the southern side of the node.MODE_PORT_DISTRIBUTED_EAST
: ports are distributed among the eastern side of the node.MODE_PORT_DISTRIBUTED_WEST
: ports are distributed among the western side of the node.MODE_PORT_CONSTRAINTS
: ports are distributed as specified.
Method Detail |
---|
public void assignPorts(LayoutGraph graph, Node node)
PortAssignment
GenericTreeLayouter
before the actual layout
of the graph takes place. This method assigns both the single
incoming edge's target port as well as all source ports for all
outgoing child edges. Note that at the time this method gets invoked,
GenericTreeLayouter may have reversed some edges in order to normalize the
tree structure.
assignPorts
in interface PortAssignment
graph
- the graph instance the node is part ofnode
- the node whose adjacent edges' ports should be setprotected void assignParentEdgeTargetPort(LayoutGraph graph, Node node, Edge edge)
graph
- the graph which contains the nodenode
- the nodeedge
- the edge to the parent nodeprotected void assignChildEdgeSourcePort(LayoutGraph graph, Node node, Edge edge, int index)
graph
- the graph which contains the nodenode
- the parent nodeedge
- the edge to the child nodeindex
- the zero-based index of the child edgeprotected double getPortBorderGap(double sideLength, int edgeCount)
sideLength
- the width/height of the sideedgeCount
- the number of edges/port that connect to this side
protected double getPortDistanceDelta(double sideLength, int edgeCount, double portBorderGap)
sideLength
- the width/height of the sideedgeCount
- the number of edges/port that connect to this sideportBorderGap
- the previously calculated port border gap
protected PortConstraint getSourcePortConstraint(LayoutGraph graph, Edge edge, int index)
null
if no
PortConstraint is set. This implementation uses the PortConstraint data provider
that is bound to the graph, if available.
graph
- the graph the edge is part ofedge
- the edge whose PortConstraint is to be determinedindex
- the child's index
null
protected PortConstraint getTargetPortConstraint(LayoutGraph graph, Edge edge)
null
if no
PortConstraint is set. This implementation uses the PortConstraint data provider
that is bound to the graph, if available.
graph
- the graph the edge is part ofedge
- the edge whose PortConstraint is to be determined
null
public byte getMode()
MODE_NONE
: all ports lie on the same point.MODE_PORT_DISTRIBUTED_NORTH
: ports are distributed among the northern side of the node.MODE_PORT_DISTRIBUTED_SOUTH
: ports are distributed among the southern side of the node.MODE_PORT_DISTRIBUTED_EAST
: ports are distributed among the eastern side of the node.MODE_PORT_DISTRIBUTED_WEST
: ports are distributed among the western side of the node.MODE_PORT_CONSTRAINTS
: ports are distributed as specified.
public void setMode(byte mode)
MODE_NONE
: all ports lie on the same point.MODE_PORT_DISTRIBUTED_NORTH
: ports are distributed among the northern side of the node.MODE_PORT_DISTRIBUTED_SOUTH
: ports are distributed among the southern side of the node.MODE_PORT_DISTRIBUTED_EAST
: ports are distributed among the eastern side of the node.MODE_PORT_DISTRIBUTED_WEST
: ports are distributed among the western side of the node.MODE_PORT_CONSTRAINTS
: ports are distributed as specified.
public double getBorderGapToPortGapRatio()
0.5
, indicates that the border gap is as wide as half the gap between the ports.
public void setBorderGapToPortGapRatio(double borderGapToPortGapRatio)
0.5
sets the border gap as wide as half the gap between the ports. Thus,
the lower the value is, the wider "spread" the ports at the side of the node.
public boolean isReversedPortOrder()
public void setReversedPortOrder(boolean reversedPortOrder)
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |