Packagecom.yworks.graph.model
Classpublic class ListPortModel
InheritanceListPortModel Inheritance Object
Implements IMutablePortCollection

A simple implemenation of an IMutablePortCollection that is backed by a list.



Public Properties
 PropertyDefined By
  count : uint
[read-only]
ListPortModel
Protected Properties
 PropertyDefined By
  _nodeModel : INode
ListPortModel
Public Methods
 MethodDefined By
  
ListPortModel(nodeModel:INode, ports:List = null)
Constructor.
ListPortModel
  
add(port:IPort, pos:int = -1):void
Adds a port to the list at the given index.
ListPortModel
  
addRelative(x:Number, y:Number, pos:int = -1):IPort
Create and add a new port with relative location x and y at the specific list index pos
ListPortModel
  
getPort(index:uint):IPort
Gets the port at the given index.
ListPortModel
  
Returns an Iterator over the ports in the list.
ListPortModel
  
removePort(port:IPort):void
Remove the specified port from the collection.
ListPortModel
  
removePortAt(index:uint):void
Remove the port with the specified list index from the collection.
ListPortModel
Protected Methods
 MethodDefined By
  
Creates a new port which will be at the given offset relative to the node's center.
ListPortModel
Property Detail
_nodeModelproperty
protected var _nodeModel:INode

countproperty 
count:uint  [read-only]


Implementation
    public function get count():uint
Constructor Detail
ListPortModel()Constructor
public function ListPortModel(nodeModel:INode, ports:List = null)

Constructor.

Parameters
nodeModel:INode — A node as model (used for port creation).
 
ports:List (default = null) — The List implementation to use. If none is provided, a new ArrayList will be used.
Method Detail
add()method
public function add(port:IPort, pos:int = -1):void

Adds a port to the list at the given index.

Parameters

port:IPort — The port to add.
 
pos:int (default = -1) — The index to add the port at. If -1, the port will be appended to the list.

addRelative()method 
public function addRelative(x:Number, y:Number, pos:int = -1):IPort

Create and add a new port with relative location x and y at the specific list index pos

Parameters

x:Number — The relative x coordinate of the new port
 
y:Number — The relative y coordinate of the new port
 
pos:int (default = -1) — The list index for the new port. If -1, the new port will be appended.

Returns
IPort — A newly created port at the given relative location
createCenterAnchoredPort()method 
protected function createCenterAnchoredPort(x:Number, y:Number):DefaultPort

Creates a new port which will be at the given offset relative to the node's center.

Parameters

x:Number — The x offset.
 
y:Number — The y offset.

Returns
DefaultPort — The newly created port.
getPort()method 
public function getPort(index:uint):IPort

Gets the port at the given index.

Parameters

index:uint — The index

Returns
IPort — The port at the given index.
iterator()method 
public function iterator():Iterator

Returns an Iterator over the ports in the list.

Returns
Iterator — An Iterator over the ports in the list.
removePort()method 
public function removePort(port:IPort):void

Remove the specified port from the collection.

Parameters

port:IPort — The port to be removed.

removePortAt()method 
public function removePortAt(index:uint):void

Remove the port with the specified list index from the collection.

Parameters

index:uint — The list index to be cleared.