Packagecom.yworks.graph.model
Classpublic class DefaultPort
InheritanceDefaultPort Inheritance AbstractModelItem Inheritance Object
Implements IPort, ITagOwner, com.yworks.graph.model.IZOrderOwner

A simple mutable implementation of the IPort interface that can be used stand-alone.



Public Properties
 PropertyDefined By
  location : IPoint
[read-only] Returns a live view of the location of the port in world coordinates.
DefaultPort
  locationModelParameter : IPortLocationModelParameter
Gets the port model's parameter that determines the location of this port.
DefaultPort
  owner : IPortOwner
Returns the owner of this port.
DefaultPort
  style : IPortStyle
Returns the style that is responsible for the visual representation of this port in a CanvasComponent.
DefaultPort
  tag : Object
Gets or sets the tag associated with this instance.
DefaultPort
  zOrder : int
The z-order of a model item which determines its render order in comparison to other model items.
DefaultPort
Protected Properties
 PropertyDefined By
 Inherited_lookupMap : IMapper
The map which is used by registerLookup() to store instances in.
AbstractModelItem
Public Methods
 MethodDefined By
  
DefaultPort(locationModelParameter:IPortLocationModelParameter, owner:IPortOwner, lookup:ILookup = null)
Creates a port using the given location, owner and lookup delegate.
DefaultPort
  
createAt(location:IPoint, owner:IPortOwner, lookup:ILookup = null):DefaultPort
[static] Creates a new instance of DefaultPort which's given world coordinates are turned into a NodeScaledParameter using NodeScaledPortLocationModel.instance.createAbsoluteParameter.
DefaultPort
 Inherited
Returns the currently set ILookup delegate.
AbstractModelItem
  
lookup(type:Class):Object
[override] Returns an instance that implements the given type or null.
DefaultPort
 Inherited
registerLookup(type:Class, instance:Object):void
Register an implementation for the given type that should be returned when lookup is called with this given type.
AbstractModelItem
  
setLocation(x:Number, y:Number):void
Sets the location of this port.
DefaultPort
 Inherited
Sets the ILookup implementation used for lookup calls on this instance.
AbstractModelItem
  
toString():String
Returns a String representation of this instance.
DefaultPort
Property Detail
locationproperty
location:IPoint  [read-only]

Returns a live view of the location of the port in world coordinates.

The location is the anchor for the edges, that connect to this port, however it is up to the visualization logic where exactly the visual part of an edge will end. As this will yield a live view, it is up to the client to copy the values if a snapshot of the state is needed. In order to modify the location of a port, use the various methods in IGraph.


Implementation
    public function get location():IPoint
locationModelParameterproperty 
locationModelParameter:IPortLocationModelParameter

Gets the port model's parameter that determines the location of this port.

In order to set a different parameter for this port, use IGraph's setPortLocationModelParameter method.


Implementation
    public function get locationModelParameter():IPortLocationModelParameter
    public function set locationModelParameter(value:IPortLocationModelParameter):void
ownerproperty 
owner:IPortOwner

Returns the owner of this port.

In traditional IGraph implementations, this will be an INode and can safely be cast to one. To obtain the IEdge instances that are connected to this port instance, use the IGraph.edgesAtPort(IPort) method provided by IGraph.


Implementation
    public function get owner():IPortOwner
    public function set owner(value:IPortOwner):void
styleproperty 
style:IPortStyle

Returns the style that is responsible for the visual representation of this port in a CanvasComponent.

In order to set the style on an instance, use the IGraph.setStyle( IPort, IPortStyle ) method.

Note that the style instance associated with a port instance may be shared between multiple port instances and that the modification of this style will result in a change of the appearance of all ports that are associated with the same style instance.


Implementation
    public function get style():IPortStyle
    public function set style(value:IPortStyle):void
tagproperty 
tag:Object

Gets or sets the tag associated with this instance.

The implementation itself does not normally depend on the tag associated with it. It serves as storage for the object only.


Implementation
    public function get tag():Object
    public function set tag(value:Object):void
zOrderproperty 
zOrder:int

The z-order of a model item which determines its render order in comparison to other model items.


Implementation
    public function get zOrder():int
    public function set zOrder(value:int):void
Constructor Detail
DefaultPort()Constructor
public function DefaultPort(locationModelParameter:IPortLocationModelParameter, owner:IPortOwner, lookup:ILookup = null)

Creates a port using the given location, owner and lookup delegate.

If lookup is null, a DefaultPortLookup instance will be used as the lookup delegate.

Parameters
locationModelParameter:IPortLocationModelParameter — The location model parameter of the port which determines the port's location.
 
owner:IPortOwner — The node which owns the port.
 
lookup:ILookup (default = null) — A lookup for this port.
Method Detail
createAt()method
public static function createAt(location:IPoint, owner:IPortOwner, lookup:ILookup = null):DefaultPort

Creates a new instance of DefaultPort which's given world coordinates are turned into a NodeScaledParameter using NodeScaledPortLocationModel.instance.createAbsoluteParameter.

Parameters

location:IPoint — The location of the new port in world coordinates.
 
owner:IPortOwner — The owner of the new port.
 
lookup:ILookup (default = null) — The lookup that should be used for the new port.

Returns
DefaultPort — The newly created port.

See also

NodeScaledPortLocationModel
lookup()method 
override public function lookup(type:Class):Object

Returns an instance that implements the given type or null.

Typically, this method will be called in order to obtain a different view or aspect of the current instance. This is quite similar to casting or using a super type or interface of this instance, but is not limited to inheritance or compile time constraints. An instance implementing this method is not required to return non-null implementations for the types, nor does it have to return the same instance any time. Also it depends on the type and context whether the instance returned stays up to date or needs to be reobtained for subsequent use.

Parameters

type:Class — the type for which an instance shall be returned

Returns
Object — an instance that is assignable to type or null
setLocation()method 
public function setLocation(x:Number, y:Number):void

Sets the location of this port. If an IPointSetter can be found using the lookup, it is used to set the new coordinates.

Otherwise a new IPortLocationModelParameter is created using the old parameter's model's createParameter method with the new coordinates.

Parameters

x:Number — The x coordinate (absolute coordinates)
 
y:Number — The y coordinate (absolute coordinates)

toString()method 
public function toString():String

Returns a String representation of this instance.

Returns
String — A String representation of this instance.