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 ofIPolicy
that 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 void
checkInitialized()
Checks whether thisAbstractPolicy
is initialized and throws an IllegalStateException if not.ITransactionalOperation
commit()
Returns anITransactionalOperation
that performs all manipulations applied by the policy since the previousinit()
call.protected abstract ITransactionalOperation
createOperation()
Creates anITransactionalOperation
that is used to encapsulate the changes that are applied by thisAbstractPolicy
through its "work" methods.protected ITransactionalOperation
getOperation()
Returns theITransactionalOperation
that is used to encapsulate the changes that are applied by thisAbstractPolicy
through its "work" methods.void
init()
Initializes the policy, so that the policy's "work" methods can be used.protected boolean
isInitialized()
Returns whether thisAbstractPolicy
is initialized or not.protected void
locallyExecuteOperation()
Locally executes theITransactionalOperation
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 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 thisAbstractPolicy
is initialized and throws an IllegalStateException if not.
-
commit
public ITransactionalOperation commit()
Returns anITransactionalOperation
that performs all manipulations applied by the policy since the previousinit()
call.- Specified by:
commit
in interfaceIPolicy
- Returns:
- An
ITransactionalOperation
that performs all manipulations applied by the policy since the lastinit()
call.
-
createOperation
protected abstract ITransactionalOperation createOperation()
Creates anITransactionalOperation
that is used to encapsulate the changes that are applied by thisAbstractPolicy
through its "work" methods. The created operation should allow forlocal execution
at each time.- Returns:
- A new
ITransactionalOperation
to encapsulate all applied changes.
-
getOperation
protected final ITransactionalOperation getOperation()
Returns theITransactionalOperation
that is used to encapsulate the changes that are applied by thisAbstractPolicy
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 anIllegalStateException
, as well as re-initializing before committing or rolling back.
-
isInitialized
protected boolean isInitialized()
Returns whether thisAbstractPolicy
is initialized or not.- Returns:
true
if thisAbstractPolicy
is initialized,false
otherwise.
-
locallyExecuteOperation
protected void locallyExecuteOperation()
Locally executes theITransactionalOperation
that is updated by this policy, i.e. not on the operation history. Maybe used in the "work" operations of subclasses.
-
-