org.eclipse.gef.mvc.fx.policies

## Class AbstractPolicy

- java.lang.Object
- - org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl<IVisualPart<? extends Node>>
  - - org.eclipse.gef.mvc.fx.policies.AbstractPolicy

All Implemented Interfaces:
  IAdaptable.Bound<IVisualPart<? extends Node>>, IPolicy

Direct Known Subclasses:
  BendConnectionPolicy, ContentPolicy, CreationPolicy, DeletionPolicy, FocusTraversalPolicy, ResizePolicy, TransformPolicy, ViewportPolicy

    public abstract class AbstractPolicy
    extends IAdaptable.Bound.Impl<IVisualPart<? extends Node>>
    implements IPolicy

Abstract base implementation of `IPolicy` that is transactional.

### Property Summary

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

`adaptable`

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

`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
`AbstractPolicy()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected void` `checkInitialized()` Checks whether this `AbstractPolicy` is initialized and throws an IllegalStateException if not.
`ITransactionalOperation` `commit()` Returns an `ITransactionalOperation` that performs all manipulations applied by the policy since the previous `init()` call.
`protected abstract ITransactionalOperation` `createOperation()` Creates an `ITransactionalOperation` that is used to encapsulate the changes that are applied by this `AbstractPolicy` through its "work" methods.
`protected ITransactionalOperation` `getOperation()` Returns the `ITransactionalOperation` that is used to encapsulate the changes that are applied by this `AbstractPolicy` through its "work" methods.
`void` `init()` Initializes the policy, so that the policy's "work" methods can be used.
`protected boolean` `isInitialized()` Returns whether this `AbstractPolicy` is initialized or not.
`protected void` `locallyExecuteOperation()` Locally executes the `ITransactionalOperation` that is updated by this policy, i.e. not on the operation history.
`void` `rollback()` Puts back this policy into an uninitialized state, reverting any changes that have been applied via the policy's work methods since the preceding `init()` call.

### 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`

### Methods inherited from interface org.eclipse.gef.mvc.fx.policies.IPolicy

`getHost`

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

`adaptableProperty, getAdaptable, setAdaptable`

### Constructor Detail

#### AbstractPolicy

    public AbstractPolicy()

### Method Detail

#### checkInitialized

    protected void checkInitialized()

Checks whether this `AbstractPolicy` is initialized and throws an IllegalStateException if not.

#### commit

    public ITransactionalOperation commit()

Returns an `ITransactionalOperation` that performs all manipulations applied by the policy since the previous `init()` call.

Specified by:
  `commit` in interface `IPolicy`
Returns:
  An `ITransactionalOperation` that performs all manipulations applied by the policy since the last `init()` call.

#### createOperation

    protected abstract ITransactionalOperation createOperation()

Creates an `ITransactionalOperation` that is used to encapsulate the changes that are applied by this `AbstractPolicy` through its "work" methods. The created operation should allow for `local execution` at each time.

Returns:
  A new `ITransactionalOperation` to encapsulate all applied changes.

#### getOperation

    protected final ITransactionalOperation getOperation()

Returns the `ITransactionalOperation` that is used to encapsulate the changes that are applied by this `AbstractPolicy` through its "work" methods.

Returns:
  A new `ITransactionalOperation` to encapsulate all applied changes.

#### init

    public void init()

Initializes the policy, so that the policy's "work" methods can be used. Calling a "work" method while the policy is not initialized will result in an `IllegalStateException`, as well as re-initializing before committing or rolling back.

Specified by:
  `init` in interface `IPolicy`

#### isInitialized

    protected boolean isInitialized()

Returns whether this `AbstractPolicy` is initialized or not.

Returns:
  `true` if this `AbstractPolicy` is initialized, `false` otherwise.

#### locallyExecuteOperation

    protected void locallyExecuteOperation()

Locally executes the `ITransactionalOperation` that is updated by this policy, i.e. not on the operation history. Maybe used in the "work" operations of subclasses.

#### rollback

    public void rollback()

Puts back this policy into an uninitialized state, reverting any changes that have been applied via the policy's work methods since the preceding `init()` call.

Specified by:
  `rollback` in interface `IPolicy`