Packagecom.yworks.yfiles.layout
Classpublic class PortConstraint
InheritancePortConstraint Inheritance YObject Inheritance Object

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 com.yworks.yfiles.layout.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. Additionally, a strong port constraint fixes the position of the port completely to the position of the current port coordinates.

For example, PortConstraint p = PortConstraint.create(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 = PortConstraint.create(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. This is a strong constraint.

See also

com.yworks.yfiles.layout.PortConstraintKeys


Public Properties
 PropertyDefined By
  atAnySide : Boolean
[read-only] Returns whether or not this port constraint has the weak constraint side ANY_SIDE associated with it.
PortConstraint
  atEast : Boolean
[read-only] Returns whether or not this port constraint has the weak constraint side EAST associated with it.
PortConstraint
  atNorth : Boolean
[read-only] Returns whether or not this port constraint has the weak constraint side NORTH associated with it.
PortConstraint
  atSouth : Boolean
[read-only] Returns whether or not this port constraint has the weak constraint side SOUTH associated with it.
PortConstraint
  atWest : Boolean
[read-only] Returns whether or not this port constraint has the weak constraint side WEST associated with it.
PortConstraint
  side : int
[read-only] Returns the side of a node at which a port should connect.
PortConstraint
  strong : Boolean
[read-only] Returns true if this PortConstraint represents a strong constraint and false otherwise.
PortConstraint
Public Methods
 MethodDefined By
  
PortConstraint(init:Boolean = true)
Creates the empty constraint, that allows ports to connect at any side of a node.
PortConstraint
  
create(side:int, strong:Boolean):PortConstraint
[static] Creates a port constraint.
PortConstraint
  
[static] Creates a weak port constraint.
PortConstraint
  
equals(other:Object):Boolean
[override] Tests for equality based on the strong attribute and the side attribute.
PortConstraint
  
getClass():Class
[override]
PortConstraint
  
[static] Returns the source port constraint associated with the given edge.
PortConstraint
  
[static] Returns the target port constraint associated with the given edge.
PortConstraint
  
hashCode():int
[override]
PortConstraint
  
hasPC(graph:LayoutGraph, e:Edge):Boolean
[static] Returns whether or not there are non-trivial source or target port constraints associated with the given edge.
PortConstraint
  
hasSPC(graph:LayoutGraph, e:Edge):Boolean
[static] Returns whether or not there is a non-trivial source port constraint associated with the given edge.
PortConstraint
  
hasTPC(graph:LayoutGraph, e:Edge):Boolean
[static] Returns whether or not there is a non-trivial target port constraint associated with the given edge.
PortConstraint
  
[static] Creates the empty constraint, that allows ports to connect at any side of a node.
PortConstraint
  
[static] Creates the weak constraint, that allows ports to connect to a specific side of a node.
PortConstraint
  
newPortConstraint3(side:int, strong:Boolean):PortConstraint
[static] Creates a constraint, that allows ports to connect to a specific side of a node.
PortConstraint
  
toString():String
Returns a string representation of this object.
PortConstraint
Protected Methods
 MethodDefined By
  
Initializes this object.
PortConstraint
  
initPortConstraint2(side:int):void
Initializes this object.
PortConstraint
  
initPortConstraint3(side:int, strong:Boolean):void
Initializes this object.
PortConstraint
Public Constants
 ConstantDefined By
  ANY_SIDE : int = 0x0
[static] Weak constraint specifier.
PortConstraint
  EAST : int = 0x4
[static] Weak constraint specifier.
PortConstraint
  NORTH : int = 0x1
[static] Weak constraint specifier.
PortConstraint
  SOUTH : int = 0x2
[static] Weak constraint specifier.
PortConstraint
  WEST : int = 0x8
[static] Weak constraint specifier.
PortConstraint
Property Detail
atAnySideproperty
atAnySide:Boolean  [read-only]

Returns whether or not this port constraint has the weak constraint side ANY_SIDE associated with it.


Implementation
    public function get atAnySide():Boolean

See also

atEastproperty 
atEast:Boolean  [read-only]

Returns whether or not this port constraint has the weak constraint side EAST associated with it.


Implementation
    public function get atEast():Boolean

See also

atNorthproperty 
atNorth:Boolean  [read-only]

Returns whether or not this port constraint has the weak constraint side NORTH associated with it.


Implementation
    public function get atNorth():Boolean

See also

atSouthproperty 
atSouth:Boolean  [read-only]

Returns whether or not this port constraint has the weak constraint side SOUTH associated with it.


Implementation
    public function get atSouth():Boolean

See also

atWestproperty 
atWest:Boolean  [read-only]

Returns whether or not this port constraint has the weak constraint side WEST associated with it.


Implementation
    public function get atWest():Boolean

See also

sideproperty 
side:int  [read-only]

Returns the side of a node at which a port should connect.


Implementation
    public function get side():int

See also

strongproperty 
strong:Boolean  [read-only]

Returns true if this PortConstraint represents a strong constraint and false otherwise.


Implementation
    public function get strong():Boolean
Constructor Detail
PortConstraint()Constructor
public function PortConstraint(init:Boolean = true)

Creates the empty constraint, that allows ports to connect at any side of a node.

Parameters
init:Boolean (default = true) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods. This parameter can safely be ignored/omitted when calling the constructor.
Method Detail
create()method
public static function create(side:int, strong:Boolean):PortConstraint

Creates a port constraint. The boolean value defines whether it is a strong or weak one.

Parameters

side:int — One of ANY_SIDE, NORTH, SOUTH, EAST or WEST .
 
strong:Boolean — defines whether it is a strong or weak PortConstraint.

Returns
PortConstraint

See also

createWeak()method 
public static function createWeak(side:int):PortConstraint

Creates a weak port constraint.

Parameters

side:int — One of ANY_SIDE, NORTH, SOUTH, EAST or WEST .

Returns
PortConstraint

See also

equals()method 
override public function equals(other:Object):Boolean

Tests for equality based on the strong attribute and the side attribute.

Parameters

other:Object

Returns
Boolean
getClass()method 
override public function getClass():Class

Returns
Class
getSPC()method 
public static function getSPC(graph:LayoutGraph, e:Edge):PortConstraint

Returns the source port constraint associated with the given edge. The data provider key com.yworks.yfiles.layout.PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY is used to lookup the source port constraint data provider in the given graph.

Parameters

graph:LayoutGraph
 
e:Edge

Returns
PortConstraint

See also

getTPC()method 
public static function getTPC(graph:LayoutGraph, e:Edge):PortConstraint

Returns the target port constraint associated with the given edge. The data provider key com.yworks.yfiles.layout.PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY is used to lookup the source port constraint data provider in the given graph.

Parameters

graph:LayoutGraph
 
e:Edge

Returns
PortConstraint

See also

hashCode()method 
override public function hashCode():int

Returns
int
hasPC()method 
public static function hasPC(graph:LayoutGraph, e:Edge):Boolean

Returns whether or not there are non-trivial source or target port constraints associated with the given edge. The data provider keys com.yworks.yfiles.layout.PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY and com.yworks.yfiles.layout.PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY are used to lookup the data providers in the given graph.

Parameters

graph:LayoutGraph
 
e:Edge

Returns
Boolean

See also

hasSPC()method 
public static function hasSPC(graph:LayoutGraph, e:Edge):Boolean

Returns whether or not there is a non-trivial source port constraint associated with the given edge. The data provider key com.yworks.yfiles.layout.PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY is used to lookup the source port constraint data provider in the given graph.

Parameters

graph:LayoutGraph
 
e:Edge

Returns
Boolean

See also

hasTPC()method 
public static function hasTPC(graph:LayoutGraph, e:Edge):Boolean

Returns whether or not there is a non-trivial target port constraint associated with the given edge. The data provider key com.yworks.yfiles.layout.PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY is used to lookup the source port constraint data provider in the given graph.

Parameters

graph:LayoutGraph
 
e:Edge

Returns
Boolean

See also

initPortConstraint1()method 
protected final function initPortConstraint1():void

Initializes this object. See the documentation of the corresponding factory method newPortConstraint1() for details.

See also

initPortConstraint2()method 
protected final function initPortConstraint2(side:int):void

Initializes this object. See the documentation of the corresponding factory method newPortConstraint2() for details.

Parameters

side:int

See also

initPortConstraint3()method 
protected final function initPortConstraint3(side:int, strong:Boolean):void

Initializes this object. See the documentation of the corresponding factory method newPortConstraint3() for details.

Parameters

side:int
 
strong:Boolean

See also

newPortConstraint1()method 
public static function newPortConstraint1():PortConstraint

Creates the empty constraint, that allows ports to connect at any side of a node.

Returns
PortConstraint
newPortConstraint2()method 
public static function newPortConstraint2(side:int):PortConstraint

Creates the weak constraint, that allows ports to connect to a specific side of a node.

Parameters

side:int — weak constraint specifier. One of ANY_SIDE, NORTH, SOUTH, EAST or WEST.

Returns
PortConstraint

See also

newPortConstraint3()method 
public static function newPortConstraint3(side:int, strong:Boolean):PortConstraint

Creates a constraint, that allows ports to connect to a specific side of a node.

Parameters

side:int — weak constraint specifier. One of ANY_SIDE, NORTH, SOUTH, EAST or WEST.
 
strong:Boolean — whether the layouter should use the current port coordinates (strong constraint)

Returns
PortConstraint

See also

toString()method 
public function toString():String

Returns a string representation of this object.

Returns
String
Constant Detail
ANY_SIDEConstant
public static const ANY_SIDE:int = 0x0

Weak constraint specifier. Indicates that any side of the node will do for the port direction.

EASTConstant 
public static const EAST:int = 0x4

Weak constraint specifier. Indicates that a port has to connect at the east side (i.e. right side) of a node.

NORTHConstant 
public static const NORTH:int = 0x1

Weak constraint specifier. Indicates that a port has to connect at the north side (i.e. top side) of a node.

SOUTHConstant 
public static const SOUTH:int = 0x2

Weak constraint specifier. Indicates that a port has to connect at the south side (i.e. bottom side) of a node.

WESTConstant 
public static const WEST:int = 0x8

Weak constraint specifier. Indicates that a port has to connect at the west side (i.e. left side) of a node.