Package org.eclipse.gef.mvc.fx.policies
Class ContentPolicy
java.lang.Object
org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>>
org.eclipse.gef.mvc.fx.policies.AbstractPolicy
org.eclipse.gef.mvc.fx.policies.ContentPolicy
- All Implemented Interfaces:
IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>
,IPolicy
A (transaction) policy to handle content changes, i.e. adding/removing of
content children as well as attaching/detaching to/from content anchorages.
All changes are wrapped into
ITransactionalOperation
s that delegate
to respective operations of the host IContentPart
upon execution.
In detail, the following delegations are performed to operations of the host
IContentPart
:
addContentChild(Object, int)
will delegate through aAddContentChildOperation
toIContentPart.addContentChild(Object, int)
removeContentChild(Object)
will delegate through aRemoveContentChildOperation
toIContentPart.removeContentChild(Object)
attachToContentAnchorage(Object, String)
will delegate through aAttachToContentAnchorageOperation
toIContentPart.attachToContentAnchorage(Object, String)
detachFromContentAnchorage(Object, String)
will delegate through aDetachFromContentAnchorageOperation
to IContentPart#detachFromContentAnchorage(Object, String)}
This policy should be registered on each IContentPart
.
-
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addContentChild
(Object contentChild, int index) Creates and records operations to add the given contentChild to thehost
of thisContentPolicy
at the specified index.void
attachToContentAnchorage
(Object contentAnchorage, String role) Creates and records operations to attach thehost
of thisContentPolicy
to the specified contentAnchorage under the specified role.protected ITransactionalOperation
Creates anITransactionalOperation
that is used to encapsulate the changes that are applied by thisAbstractPolicy
through its "work" methods.void
detachFromContentAnchorage
(Object contentAnchorage, String role) Creates and records operations to detach thehost
of thisContentPolicy
from the specified contentAnchorage under the specified role.protected AbstractCompositeOperation
Extracts aAbstractCompositeOperation
from the operation created bycreateOperation()
.IContentPart<? extends javafx.scene.Node>
getHost()
void
removeContentChild
(Object contentChild) Creates and records operations to remove the given contentChild from the content children of thehost
of thisContentPolicy
.void
setAdaptable
(IVisualPart<? extends javafx.scene.Node> adaptable) Methods inherited from class org.eclipse.gef.mvc.fx.policies.AbstractPolicy
checkInitialized, commit, getOperation, init, isInitialized, locallyExecuteOperation, rollback
Methods inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl
adaptableProperty, getAdaptable
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
-
Constructor Details
-
ContentPolicy
public ContentPolicy()
-
-
Method Details
-
addContentChild
Creates and records operations to add the given contentChild to thehost
of thisContentPolicy
at the specified index.- Parameters:
contentChild
- The contentObject
that is to be added to thehost
of thisContentPolicy
.index
- The index of the new content child.
-
attachToContentAnchorage
Creates and records operations to attach thehost
of thisContentPolicy
to the specified contentAnchorage under the specified role.- Parameters:
contentAnchorage
- The contentObject
to which thehost
of thisContentPolicy
is to be attached.role
- The role for the attachment.
-
createOperation
Description copied from class:AbstractPolicy
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.- Specified by:
createOperation
in classAbstractPolicy
- Returns:
- A new
ITransactionalOperation
to encapsulate all applied changes.
-
detachFromContentAnchorage
Creates and records operations to detach thehost
of thisContentPolicy
from the specified contentAnchorage under the specified role.- Parameters:
contentAnchorage
- The contentObject
from which thegetHost()
of thisContentPolicy
is detached.role
- The role under which the anchorage is detached.
-
getCompositeOperation
Extracts aAbstractCompositeOperation
from the operation created bycreateOperation()
. The composite operation is used to combine individual content change operations.- Returns:
- The
AbstractCompositeOperation
that is used to combine the individual content change operations.
-
getHost
Description copied from interface:IPolicy
- Returns:
- The host of this
IPolicy
.
-
removeContentChild
Creates and records operations to remove the given contentChild from the content children of thehost
of thisContentPolicy
.- Parameters:
contentChild
- The contentObject
that is removed from content children of thehost
of thisContentPolicy
.
-
setAdaptable
- Specified by:
setAdaptable
in interfaceIAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>
- Overrides:
setAdaptable
in classIAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>>
-