|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.PortConstraint
public class PortConstraint
A PortConstraint represents a constraint for the source or target port of an edge path.
It determines the location at which an edge path can be connected to its source and/or target node.
There exist two different types of PortConstraints:
PortConstraints specify the side where an edge should enter/leave a node.
PortConstraints specify the exact coordinates of the point where an edge
should enter/leave a node. Therefore, for edges with strong port constraints,
layout algorithms supporting such constraints use the current source/target point coordinates as returned by
method LayoutGraph.getSourcePointRel(Edge) and LayoutGraph.getTargetPointRel(Edge)
respectively.

EAST
while target port constraints are associated with side WEST. Red rectangles indicate that edges can be
connected to any point of these sides. Black rectangles represent the selected ports.

EAST
while target port constraints are associated with side WEST. Black rectangles indicate the exact points on the
corresponding sides of the nodes to which edges can be connected.
Information about PortConstraints is held by DataProviders that are registered with the graph using keys
PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY (to specify PortConstraints for an edge on its source
node) and PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY (to specify PortConstraints for an edge on
its target node).
Not all layout and routing algorithms are able to handle PortConstraints. Major layout algorithms
that obey them are IncrementalHierarchicLayouter,
GenericTreeLayouter, EdgeRouter,
OrthogonalEdgeRouter, ChannelEdgeRouter and
BusRouter.
PortCandidateAssignmentStage can be appended to any layout algorithm that cannot handle port
constraints in order to assign edges to the ports specified by PortConstraints or
PortCandidates after calling the core layout algorithm.PortConstraints and PortCandidates (on edges and/or nodes) are defined
for a graph, the layout or the routing algorithm will try to match both of them in order to find an appropriate port.
The matching process depends on the actual algorithm.PortConstraintKeys
| Field Summary | |
|---|---|
static byte |
ANY_SIDE
A weak constraint indicating that edges can connect to any side of a node. |
static byte |
EAST
A weak constraint indicating that edges can connect to the east side (right side) of a node. |
static byte |
NORTH
A weak constraint indicating that edges can connect to the north side (top side) of a node. |
static byte |
SOUTH
A weak constraint indicating that edges can connect to the south side (bottom side) of a node. |
static byte |
WEST
A weak constraint indicating that edges can connect to the west side (left side) of a node. |
| Fields inherited from interface y.layout.PortConstraintKeys |
|---|
SOURCE_GROUPID_KEY, SOURCE_PORT_CONSTRAINT_KEY, SOURCE_PORT_GROUP_ID_DPKEY, TARGET_GROUPID_KEY, TARGET_PORT_CONSTRAINT_KEY, TARGET_PORT_GROUP_ID_DPKEY |
| Constructor Summary | |
|---|---|
PortConstraint()
Deprecated. Use the factory method create(byte) instead. |
|
PortConstraint(byte side)
Deprecated. Use the factory method create(byte) instead. |
|
PortConstraint(byte side,
boolean strong)
Deprecated. Use the factory method create(byte, boolean) instead. |
|
| Method Summary | |
|---|---|
static PortConstraint |
create(byte side)
Creates a weak PortConstraint that constrains the edge to connect to the given side of a node. |
static PortConstraint |
create(byte side,
boolean strong)
Creates a new PortConstraint that constrains the edge to connect to the given side of a node and
that can be either strong or weak. |
boolean |
equals(java.lang.Object other)
Returns whether or not this PortConstraint is equal to another PortConstraint based on whether
they are both strong constraints or not and the side attribute. |
byte |
getSide()
Returns the side of the node to which an edge should connect. |
static PortConstraint |
getSPC(LayoutGraph graph,
Edge e)
Returns the source PortConstraint associated with the given edge. |
static PortConstraint |
getTPC(LayoutGraph graph,
Edge e)
Returns the target PortConstraint associated with the given edge. |
int |
hashCode()
Returns a hash code value for this PortConstraint instance based on whether it is a strong constraint or
not and the side attribute. |
static boolean |
hasPC(LayoutGraph graph,
Edge e)
Checks whether or not there exist source or target PortConstraints associated with the given edge. |
static boolean |
hasSPC(LayoutGraph graph,
Edge e)
Checks whether or not there exist source PortConstraints associated with the given edge. |
static boolean |
hasTPC(LayoutGraph graph,
Edge e)
Checks whether or not there exist target PortConstraints associated with the given edge. |
boolean |
isAtAnySide()
Returns whether or not this PortConstraint instance is associated with side ANY_SIDE. |
boolean |
isAtEast()
Returns whether or not this PortConstraint instance is associated with side EAST. |
boolean |
isAtNorth()
Returns whether or not this PortConstraint instance is associated with side NORTH. |
boolean |
isAtSouth()
Returns whether or not this PortConstraint instance is associated with side SOUTH. |
boolean |
isAtWest()
Returns whether or not this PortConstraint instance is associated with side WEST. |
boolean |
isStrong()
Returns whether or not this PortConstraint instance represents a strong constraint. |
java.lang.String |
toString()
Returns a String representation of this PortConstraint instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte ANY_SIDE
create(byte),
create(byte, boolean),
Constant Field Valuespublic static final byte NORTH
create(byte),
create(byte, boolean),
Constant Field Valuespublic static final byte SOUTH
create(byte),
create(byte, boolean),
Constant Field Valuespublic static final byte EAST
create(byte),
create(byte, boolean),
Constant Field Valuespublic static final byte WEST
create(byte),
create(byte, boolean),
Constant Field Values| Constructor Detail |
|---|
public PortConstraint()
create(byte) instead.
PortConstraint instance that allows ports to connect to any side of a node.
A weak PortConstraint determines the side of the node to which an edge should be connected.
public PortConstraint(byte side)
create(byte) instead.
PortConstraint instance that allows ports to connect to a specific side of a node.
A weak PortConstraint determines the side of the node to which an edge should be connected.
side - one of the default side specifiers
public PortConstraint(byte side,
boolean strong)
create(byte, boolean) instead.
PortConstraint instance that allows ports to connect to a specific side of
a node.
If the PortConstraint is strong, the layout or routing algorithm should use the port coordinates of this
constraint.
side - one of the default side specifiersstrong - true if the PortConstraint represents a strong constraint, false
otherwise| Method Detail |
|---|
public boolean isStrong()
PortConstraint instance represents a strong constraint.
A strong PortConstraint determines the exact coordinates where the edge path's end should be located.
true if this PortConstraint is strong, false if it is a weak onepublic byte getSide()
public boolean isAtNorth()
PortConstraint instance is associated with side NORTH.
true if the associated side is NORTH, false otherwisepublic boolean isAtSouth()
PortConstraint instance is associated with side SOUTH.
true if the associated side is SOUTH, false otherwisepublic boolean isAtEast()
PortConstraint instance is associated with side EAST.
true if the associated side is EAST, false otherwisepublic boolean isAtWest()
PortConstraint instance is associated with side WEST.
true if the associated side is WEST, false otherwisepublic boolean isAtAnySide()
PortConstraint instance is associated with side ANY_SIDE.
true if the associated side is ANY_SIDE, false otherwise
public static boolean hasPC(LayoutGraph graph,
Edge e)
PortConstraints associated with the given edge.
To retrieve the DataProviders that hold information about source or target PortConstraints,
keys PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY and
PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY are used.
PortConstraint that allows any side is not considered
to be a real constraint and ignored during this check.graph - the input graphe - the edge
true if the edge has source or target PortConstraints, false otherwise
public static boolean hasSPC(LayoutGraph graph,
Edge e)
PortConstraints associated with the given edge.
To retrieve the DataProvider that holds information about source PortConstraints,
key PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY is used.
PortConstraint that allows any side is not considered
to be a real constraint and ignored during this check.graph - the input graphe - the edge
true if the edge has source PortConstraints, false otherwise
public static boolean hasTPC(LayoutGraph graph,
Edge e)
PortConstraints associated with the given edge.
To retrieve the DataProvider that holds information about target PortConstraints,
key PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY is used.
PortConstraint that allows any side is not considered
to be a real constraint and ignored during this check.graph - the input graphe - the edge
true if the edge has target PortConstraints, false otherwise
public static PortConstraint getSPC(LayoutGraph graph,
Edge e)
PortConstraint associated with the given edge.
To retrieve the DataProvider that holds information about source PortConstraints,
key PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY is used.
graph - the input graphe - the edge
PortConstraint of the given edge or null if there is none
public static PortConstraint getTPC(LayoutGraph graph,
Edge e)
PortConstraint associated with the given edge.
To retrieve the DataProvider that holds information about target PortConstraints,
key PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY is used.
graph - the input graphe - the edge
PortConstraint of the given edge or null if there is nonepublic static PortConstraint create(byte side)
PortConstraint that constrains the edge to connect to the given side of a node.
side - one of the default side specifiers
PortConstraintpublic int hashCode()
PortConstraint instance based on whether it is a strong constraint or
not and the side attribute.
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
PortConstraint is equal to another PortConstraint based on whether
they are both strong constraints or not and the side attribute.
equals in class java.lang.Objectother - the reference PortConstraint object with which to compare
true if this PortConstraint is equal to the given PortConstraint argument, false
otherwise
public static PortConstraint create(byte side,
boolean strong)
PortConstraint that constrains the edge to connect to the given side of a node and
that can be either strong or weak.
If the PortConstraint is strong, port constraint aware layout algorithms keep the current
source/target point location as returned by method LayoutGraph.getSourcePointRel(Edge) and
LayoutGraph.getTargetPointRel(Edge) respectively.
side - one of the default side specifiersstrong - true if this PortConstraint is strong,
false otherwise
PortConstraint instance
java.lang.IllegalArgumentException - if an unknown side is givenpublic java.lang.String toString()
String representation of this PortConstraint instance.
toString in class java.lang.ObjectString representation of the PortConstraint
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||