Package org.eclipse.gef.fx.anchors

# Interface IAnchor

All Known Implementing Classes:
  `AbstractAnchor`, `AbstractRouter.VolatileStaticAnchor`, `DynamicAnchor`, `StaticAnchor`

public interface IAnchor
An `IAnchor` is a visual anchor that will provide positions for attached `AnchorKey`s (i.e. anchored `Node`s) in local coordinates of the `AnchorKey`'s anchored `Node`.

The position for each attached `Node` will be recomputed in case the attached `Node` or any of its ancestors are changed in a way that has an effect on the position being provided for the attached `Node`. The `positionsUnmodifiableProperty()` will be updated accordingly, it may be monitored for changes.

An `IAnchor` may be bound to an anchorage `Node`. If this is the case, positions for all attached `Node`s will also be recomputed in case the anchorage `Node` or any of its ancestors are changed in a way that will have an effect on the position of the attached `Node`.

## Property Summary

Properties
Type
Property
Description
`ReadOnlyObjectProperty<Node>`
`anchorage`
Provides a read-only property with the anchorage `Node` this `IAnchor` is bound to.
`ReadOnlyMapProperty<AnchorKey,Point>`
`positionsUnmodifiable`
Provides a read-only (map) property with positions (in local coordinates of the anchored `Node`s) for all attached `AnchorKey`s.

## Method Summary

Modifier and Type
Method
Description
`ReadOnlyObjectProperty<Node>`
`anchorageProperty()`
Provides a read-only property with the anchorage `Node` this `IAnchor` is bound to.
`void`
`attach(AnchorKey key)`
Attaches the given `AnchorKey` to this `IAnchor`.
`void`
`detach(AnchorKey key)`
Detaches the given `AnchorKey` from this `IAnchor`.
`Node`
`getAnchorage()`
Provides the anchorage `Node` this `IAnchor` is bound to.
`Point`
`getPosition(AnchorKey key)`
Provides a position for the given `AnchorKey`.
`ObservableMap<AnchorKey,Point>`
`getPositionsUnmodifiable()`
Provides an observable read-only (map) with positions (in local coordinates of the anchored `Node`s) for all attached `AnchorKey`s.
`boolean`
`isAttached(AnchorKey key)`
Determines if the given `AnchorKey` is currently attached to this `IAnchor`.
`ReadOnlyMapProperty<AnchorKey,Point>`
`positionsUnmodifiableProperty()`
Provides a read-only (map) property with positions (in local coordinates of the anchored `Node`s) for all attached `AnchorKey`s.

## Property Details

### anchorage

ReadOnlyObjectProperty<Node> anchorageProperty
Provides a read-only property with the anchorage `Node` this `IAnchor` is bound to. The property value may be `null` in case this `IAnchor` is not bound to an anchorage `Node`.

See Also:
  - `getAnchorage()`

### positionsUnmodifiable

ReadOnlyMapProperty<AnchorKey,Point> positionsUnmodifiableProperty
Provides a read-only (map) property with positions (in local coordinates of the anchored `Node`s) for all attached `AnchorKey`s. The positions will be updated for all attached `AnchorKey`s if the attached `Node`s or the anchorage `Node`, the `IAnchor` is bound to, or any of their ancestors changes in a way that will effect the positions (within the local coordinate space of the attached `Node`s).

See Also:
  - `getPositionsUnmodifiable()`

## Method Details

### anchorageProperty

ReadOnlyObjectProperty<Node> anchorageProperty()
Provides a read-only property with the anchorage `Node` this `IAnchor` is bound to. The property value may be `null` in case this `IAnchor` is not bound to an anchorage `Node`.

See Also:
  - `getAnchorage()`

### attach

void attach(AnchorKey key)
Attaches the given `AnchorKey` to this `IAnchor`.

Parameters:
  `key` - The `AnchorKey` to be attached.

### detach

void detach(AnchorKey key)
Detaches the given `AnchorKey` from this `IAnchor`.

Parameters:
  `key` - The `AnchorKey` to be detached.

### getAnchorage

Node getAnchorage()
Provides the anchorage `Node` this `IAnchor` is bound to. Will return the value of the `anchorageProperty()`.

Returns:
  The value of the `anchorageProperty()`.

### getPosition

Point getPosition(AnchorKey key)
Provides a position for the given `AnchorKey`. The provided `AnchorKey` has to be attached to this `IAnchor` (see `attach(AnchorKey)`).

Parameters:
  `key` - The `AnchorKey` to retrieve a position for. It has to be attached (`attach(AnchorKey)`) to this `IAnchor` before.
Returns:
  The position for the given `AnchorKey` within local coordinates of the `AnchorKey`'s anchored `Node`.

### getPositionsUnmodifiable

ObservableMap<AnchorKey,Point> getPositionsUnmodifiable()
Provides an observable read-only (map) with positions (in local coordinates of the anchored `Node`s) for all attached `AnchorKey`s. The positions will be updated for all attached `AnchorKey`s if the attached `Node`s or the anchorage `Node`, the `IAnchor` is bound to, or any of their ancestors changes in a way that will effect the positions (within the local coordinate space of the attached `Node`s).

Returns:
  A read-only observable map storing positions for all attached `AnchorKey`s.

### isAttached

boolean isAttached(AnchorKey key)
Determines if the given `AnchorKey` is currently attached to this `IAnchor`.

Parameters:
  `key` - The `AnchorKey` to test.
Returns:
  `true` if the given key is attached, otherwise `false`.

### positionsUnmodifiableProperty

ReadOnlyMapProperty<AnchorKey,Point> positionsUnmodifiableProperty()
Provides a read-only (map) property with positions (in local coordinates of the anchored `Node`s) for all attached `AnchorKey`s. The positions will be updated for all attached `AnchorKey`s if the attached `Node`s or the anchorage `Node`, the `IAnchor` is bound to, or any of their ancestors changes in a way that will effect the positions (within the local coordinate space of the attached `Node`s).

See Also:
  - `getPositionsUnmodifiable()`