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
ITransactionalOperations 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 aAddContentChildOperationtoIContentPart.addContentChild(Object, int)removeContentChild(Object)will delegate through aRemoveContentChildOperationtoIContentPart.removeContentChild(Object)attachToContentAnchorage(Object, String)will delegate through aAttachToContentAnchorageOperationtoIContentPart.attachToContentAnchorage(Object, String)detachFromContentAnchorage(Object, String)will delegate through aDetachFromContentAnchorageOperationto 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
adaptableProperties 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContentChild(Object contentChild, int index) Creates and records operations to add the given contentChild to thehostof thisContentPolicyat the specified index.voidattachToContentAnchorage(Object contentAnchorage, String role) Creates and records operations to attach thehostof thisContentPolicyto the specified contentAnchorage under the specified role.protected ITransactionalOperationCreates anITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods.voiddetachFromContentAnchorage(Object contentAnchorage, String role) Creates and records operations to detach thehostof thisContentPolicyfrom the specified contentAnchorage under the specified role.protected AbstractCompositeOperationExtracts aAbstractCompositeOperationfrom the operation created bycreateOperation().IContentPart<? extends javafx.scene.Node>getHost()voidremoveContentChild(Object contentChild) Creates and records operations to remove the given contentChild from the content children of thehostof thisContentPolicy.voidsetAdaptable(IVisualPart<? extends javafx.scene.Node> adaptable) Methods inherited from class org.eclipse.gef.mvc.fx.policies.AbstractPolicy
checkInitialized, commit, getOperation, init, isInitialized, locallyExecuteOperation, rollbackMethods inherited from class org.eclipse.gef.common.adapt.IAdaptable.Bound.Impl
adaptableProperty, getAdaptableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 thehostof thisContentPolicyat the specified index.- Parameters:
contentChild- The contentObjectthat is to be added to thehostof thisContentPolicy.index- The index of the new content child.
-
attachToContentAnchorage
Creates and records operations to attach thehostof thisContentPolicyto the specified contentAnchorage under the specified role.- Parameters:
contentAnchorage- The contentObjectto which thehostof thisContentPolicyis to be attached.role- The role for the attachment.
-
createOperation
Description copied from class:AbstractPolicyCreates anITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods. The created operation should allow forlocal executionat each time.- Specified by:
createOperationin classAbstractPolicy- Returns:
- A new
ITransactionalOperationto encapsulate all applied changes.
-
detachFromContentAnchorage
Creates and records operations to detach thehostof thisContentPolicyfrom the specified contentAnchorage under the specified role.- Parameters:
contentAnchorage- The contentObjectfrom which thegetHost()of thisContentPolicyis detached.role- The role under which the anchorage is detached.
-
getCompositeOperation
Extracts aAbstractCompositeOperationfrom the operation created bycreateOperation(). The composite operation is used to combine individual content change operations.- Returns:
- The
AbstractCompositeOperationthat 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 thehostof thisContentPolicy.- Parameters:
contentChild- The contentObjectthat is removed from content children of thehostof thisContentPolicy.
-
setAdaptable
- Specified by:
setAdaptablein interfaceIAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>- Overrides:
setAdaptablein classIAdaptable.Bound.Impl<IVisualPart<? extends javafx.scene.Node>>
-