org.eclipse.gef.mvc.fx.providers

## Class DefaultAnchorProvider

- java.lang.Object
- - org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>>
  - - org.eclipse.gef.mvc.fx.providers.DefaultAnchorProvider

All Implemented Interfaces:
  IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>, IAnchorProvider

    public class DefaultAnchorProvider
    extends IAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>>
    implements IAnchorProvider

The `DefaultAnchorProvider` can be used to provide `DynamicAnchor`s for anchored `IVisualPart`s depending on their visual. For `Connection` visuals with an `OrthogonalRouter`, a `DynamicAnchor` with an `OrthogonalProjectionStrategy` is used. Otherwise, a `DynamicAnchor` with a `ChopBoxStrategy` is used.

### Property Summary

### Properties inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl

`adaptable`

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound

`IAdaptable.Bound.Impl<T extends IAdaptable>`

### Constructor Summary

Constructors
Constructor and Description
`DefaultAnchorProvider()` Constructs a new instance of `DefaultAnchorProvider`.

### Method Summary

All Methods Instance Methods Concrete Methods
`protected IGeometry` `computeAnchorageReferenceGeometry(DynamicAnchor anchor)` Returns the `DynamicAnchor.AnchorageReferenceGeometry` that is to be used for the given `DynamicAnchor`.
`protected DynamicAnchor` `createDynamicAnchor(IComputationStrategy strategy)` Creates a new `DynamicAnchor` using the visual of the `IAdaptable.Bound.Impl.getAdaptable()` as its anchorage and passing-in the given `IComputationStrategy`.
`IAnchor` `get(IVisualPart<? extends javafx.scene.Node> anchoredPart, java.lang.String role)` Returns an `IAnchor` that should be used to provide a position for the given anchored `IVisualPart` and the given role.
`protected IAnchor` `getDefaultAnchor()` Returns the `IAnchor` that is to be used when no other, more specific anchor is used.
`protected IAnchor` `getOrthogonalAnchor()` Returns the `IAnchor` that is to be used for orthogonal `Connection`s.
`protected void` `initializeComputationParameters(DynamicAnchor anchor)` Initializes the computation parameters for the given `DynamicAnchor`.

### Methods inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl

`adaptableProperty, getAdaptable, setAdaptable`

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

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

### Constructor Detail

#### DefaultAnchorProvider

    public DefaultAnchorProvider()

Constructs a new instance of `DefaultAnchorProvider`.

### Method Detail

#### computeAnchorageReferenceGeometry

    protected IGeometry computeAnchorageReferenceGeometry(DynamicAnchor anchor)

Returns the `DynamicAnchor.AnchorageReferenceGeometry` that is to be used for the given `DynamicAnchor`.

Parameters:
  `anchor` - The `DynamicAnchor` for which to compute the `DynamicAnchor.AnchorageReferenceGeometry`.
Returns:
  The `DynamicAnchor.AnchorageReferenceGeometry` that is to be used for the given `DynamicAnchor`.

#### createDynamicAnchor

    protected DynamicAnchor createDynamicAnchor(IComputationStrategy strategy)

Creates a new `DynamicAnchor` using the visual of the `IAdaptable.Bound.Impl.getAdaptable()` as its anchorage and passing-in the given `IComputationStrategy`. Also sets up the computation parameters for the newly constructed anchor using `initializeComputationParameters(DynamicAnchor)`.

Parameters:
  `strategy` - The `IComputationStrategy` to use.
Returns:
  The newly constructed and set up `DynamicAnchor`.

#### get

    public IAnchor get(IVisualPart<? extends javafx.scene.Node> anchoredPart,
                       java.lang.String role)

Description copied from interface: `IAnchorProvider`
Returns an `IAnchor` that should be used to provide a position for the given anchored `IVisualPart` and the given role.

Specified by:
  `get` in interface `IAnchorProvider`
Parameters:
  `anchoredPart` - The anchored `IVisualPart` which the returned `IAnchor` should provide a position for.
  `role` - The role which the returned `IAnchor` should provide a position for.
Returns:
  An `IAnchor` that should be used to provide a position for the given anchored `IVisualPart` and the given role.

#### getDefaultAnchor

    protected IAnchor getDefaultAnchor()

Returns the `IAnchor` that is to be used when no other, more specific anchor is used.

Returns:
  The `IAnchor` that is to be used when no other, more specific anchor is used.

#### getOrthogonalAnchor

    protected IAnchor getOrthogonalAnchor()

Returns the `IAnchor` that is to be used for orthogonal `Connection`s.

Returns:
  The `IAnchor` that is to be used for orthogonal `Connection`s

#### initializeComputationParameters

    protected void initializeComputationParameters(DynamicAnchor anchor)

Initializes the computation parameters for the given `DynamicAnchor`.

Parameters:
  `anchor` - The `DynamicAnchor` for which to initialize computation parameters.