com.yworks.yfiles.server.graphml.flexio.data
Class NodeScaledPortLocationModel

java.lang.Object
  extended bycom.yworks.yfiles.server.graphml.flexio.data.NodeScaledPortLocationModel
All Implemented Interfaces:
IPortLocationModel

public class NodeScaledPortLocationModel
extends java.lang.Object
implements IPortLocationModel

Data object that models a yFiles FLEX IPortLocationModel that dynamically determines the port location based on the node's layout.


Field Summary
static IPortLocationModelParameter NODE_BOTTOM_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the center of the bottom border of the node layout.
static IPortLocationModelParameter NODE_BOTTOM_LEFT_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the bottom left corner of the node layout.
static IPortLocationModelParameter NODE_BOTTOM_RIGHT_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the bottom right corner of the node layout.
static IPortLocationModelParameter NODE_CENTER_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the center of the node layout.
static IPortLocationModelParameter NODE_LEFT_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the center of the left border of the node layout.
static IPortLocationModelParameter NODE_RIGHT_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the center of the right border of the node layout.
static IPortLocationModelParameter NODE_TOP_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the center of the top border of the node layout.
static IPortLocationModelParameter NODE_TOP_LEFT_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the top left corner of the node layout.
static IPortLocationModelParameter NODE_TOP_RIGHT_ANCHORED
          A constant static instance of a scaled parameter that locates the port at the top right corner of the node layout.
 
Constructor Summary
NodeScaledPortLocationModel()
           
 
Method Summary
 IPortLocationModelParameter createAbsoluteParameter(java.lang.Object owner, YPoint location)
          Creates a parameter for the given port owner that will exactly match the given absolute world coordinates.
 IPortLocationModelParameter createOffsetParameter(java.lang.Object owner, YPoint relativeLocation)
          Creates the a parameter for the given port owner that will exactly match the given relative location.
 IPortLocationModelParameter createParameter(java.lang.Object portOwner, YPoint location)
          Factory method that creates a parameter for the given port that tries to match the provided location in absolute world coordinates.
 IPortLocationModelParameter createScaledParameter(YPoint relativeOffsets)
          Creates a parameter that uses the given relative offsets.
 Lookup getContext(Port port, IPortLocationModelParameter parameter)
          Provides a lookup context for the given combination of port and parameter.
static NodeScaledPortLocationModel getInstance()
          A shared instance of the NodeScaledPortLocationModel.
 YPoint getLocation(Port port, IPortLocationModelParameter modelParameter)
          Calculates the location in world coordinates for a given port using the given model parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODE_CENTER_ANCHORED

public static final IPortLocationModelParameter NODE_CENTER_ANCHORED

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_ANCHORED

public static final IPortLocationModelParameter NODE_LEFT_ANCHORED

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_ANCHORED

public static final IPortLocationModelParameter NODE_RIGHT_ANCHORED

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_ANCHORED

public static final IPortLocationModelParameter NODE_TOP_ANCHORED

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_BOTTOM_ANCHORED

public static final IPortLocationModelParameter NODE_BOTTOM_ANCHORED

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_TOP_LEFT_ANCHORED

public static final IPortLocationModelParameter NODE_TOP_LEFT_ANCHORED

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_ANCHORED

public static final IPortLocationModelParameter NODE_TOP_RIGHT_ANCHORED

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.


NODE_BOTTOM_LEFT_ANCHORED

public static final IPortLocationModelParameter NODE_BOTTOM_LEFT_ANCHORED

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_ANCHORED

public static final IPortLocationModelParameter NODE_BOTTOM_RIGHT_ANCHORED

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.

Constructor Detail

NodeScaledPortLocationModel

public NodeScaledPortLocationModel()
Method Detail

getInstance

public static NodeScaledPortLocationModel getInstance()
A shared instance of the NodeScaledPortLocationModel.

Returns:

getLocation

public YPoint getLocation(Port port,
                          IPortLocationModelParameter modelParameter)
Description copied from interface: IPortLocationModel
Calculates the location in world coordinates for a given port using the given model parameter.

Specified by:
getLocation in interface IPortLocationModel
Parameters:
port - The port to calculate the location for
modelParameter - A parameter that has been created by this model. This is typically the parameter that yielded this instance through its IPortModelParameter.getModel() property.
Returns:
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

createParameter

public IPortLocationModelParameter createParameter(java.lang.Object portOwner,
                                                   YPoint location)
Description copied from interface: IPortLocationModel

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

Specified by:
createParameter in interface IPortLocationModel
Parameters:
portOwner - The port owner that will own the port for which the parameter shall be created.
location - The location in the world coordinate system that should be matched as best as possible.
Returns:
A new instance that can be used to describe the location of an IPort at the given IPortOwner.

createScaledParameter

public IPortLocationModelParameter createScaledParameter(YPoint relativeOffsets)
Creates a parameter that uses the given relative offsets. The offsets will be scaled by the node layout's size and added to the node center to determine the port location.

Parameters:
relativeOffsets - The relative offsets.
Returns:
A new parameter that matches the specification.

createAbsoluteParameter

public IPortLocationModelParameter createAbsoluteParameter(java.lang.Object owner,
                                                           YPoint location)

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

Parameters:
owner - The owner to use for determining the offsets.
location - The absolute world coordinates location of the port.
Returns:
A parameter that exactly matches the given location unless the node's width and height is non-positive.

createOffsetParameter

public IPortLocationModelParameter createOffsetParameter(java.lang.Object owner,
                                                         YPoint relativeLocation)
Creates the a parameter for the given port owner that will exactly match the given relative location.

Parameters:
owner - The owner to use for determining the offsets.
relativeLocation - The location of the port relative to the center of the node.
Returns:
A parameter that exactly matches the give relativeLocation unless the node's width and height is non-positive.

getContext

public Lookup getContext(Port port,
                         IPortLocationModelParameter parameter)
Description copied from interface: IPortLocationModel

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

Specified by:
getContext in interface IPortLocationModel
Parameters:
port - The port to use in the context.
parameter - The parameter to use for the port in the context.
Returns:
An implementation of the Lookup interface that can be used to query additional aspects of the port/parameter combination.


Copyright © 2000-2013 yWorks GmbH. All rights reserved