|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.layout.PortConstraint
This class represents a constraint for either a source or target port
of an edge. Objects of type PortConstraint are expected to be returned by
data providers that are registered by the keys defined in the
interface PortConstraintKeys
.
A port constraint expresses at what position an edge is allowed to connect to either its source or target node. A weak port constraint limits the position of the port to a particular side of a node. Additionlly a strong port constraint fixes the position of port completely to the position of the original port coordinates
For example, PortConstraint p = new PortConstraint(PortConstraint.NORTH) expresses that an edge should connect at the north side of a node. It is a weak constraint. On the other hand p = new PortConstraint(PortConstraint.NORTH,true) expresses that an edge should not only connect at the north side of a node but also should use the current port coordinates. It is a strong constraint.
Field Summary | |
static byte |
ANY_SIDE
Weak constraint specifier. |
static byte |
EAST
Weak constraint specifier. |
static byte |
NORTH
Weak constraint specifier. |
static byte |
SOUTH
Weak constraint specifier. |
static byte |
WEST
Weak constraint specifier. |
Fields inherited from interface y.layout.PortConstraintKeys |
SOURCE_GROUPID_KEY, SOURCE_PORT_CONSTRAINT_KEY, TARGET_GROUPID_KEY, TARGET_PORT_CONSTRAINT_KEY |
Constructor Summary | |
PortConstraint()
Creates the empty constraint, that allows ports to connect at any side of a node. |
|
PortConstraint(byte side)
Creates the weak constraint, that allows ports to connect to a specific side of a node. |
|
PortConstraint(byte side,
boolean strong)
Creates a constraint, that allows ports to connect to a specific side of a node. |
Method Summary | |
static PortConstraint |
create(byte side)
Creates a weak port constraint. |
static PortConstraint |
create(byte side,
boolean strong)
Creates a weak port constraint. |
byte |
getSide()
Returns the side of a node at which a port should connect. |
static PortConstraint |
getSPC(LayoutGraph graph,
Edge e)
Returns the source port constaint associated with the given edge. |
static PortConstraint |
getTPC(LayoutGraph graph,
Edge e)
Returns the source port constaint associated with the given edge. |
static boolean |
hasPC(LayoutGraph graph,
Edge e)
Returns whether or not there are non-trivial source or target port constaints associated with the given edge. |
static boolean |
hasSPC(LayoutGraph graph,
Edge e)
Returns whether or not there is a non-trivial source port constaint associated with the given edge. |
static boolean |
hasTPC(LayoutGraph graph,
Edge e)
Returns whether or not there is a non-trivial target port constaint associated with the given edge. |
boolean |
isAtAnySide()
Returns whether or not this port constaint has has the weak constraint side PortConstraint.ANY_SIDE associated
with it. |
boolean |
isAtEast()
Returns whether or not this port constaint has has the weak constraint side PortConstraint.EAST associated
with it. |
boolean |
isAtNorth()
Returns whether or not this port constaint has has the weak constraint side PortConstraint.NORTH associated
with it. |
boolean |
isAtSouth()
Returns whether or not this port constaint has has the weak constraint side PortConstraint.SOUTH associated
with it. |
boolean |
isAtWest()
Returns whether or not this port constaint has has the weak constraint side PortConstraint.WEST associated
with it. |
boolean |
isStrong()
getter for strong property |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final byte ANY_SIDE
public static final byte NORTH
public static final byte SOUTH
public static final byte EAST
public static final byte WEST
Constructor Detail |
public PortConstraint()
public PortConstraint(byte side)
side
- weak constraint specifier. One of PortConstraint.ANY_SIDE
, PortConstraint.NORTH
,
PortConstraint.SOUTH
, PortConstraint.EAST
or PortConstraint.WEST
.public PortConstraint(byte side, boolean strong)
side
- weak constraint specifier. One of PortConstraint.ANY_SIDE
, PortConstraint.NORTH
,
PortConstraint.SOUTH
, PortConstraint.EAST
or PortConstraint.WEST
.strong
- whether the layouter should use the current port coordinates
(strong constraint)Method Detail |
public boolean isStrong()
public byte getSide()
PortConstraint.ANY_SIDE
, PortConstraint.NORTH
,
PortConstraint.SOUTH
, PortConstraint.EAST
or PortConstraint.WEST
.public boolean isAtNorth()
PortConstraint.NORTH
associated
with it.
public boolean isAtSouth()
PortConstraint.SOUTH
associated
with it.
public boolean isAtEast()
PortConstraint.EAST
associated
with it.
public boolean isAtWest()
PortConstraint.WEST
associated
with it.
public boolean isAtAnySide()
PortConstraint.ANY_SIDE
associated
with it.
public static boolean hasPC(LayoutGraph graph, Edge e)
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY
and PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY
are used to lookup the data providers in the given graph.
public static boolean hasSPC(LayoutGraph graph, Edge e)
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY
is used to lookup the source port constraint data
provider in the given graph.
public static boolean hasTPC(LayoutGraph graph, Edge e)
PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY
is used to lookup the source port constraint data
provider in the given graph.
public static PortConstraint getSPC(LayoutGraph graph, Edge e)
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY
is used to lookup the source port constraint data
provider in the given graph.
public static PortConstraint getTPC(LayoutGraph graph, Edge e)
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY
is used to lookup the source port constraint data
provider in the given graph.
public static PortConstraint create(byte side)
side
- One of PortConstraint.ANY_SIDE
, PortConstraint.NORTH
,
PortConstraint.SOUTH
, PortConstraint.EAST
or PortConstraint.WEST
.public static PortConstraint create(byte side, boolean strong)
side
- One of PortConstraint.ANY_SIDE
, PortConstraint.NORTH
,
PortConstraint.SOUTH
, PortConstraint.EAST
or PortConstraint.WEST
.public String toString()
toString
in class Object
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |