Packagecom.yworks.graph.model.portLocation
Classpublic class NodeScaledPortLocationModel
InheritanceNodeScaledPortLocationModel Inheritance Object
Implements IPortLocationModel

A straightforward implementation of an IPortLocationModel for IPorts at INodes that determine the location dynamically using the INode's layout.

Internally the location is stored as the ratio by which the IRectangle.width and IRectangle.height of the INode.layout need to be scaled to obtain the offset to the center of the node layout.



Public Properties
 PropertyDefined By
  instance : NodeScaledPortLocationModel
[static] [read-only] A shared instance of the NodeScaledPortLocationModel.
NodeScaledPortLocationModel
Public Methods
 MethodDefined By
  
Creates a parameter for the given INode that will exactly match the given absolute world coordinates.
NodeScaledPortLocationModel
  
Creates the a parameter for the given INode that will exactly match the given relative location.
NodeScaledPortLocationModel
  
Factory method that creates a parameter for the given port that tries to match the provided location in absolute world coordinates.
NodeScaledPortLocationModel
  
Creates a parameter that uses the given relative offsets. The offsets will be scaled by the node layouts size and added to the node center to determine the port location.
NodeScaledPortLocationModel
  
Provides a lookup context for the given combination of port and parameter.
NodeScaledPortLocationModel
  
Calculates the location in form of an IPoint for a given port using the given model parameter.
NodeScaledPortLocationModel
  
lookup(type:Class):Object
Returns an instance that implements the given type or null.
NodeScaledPortLocationModel
Public Constants
 ConstantDefined By
  NODE_BOTTOM_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the center of the bottom border of the node layout. This is the same as creating a parameter using an IPoint with location (0, 0.5) as parameter.
NodeScaledPortLocationModel
  NODE_BOTTOM_LEFT_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the bottom left corner of the node layout. This is the same as creating a parameter using an IPoint with location (-0.5, 0.5) as parameter.
NodeScaledPortLocationModel
  NODE_BOTTOM_RIGHT_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the bottom right corner of the node layout. This is the same as creating a parameter using an IPoint with location (0.5, 0.5) as parameter.
NodeScaledPortLocationModel
  NODE_CENTER_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the center of the node layout. This is the same as creating a parameter using an IPoint with location (0, 0) as parameter.
NodeScaledPortLocationModel
  NODE_LEFT_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the center of the left border of the node layout. This is the same as creating a parameter using an IPoint with location (-0.5, 0) as parameter.
NodeScaledPortLocationModel
  NODE_RIGHT_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the center of the right border of the node layout. This is the same as creating a parameter using an IPoint with location (0.5, 0) as parameter.
NodeScaledPortLocationModel
  NODE_TOP_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the center of the top border of the node layout. This is the same as creating a parameter using an IPoint with location (0, -0.5) as parameter.
NodeScaledPortLocationModel
  NODE_TOP_LEFT_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the top left corner of the node layout. This is the same as creating a parameter using an IPoint with location (-0.5, -0.5) as parameter.
NodeScaledPortLocationModel
  NODE_TOP_RIGHT_ANCHORED : IPortLocationModelParameter
[static] A constant static instance of a scaled parameter that locates the port at the top right corner of the node layout. This is the same as creating a parameter using an IPoint with location (0.5, -0.5) as parameter.
NodeScaledPortLocationModel
Property Detail
instanceproperty
instance:NodeScaledPortLocationModel  [read-only]

A shared instance of the NodeScaledPortLocationModel.


Implementation
    public static function get instance():NodeScaledPortLocationModel
Method Detail
createAbsoluteParameter()method
public function createAbsoluteParameter(owner:INode, location:IPoint):IPortLocationModelParameter

Creates a parameter for the given INode that will exactly match the given absolute world coordinates.

Parameters

owner:INode — The owner to use for determining the offsets.
 
location:IPoint — The absolute world coordinates location of the port.

Returns
IPortLocationModelParameter — A parameter that exactly matches the given location unless the node's width and height is non-positive.
createOffsetParameter()method 
public function createOffsetParameter(owner:INode, relativeLocation:IPoint):IPortLocationModelParameter

Creates the a parameter for the given INode that will exactly match the given relative location.

Parameters

owner:INode — The owner to use for determining the offsets.
 
relativeLocation:IPoint — The location of the port relative to the center of the node.

Returns
IPortLocationModelParameter — A parameter that exactly matches the give relativeLocation unless the node's width and height is non-positive.
createParameter()method 
public function createParameter(portOwner:IPortOwner, location:IPoint = null):IPortLocationModelParameter

Factory method that creates a parameter for the given port that tries to match the provided location in absolute world coordinates.

Parameters

portOwner:IPortOwner — The port owner that will own the port for which the parameter shall be created.
 
location:IPoint (default = null) — The location in the world coordinate system that should be matched as best as possible.

Returns
IPortLocationModelParameter — A new instance that can be used to describe the location of an IPort at the given IPortOwner.
createScaledParameter()method 
public function createScaledParameter(relativeOffset:IPoint):IPortLocationModelParameter

Creates a parameter that uses the given relative offsets.

The offsets will be scaled by the node layouts size and added to the node center to determine the port location.

Parameters

relativeOffset:IPoint — The relative offsets.

Returns
IPortLocationModelParameter — A new parameter that matches the specification.
getContext()method 
public function getContext(port:IPort, parameter:IPortLocationModelParameter):ILookup

Provides a lookup context for the given combination of port and parameter.

Parameters

port:IPort — The port to use in the context.
 
parameter:IPortLocationModelParameter — The parameter to use for the port in the context.

Returns
ILookup — An implementation of the ILookup interface that can be used to query additional aspects of the port/parameter combination.
getLocation()method 
public function getLocation(port:IPort, modelParameter:IPortLocationModelParameter):IPoint

Calculates the location in form of an IPoint for a given port using the given model parameter.

Parameters

port:IPort — The port to calculate the location for
 
modelParameter:IPortLocationModelParameter — A parameter that has been created by this model. This is typically the parameter that yielded this instance through its IPortModelParameter.model property.

Returns
IPoint — An instance that describes the location. This is typically an instance designed as a flyweight, so clients should not cache the instance but store the values if they need a snapshot for later use
lookup()method 
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
Constant Detail
NODE_BOTTOM_ANCHOREDConstant
public static const NODE_BOTTOM_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the center of the bottom border of the node layout.

This is the same as creating a parameter using an IPoint with location (0, 0.5) as parameter.

NODE_BOTTOM_LEFT_ANCHOREDConstant 
public static const NODE_BOTTOM_LEFT_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the bottom left corner of the node layout.

This is the same as creating a parameter using an IPoint with location (-0.5, 0.5) as parameter.

NODE_BOTTOM_RIGHT_ANCHOREDConstant 
public static const NODE_BOTTOM_RIGHT_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the bottom right corner of the node layout.

This is the same as creating a parameter using an IPoint with location (0.5, 0.5) as parameter.

NODE_CENTER_ANCHOREDConstant 
public static const NODE_CENTER_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the center of the node layout.

This is the same as creating a parameter using an IPoint with location (0, 0) as parameter.

NODE_LEFT_ANCHOREDConstant 
public static const NODE_LEFT_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the center of the left border of the node layout.

This is the same as creating a parameter using an IPoint with location (-0.5, 0) as parameter.

NODE_RIGHT_ANCHOREDConstant 
public static const NODE_RIGHT_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the center of the right border of the node layout.

This is the same as creating a parameter using an IPoint with location (0.5, 0) as parameter.

NODE_TOP_ANCHOREDConstant 
public static const NODE_TOP_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the center of the top border of the node layout.

This is the same as creating a parameter using an IPoint with location (0, -0.5) as parameter.

NODE_TOP_LEFT_ANCHOREDConstant 
public static const NODE_TOP_LEFT_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the top left corner of the node layout.

This is the same as creating a parameter using an IPoint with location (-0.5, -0.5) as parameter.

NODE_TOP_RIGHT_ANCHOREDConstant 
public static const NODE_TOP_RIGHT_ANCHORED:IPortLocationModelParameter

A constant static instance of a scaled parameter that locates the port at the top right corner of the node layout.

This is the same as creating a parameter using an IPoint with location (0.5, -0.5) as parameter.