Class AbstractPolicy

java.lang.Object
org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>>
org.eclipse.gef.mvc.fx.policies.AbstractPolicy
All Implemented Interfaces:
IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>, IPolicy
Direct Known Subclasses:
BendConnectionPolicy, ContentPolicy, CreationPolicy, DeletionPolicy, FocusTraversalPolicy, ResizePolicy, TransformPolicy, ViewportPolicy

public abstract class AbstractPolicy extends IAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>> implements IPolicy
Abstract base implementation of IPolicy that is transactional.
  • Constructor Details

    • AbstractPolicy

      public AbstractPolicy()
  • Method Details

    • 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