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
An `StaticAnchor` provides a position for each `AnchorKey`, based on a reference position relative to the anchorage `Node`, to which the `StaticAnchor` is bound, or based on a (global) static reference position in case the `StaticAnchor` is unbound.

## Property Summary

Properties
Type
Property
Description
`ObjectProperty<Point>`
`referencePosition`
Returns the `ObjectProperty` that manages the reference position of this `StaticAnchor`.

### Properties inherited from class org.eclipse.gef.fx.anchors.AbstractAnchor

`anchorage, positionsUnmodifiable`

## Constructor Summary

Constructors
Constructor
Description
`StaticAnchor(Node anchorage, Point referencePositionInAnchorageLocal)`
Creates an `StaticAnchor` that is bound to the provided anchorage.
`StaticAnchor(Point referencePositionInScene)`
Creates an `StaticAnchor` that is not bound to an anchorage `Node` and will always provide the passed in position (in scene coordinates) for all attached `AnchorKey`s (i.e. anchored `Node`s).

## Method Summary

Modifier and Type
Method
Description
`protected Point`
`computePosition(AnchorKey key)`
Recomputes the position for the given attached `AnchorKey` by delegating to the respective `IComputationStrategy`.
`Point`
`getReferencePosition()`
Returns the reference position of this `StaticAnchor`.
`ObjectProperty<Point>`
`referencePositionProperty()`
Returns the `ObjectProperty` that manages the reference position of this `StaticAnchor`.
`void`
`setReferencePosition(Point referencePosition)`
Sets the reference position of this `StaticAnchor` to the given value.
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Property Details

### referencePosition

public ObjectProperty<Point> referencePositionProperty
Returns the `ObjectProperty` that manages the reference position of this `StaticAnchor`.

See Also:
  - `getReferencePosition()`
  - `setReferencePosition(Point)`

## Constructor Details

### StaticAnchor

public StaticAnchor(Node anchorage, Point referencePositionInAnchorageLocal)
Creates an `StaticAnchor` that is bound to the provided anchorage. It will used the passed in reference position (in the local coordinate system of the anchorage `Node`) to compute positions (see `AbstractAnchor.positionsUnmodifiableProperty()`) for all attached `AnchorKey`s (in the local coordinate system of the attached `AnchorKey`'s `Node` ).

In case the anchorage `Node` or any of its ancestors are changed in a way that will affect the position, the `AbstractAnchor.positionsUnmodifiableProperty()` will be updated.

Parameters:
  `anchorage` - The anchorage `Node` to bind this `StaticAnchor` to.
  `referencePositionInAnchorageLocal` - The position within the local coordinate space of the anchorage `Node`, which is used to compute the position (in scene coordinates) for all attached `AnchorKey`s.

### StaticAnchor

public StaticAnchor(Point referencePositionInScene)
Creates an `StaticAnchor` that is not bound to an anchorage `Node` and will always provide the passed in position (in scene coordinates) for all attached `AnchorKey`s (i.e. anchored `Node`s).

Parameters:
  `referencePositionInScene` - The position in scene coordinates to be provided for all attached `AnchorKey`s.

## Method Details

### computePosition

protected Point computePosition(AnchorKey key)
Description copied from class: `AbstractAnchor`
Recomputes the position for the given attached `AnchorKey` by delegating to the respective `IComputationStrategy`.

Specified by:
  `computePosition` in class `AbstractAnchor`
Parameters:
  `key` - The `AnchorKey` for which to compute an anchor position.
Returns:
  The point for the given `AnchorKey` in local coordinates of the anchored `Node`.

### getReferencePosition

public Point getReferencePosition()
Returns the reference position of this `StaticAnchor`.

Returns:
  The reference position of this `StaticAnchor`.

### referencePositionProperty

public ObjectProperty<Point> referencePositionProperty()
Returns the `ObjectProperty` that manages the reference position of this `StaticAnchor`.

See Also:
  - `getReferencePosition()`
  - `setReferencePosition(Point)`

### setReferencePosition

public void setReferencePosition(Point referencePosition)
Sets the reference position of this `StaticAnchor` to the given value.

Parameters:
  `referencePosition` - The new reference position for this `StaticAnchor`.

### toString

public String toString()

Overrides:
  `toString` in class `Object`