Package org.eclipse.gef.mvc.fx.policies
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 ofIPolicythat is transactional.
-
-
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 Description AbstractPolicy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckInitialized()Checks whether thisAbstractPolicyis initialized and throws an IllegalStateException if not.ITransactionalOperationcommit()Returns anITransactionalOperationthat performs all manipulations applied by the policy since the previousinit()call.protected abstract ITransactionalOperationcreateOperation()Creates anITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods.protected ITransactionalOperationgetOperation()Returns theITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods.voidinit()Initializes the policy, so that the policy's "work" methods can be used.protected booleanisInitialized()Returns whether thisAbstractPolicyis initialized or not.protected voidlocallyExecuteOperation()Locally executes theITransactionalOperationthat is updated by this policy, i.e. not on the operation history.voidrollback()Puts back this policy into an uninitialized state, reverting any changes that have been applied via the policy's work methods since the precedinginit()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.common.adapt.IAdaptable.Bound
adaptableProperty, getAdaptable, setAdaptable
-
-
-
-
Method Detail
-
checkInitialized
protected void checkInitialized()
Checks whether thisAbstractPolicyis initialized and throws an IllegalStateException if not.
-
commit
public ITransactionalOperation commit()
Returns anITransactionalOperationthat performs all manipulations applied by the policy since the previousinit()call.- Specified by:
commitin interfaceIPolicy- Returns:
- An
ITransactionalOperationthat performs all manipulations applied by the policy since the lastinit()call.
-
createOperation
protected abstract ITransactionalOperation createOperation()
Creates anITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods. The created operation should allow forlocal executionat each time.- Returns:
- A new
ITransactionalOperationto encapsulate all applied changes.
-
getOperation
protected final ITransactionalOperation getOperation()
Returns theITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods.- Returns:
- A new
ITransactionalOperationto 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 anIllegalStateException, as well as re-initializing before committing or rolling back.
-
isInitialized
protected boolean isInitialized()
Returns whether thisAbstractPolicyis initialized or not.- Returns:
trueif thisAbstractPolicyis initialized,falseotherwise.
-
locallyExecuteOperation
protected void locallyExecuteOperation()
Locally executes theITransactionalOperationthat is updated by this policy, i.e. not on the operation history. Maybe used in the "work" operations of subclasses.
-
-