public final class FreeNodePortLocationModel extends Object implements IPortLocationModel
IPortLocationModel for IPorts at INodes that determine
the location dynamically using the Layout.
Internally the location is stored as the ratios by which the Width
and Height of the Layout need to be
scaled and additional offsets to obtain the offset to the top-left corner of the node layout.
| Modifier and Type | Field and Description |
|---|---|
static FreeNodePortLocationModel |
INSTANCE
A read only immutable instance of the
FreeNodePortLocationModel. |
static IPortLocationModelParameter |
NODE_BOTTOM_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the center of the bottom border of the
node layout.
|
static IPortLocationModelParameter |
NODE_BOTTOM_LEFT_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the bottom left corner of the node
layout.
|
static IPortLocationModelParameter |
NODE_BOTTOM_RIGHT_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the bottom right corner of the node
layout.
|
static IPortLocationModelParameter |
NODE_CENTER_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the center of the node layout.
|
static IPortLocationModelParameter |
NODE_LEFT_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the center of the left border of the
node layout.
|
static IPortLocationModelParameter |
NODE_RIGHT_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the center of the right border of the
node layout.
|
static IPortLocationModelParameter |
NODE_TOP_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the center of the top border of the
node layout.
|
static IPortLocationModelParameter |
NODE_TOP_LEFT_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the top left corner of the node
layout.
|
static IPortLocationModelParameter |
NODE_TOP_RIGHT_ANCHORED
A read only immutable singleton instance of a parameter that locates the port at the top right corner of the node
layout.
|
| Constructor and Description |
|---|
FreeNodePortLocationModel() |
| Modifier and Type | Method and Description |
|---|---|
IPortLocationModelParameter |
createParameter(IPortOwner owner,
PointD location)
Factory method that creates a parameter for the given port that tries to match the provided location in absolute world
coordinates.
|
IPortLocationModelParameter |
createParameter(PointD ratios)
Creates a parameter that uses the given ratios and offsets.
|
IPortLocationModelParameter |
createParameter(PointD ratios,
PointD offset)
Creates a parameter that uses the given ratios and offsets.
|
ILookup |
getContext(IPort port,
IPortLocationModelParameter locationParameter)
Provides a
lookup context for the given combination of port and parameter. |
PointD |
getLocation(IPort port,
IPortLocationModelParameter locationParameter)
Determines the location of the port for the given parameter.
|
<TLookup> TLookup |
lookup(Class<TLookup> type)
Returns an instance that implements the given type or
null. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDictionaryLookup, createDynamic, createSingle, createSingle, createWrapped, lookup, lookup, safeLookuppublic static final FreeNodePortLocationModel INSTANCE
FreeNodePortLocationModel.public static final IPortLocationModelParameter NODE_BOTTOM_ANCHORED
This is the same as creating a parameter using (0.5,1) as ratios and (0,0)
as offsets.
public static final IPortLocationModelParameter NODE_BOTTOM_LEFT_ANCHORED
This is the same as creating a parameter using (0,1) as ratios and (0,0)
as offsets.
public static final IPortLocationModelParameter NODE_BOTTOM_RIGHT_ANCHORED
This is the same as creating a parameter using (1,1) as ratios and (0,0)
as offsets.
public static final IPortLocationModelParameter NODE_CENTER_ANCHORED
This is the same as creating a parameter using (0.5,0.5) as ratios and
(0,0) as offsets.
public static final IPortLocationModelParameter NODE_LEFT_ANCHORED
This is the same as creating a parameter using (0,0.5) as ratios and (0,0)
as offsets.
public static final IPortLocationModelParameter NODE_RIGHT_ANCHORED
This is the same as creating a parameter using (1,0.5) as ratios and (0,0)
as offsets.
public static final IPortLocationModelParameter NODE_TOP_ANCHORED
This is the same as creating a parameter using (0.5,0) as ratios and (0,0)
as offsets.
public static final IPortLocationModelParameter NODE_TOP_LEFT_ANCHORED
This is the same as creating a parameter using (0,0) as ratios and (0,0)
as offsets.
public static final IPortLocationModelParameter NODE_TOP_RIGHT_ANCHORED
This is the same as creating a parameter using (1,0) as ratios and (0,0)
as offsets.
public final IPortLocationModelParameter createParameter(IPortOwner owner, PointD location)
IPortLocationModelcreateParameter in interface IPortLocationModelowner - 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.IPort at the given owner.public final IPortLocationModelParameter createParameter(PointD ratios)
The ratios will be scaled by the node layout's size and added to the node's top left corner and the offset
to determine the port location.
ratios - The ratios of the node layout's size.public final IPortLocationModelParameter createParameter(PointD ratios, PointD offset)
The ratios will be scaled by the node layout's size and added to the node's top left corner and the offset
to determine the port location.
ratios - The ratios of the node layout's size.offset - The offset that is added after the ratios are applied.public final ILookup getContext(IPort port, IPortLocationModelParameter locationParameter)
IPortLocationModellookup context for the given combination of port and parameter.getContext in interface IPortLocationModelport - The port to use in the context.locationParameter - The parameter to use for the port in the context.ILookup interface that can be used to query additional aspects of the port/parameter
combination.public final PointD getLocation(IPort port, IPortLocationModelParameter locationParameter)
IPortLocationModelgetLocation in interface IPortLocationModelport - The port to determine the location for.locationParameter - The parameter to use. The parameter can be expected to be created by this instance having the Model
property set to this instance..public final <TLookup> TLookup lookup(Class<TLookup> type)
ILookupnull.
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.