Package org.eclipse.gef.fx.anchors
Class StaticAnchor
- java.lang.Object
-
- org.eclipse.gef.fx.anchors.AbstractAnchor
-
- org.eclipse.gef.fx.anchors.StaticAnchor
-
- All Implemented Interfaces:
IAnchor
- Direct Known Subclasses:
AbstractRouter.VolatileStaticAnchor
public class StaticAnchor extends AbstractAnchor
AnStaticAnchor
provides a position for eachAnchorKey
, based on a reference position relative to the anchorageNode
, to which theStaticAnchor
is bound, or based on a (global) static reference position in case theStaticAnchor
is unbound.
-
-
Constructor Summary
Constructors Constructor Description StaticAnchor(javafx.scene.Node anchorage, Point referencePositionInAnchorageLocal)
Creates anStaticAnchor
that is bound to the provided anchorage.StaticAnchor(Point referencePositionInScene)
Creates anStaticAnchor
that is not bound to an anchorageNode
and will always provide the passed in position (in scene coordinates) for all attachedAnchorKey
s (i.e. anchoredNode
s).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Point
computePosition(AnchorKey key)
Recomputes the position for the given attachedAnchorKey
by delegating to the respectiveIComputationStrategy
.Point
getReferencePosition()
Returns the reference position of thisStaticAnchor
.javafx.beans.property.ObjectProperty<Point>
referencePositionProperty()
Returns theObjectProperty
that manages the reference position of thisStaticAnchor
.void
setReferencePosition(Point referencePosition)
Sets the reference position of thisStaticAnchor
to the given value.java.lang.String
toString()
-
Methods inherited from class org.eclipse.gef.fx.anchors.AbstractAnchor
anchorageProperty, attach, detach, getAnchorage, getKeys, getKeysByNode, getPosition, getPositionsUnmodifiable, isAttached, positionsUnmodifiableProperty, registerVCL, registerVCLs, setAnchorage, unregisterVCL, unregisterVCLs, updatePosition, updatePositions
-
-
-
-
Constructor Detail
-
StaticAnchor
public StaticAnchor(javafx.scene.Node anchorage, Point referencePositionInAnchorageLocal)
Creates anStaticAnchor
that is bound to the provided anchorage. It will used the passed in reference position (in the local coordinate system of the anchorageNode
) to compute positions (seeAbstractAnchor.positionsUnmodifiableProperty()
) for all attachedAnchorKey
s (in the local coordinate system of the attachedAnchorKey
'sNode
).In case the anchorage
Node
or any of its ancestors are changed in a way that will affect the position, theAbstractAnchor.positionsUnmodifiableProperty()
will be updated.- Parameters:
anchorage
- The anchorageNode
to bind thisStaticAnchor
to.referencePositionInAnchorageLocal
- The position within the local coordinate space of the anchorageNode
, which is used to compute the position (in scene coordinates) for all attachedAnchorKey
s.
-
StaticAnchor
public StaticAnchor(Point referencePositionInScene)
Creates anStaticAnchor
that is not bound to an anchorageNode
and will always provide the passed in position (in scene coordinates) for all attachedAnchorKey
s (i.e. anchoredNode
s).- Parameters:
referencePositionInScene
- The position in scene coordinates to be provided for all attachedAnchorKey
s.
-
-
Method Detail
-
computePosition
protected Point computePosition(AnchorKey key)
Description copied from class:AbstractAnchor
Recomputes the position for the given attachedAnchorKey
by delegating to the respectiveIComputationStrategy
.- Specified by:
computePosition
in classAbstractAnchor
- Parameters:
key
- TheAnchorKey
for which to compute an anchor position.- Returns:
- The point for the given
AnchorKey
in local coordinates of the anchoredNode
.
-
getReferencePosition
public Point getReferencePosition()
Returns the reference position of thisStaticAnchor
.- Returns:
- The reference position of this
StaticAnchor
.
-
referencePositionProperty
public javafx.beans.property.ObjectProperty<Point> referencePositionProperty()
Returns theObjectProperty
that manages the reference position of thisStaticAnchor
.- Returns:
- The
ObjectProperty
that manages the reference position of thisStaticAnchor
.
-
setReferencePosition
public void setReferencePosition(Point referencePosition)
Sets the reference position of thisStaticAnchor
to the given value.- Parameters:
referencePosition
- The new reference position for thisStaticAnchor
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-