Package org.eclipse.gef.mvc.fx.policies
Class CreationPolicy
- 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.CreationPolicy
-
- All Implemented Interfaces:
IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>,IPolicy
public class CreationPolicy extends AbstractPolicy
TheCreationPolicyis anAbstractPolicythat handles the creation of content.It handles the creation by initiating the adding of a content child to the content parent via the
ContentPolicyof the parentIContentPart, as well as the attachment of anchored content elements via theContentPolicys of anchoredIContentParts.This policy should be registered at an
IRootPart. It depends onContentPolicys being registered on allIContentParts that are affected by the creation.
-
-
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 CreationPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IContentPart<? extends javafx.scene.Node>create(java.lang.Object content, IVisualPart<? extends javafx.scene.Node> parent, int index, SetMultimap<IContentPart<? extends javafx.scene.Node>,java.lang.String> anchoreds, boolean doFocus, boolean doSelect)Creates anIContentPartfor the given contentObjectand establishes parent and anchored relationships for the newly created part.IContentPart<? extends javafx.scene.Node>create(java.lang.Object content, IVisualPart<? extends javafx.scene.Node> parent, SetMultimap<IContentPart<? extends javafx.scene.Node>,java.lang.String> anchoreds)Creates anIContentPartfor the given contentObjectand establishes parent and anchored relationships for the newly created part.protected ITransactionalOperationcreateFocusOperation(IContentPart<? extends javafx.scene.Node> part)Returns anITransactionalOperationthat adds the givenIContentPartto theFocusModelof the correspondingIViewer.protected ITransactionalOperationcreateOperation()Creates anITransactionalOperationthat is used to encapsulate the changes that are applied by thisAbstractPolicythrough its "work" methods.protected ITransactionalOperationcreateSelectOperation(IContentPart<? extends javafx.scene.Node> part)Returns anITransactionalOperationthat adds the givenIContentPartto theSelectionModelof the correspondingIViewer.protected AbstractCompositeOperationgetCompositeOperation()Extracts aAbstractCompositeOperationfrom the operation created bycreateOperation().protected IContentPartFactorygetContentPartFactory()Returns theIContentPartFactoryof the current viewer.-
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, 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
-
create
public IContentPart<? extends javafx.scene.Node> create(java.lang.Object content, IVisualPart<? extends javafx.scene.Node> parent, int index, SetMultimap<IContentPart<? extends javafx.scene.Node>,java.lang.String> anchoreds, boolean doFocus, boolean doSelect)
Creates anIContentPartfor the given contentObjectand establishes parent and anchored relationships for the newly created part. Besides, operations are created for the establishment of the parent and anchored relationships within the content model. These operations are part of the operation returned byAbstractPolicy.commit().- Parameters:
content- The contentObjectto be created.parent- TheIContentPartwhere the content is added as a child or theIRootPartfor 'root' content.index- The index for the new element.anchoreds- TheIContentPartwhose content should be attached to the new content under the given roles.doFocus-trueif the newly created part should be focused.doSelect-trueif the newly created part should be selected.- Returns:
- The
IContentPartcontrolling the newly created content.
-
create
public IContentPart<? extends javafx.scene.Node> create(java.lang.Object content, IVisualPart<? extends javafx.scene.Node> parent, SetMultimap<IContentPart<? extends javafx.scene.Node>,java.lang.String> anchoreds)
Creates anIContentPartfor the given contentObjectand establishes parent and anchored relationships for the newly created part. The respective content operations are also created. In case the given part is to be created for root contents, the root part is expected to be passed in as parent. The content will then be added to the viewer contents. Besides, operations are created for the establishment of the parent and anchored relationships within the content model. These operations are part of the operation returned byAbstractPolicy.commit().- Parameters:
content- The contentObjectto be created.parent- TheIContentPartwhere the content is added as a child.anchoreds- TheIContentPartwhose content should be attached to the new content under the given roles.- Returns:
- The
IContentPartcontrolling the newly created content.
-
createFocusOperation
protected ITransactionalOperation createFocusOperation(IContentPart<? extends javafx.scene.Node> part)
Returns anITransactionalOperationthat adds the givenIContentPartto theFocusModelof the correspondingIViewer.- Parameters:
part- TheIContentPartthat is added to the viewer models.- Returns:
- An
ITransactionalOperationthat changes the viewer models.
-
createOperation
protected ITransactionalOperation 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.
-
createSelectOperation
protected ITransactionalOperation createSelectOperation(IContentPart<? extends javafx.scene.Node> part)
Returns anITransactionalOperationthat adds the givenIContentPartto theSelectionModelof the correspondingIViewer.- Parameters:
part- TheIContentPartthat is added to the viewer models.- Returns:
- An
ITransactionalOperationthat changes the viewer models.
-
getCompositeOperation
protected AbstractCompositeOperation 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.
-
getContentPartFactory
protected IContentPartFactory getContentPartFactory()
Returns theIContentPartFactoryof the current viewer.- Returns:
- the
IContentPartFactoryof the current viewer.
-
-