|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.NodeScaledPortLocationModel
public class NodeScaledPortLocationModel
A PortLocationModel
for node ports that determine their
location dynamically using the node's visual bounds (as represented by the
associated NodeRealizer
).
Internally, the location is stored as the ratio by which the width and height
of the realizer need to be scaled to obtain the offset to the center of the
node layout.
Nested Class Summary | |
---|---|
static class |
NodeScaledPortLocationModel.Handler
Provides GraphML (de-)serialization support for NodeScaledPortLocationModel and its parameters. |
Field Summary | |
---|---|
static PortLocationModelParameter |
NODE_BOTTOM_ANCHORED
Scaled parameter that anchors a node port at the bottom border of the node. |
static PortLocationModelParameter |
NODE_BOTTOM_LEFT_ANCHORED
Scaled parameter that anchors a node port at the bottom left corner of the node. |
static PortLocationModelParameter |
NODE_BOTTOM_RIGHT_ANCHORED
Scaled parameter that anchors a node port at the bottom right corner of the node. |
static PortLocationModelParameter |
NODE_CENTER_ANCHORED
Scaled parameter that anchors a node port at the center of the node. |
static PortLocationModelParameter |
NODE_LEFT_ANCHORED
Scaled parameter that anchors a node port at the left border of the node. |
static PortLocationModelParameter |
NODE_RIGHT_ANCHORED
Scaled parameter that anchors a node port at the right border of the node. |
static PortLocationModelParameter |
NODE_TOP_ANCHORED
Scaled parameter that anchors a node port at the top border of the node. |
static PortLocationModelParameter |
NODE_TOP_LEFT_ANCHORED
Scaled parameter that anchors a node port at the top left corner of the node. |
static PortLocationModelParameter |
NODE_TOP_RIGHT_ANCHORED
Scaled parameter that anchors a node port at the top right corner of the node. |
static byte |
POLICY_BOUNDARY
Port location policy for createParameter(NodeRealizer, y.geom.YPoint) that restricts
parameters created by the model to allow only locations on a node's
(rectangular) bounds. |
static byte |
POLICY_BOUNDARY_CENTER
Port location policy for createParameter(NodeRealizer, y.geom.YPoint) that restricts
parameters created by the model to allow only locations on a node's
(rectangular) bounds or at the node's center. |
static byte |
POLICY_BOUNDARY_INSIDE
Port location policy for createParameter(NodeRealizer, y.geom.YPoint) that restricts
parameters created by the model to allow only locations on or inside a
node's (rectangular) bounds. |
static byte |
POLICY_DISCRETE
Port location policy for createParameter(NodeRealizer, y.geom.YPoint) that restricts
parameters created by the model to nine predefined positions: top left,
top center, top right, left, center, right, bottom left, bottom center, and
bottom right. |
static byte |
POLICY_FREE
Port location policy for createParameter(NodeRealizer, y.geom.YPoint) that does not impose
any location restrictions for the created parameters. |
Constructor Summary | |
---|---|
NodeScaledPortLocationModel()
Initializes a new NodeScaledPortLocationModel instance. |
Method Summary | |
---|---|
PortLocationModelParameter |
createParameter(NodeRealizer owner,
YPoint location)
Creates a parameter for the given port that tries to match the specified location in absolute world coordinates. |
PortLocationModelParameter |
createScaledParameter(YPoint relativeOffsets)
Creates a parameter that uses the given relative offsets. |
YPoint |
getLocation(NodePort port,
PortLocationModelParameter parameter)
Determines the location of the port for the given parameter. |
byte |
getPortLocationPolicy()
Returns the current port location policy. |
void |
setPortLocationPolicy(byte policy)
Specifies the port location policy. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte POLICY_DISCRETE
createParameter(NodeRealizer, y.geom.YPoint)
that restricts
parameters created by the model to nine predefined positions: top left,
top center, top right, left, center, right, bottom left, bottom center, and
bottom right.
public static final byte POLICY_BOUNDARY
createParameter(NodeRealizer, y.geom.YPoint)
that restricts
parameters created by the model to allow only locations on a node's
(rectangular) bounds.
public static final byte POLICY_BOUNDARY_CENTER
createParameter(NodeRealizer, y.geom.YPoint)
that restricts
parameters created by the model to allow only locations on a node's
(rectangular) bounds or at the node's center.
public static final byte POLICY_BOUNDARY_INSIDE
createParameter(NodeRealizer, y.geom.YPoint)
that restricts
parameters created by the model to allow only locations on or inside a
node's (rectangular) bounds.
public static final byte POLICY_FREE
createParameter(NodeRealizer, y.geom.YPoint)
that does not impose
any location restrictions for the created parameters.
public static final PortLocationModelParameter NODE_CENTER_ANCHORED
creating a parameter
with
relative offset (0,0)
.
public static final PortLocationModelParameter NODE_LEFT_ANCHORED
creating a parameter
with
relative offset (-0.5,0)
.
public static final PortLocationModelParameter NODE_RIGHT_ANCHORED
creating a parameter
with
relative offset (0.5,0)
.
public static final PortLocationModelParameter NODE_TOP_ANCHORED
creating a parameter
with
relative offset (0,-0.5)
.
public static final PortLocationModelParameter NODE_BOTTOM_ANCHORED
creating a parameter
with
relative offset (0,0.5)
.
public static final PortLocationModelParameter NODE_TOP_LEFT_ANCHORED
creating a parameter
with
relative offset (-0.5,-0.5)
.
public static final PortLocationModelParameter NODE_TOP_RIGHT_ANCHORED
creating a parameter
with
relative offset (0.5,-0.5)
.
public static final PortLocationModelParameter NODE_BOTTOM_RIGHT_ANCHORED
creating a parameter
with
relative offset (0.5,0.5)
.
public static final PortLocationModelParameter NODE_BOTTOM_LEFT_ANCHORED
creating a parameter
with
relative offset (-0.5,0.5)
.
Constructor Detail |
---|
public NodeScaledPortLocationModel()
NodeScaledPortLocationModel
instance.
Method Detail |
---|
public byte getPortLocationPolicy()
createParameter(NodeRealizer, y.geom.YPoint)
.
setPortLocationPolicy(byte)
,
POLICY_DISCRETE
,
POLICY_BOUNDARY
,
POLICY_BOUNDARY_CENTER
,
POLICY_BOUNDARY_INSIDE
,
POLICY_FREE
,
createParameter(NodeRealizer, y.geom.YPoint)
public void setPortLocationPolicy(byte policy)
policy
- the new port location policy. One of
getPortLocationPolicy()
,
createParameter(NodeRealizer, y.geom.YPoint)
public YPoint getLocation(NodePort port, PortLocationModelParameter parameter)
PortLocationModel
getLocation
in interface PortLocationModel
port
- The port to determine the location for.parameter
- The parameter to use.
public PortLocationModelParameter createParameter(NodeRealizer owner, YPoint location)
createParameter
in interface PortLocationModel
owner
- The realizer that will own the port for which the parameter
has to be created.location
- The location in the world coordinate system that should be
matched as best as possible.
getPortLocationPolicy()
,
setPortLocationPolicy(byte)
,
POLICY_DISCRETE
,
POLICY_BOUNDARY
,
POLICY_BOUNDARY_CENTER
,
POLICY_BOUNDARY_INSIDE
,
POLICY_FREE
public PortLocationModelParameter createScaledParameter(YPoint relativeOffsets)
E.g.
(0, 0)
maps to the center of the
node
+---+ | O | +---+(unless
POLICY_BOUNDARY
is used),(0.5, 0)
maps to world coordinates
(node.x + node.width, node.centerY)
+---+ | O +---+
(0, -0.5)
maps to world coordinates
(node.centerX, node.y)
.
+-O-+ | | +---+
relativeOffsets
- The relative offsets.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |