Package org.eclipse.gef.mvc.fx.behaviors
Class ContentBehavior
- java.lang.Object
-
- org.eclipse.gef.mvc.fx.behaviors.AbstractBehavior
-
- org.eclipse.gef.mvc.fx.behaviors.ContentBehavior
-
- All Implemented Interfaces:
IActivatable
,IAdaptable.Bound<IVisualPart<? extends javafx.scene.Node>>
,IDisposable
,IBehavior
public class ContentBehavior extends AbstractBehavior implements IDisposable
A behavior that can be adapted to anIRootPart
or anIContentPart
to synchronize the list ofIContentPart
children and (only in case of anIContentPart
) anchorages with the list of content children and anchored.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.gef.common.adapt.IAdaptable.Bound
IAdaptable.Bound.Impl<T extends IAdaptable>
-
-
Field Summary
-
Fields inherited from interface org.eclipse.gef.common.activate.IActivatable
ACTIVE_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description ContentBehavior()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
protected void
disposeIfObsolete(IContentPart<? extends javafx.scene.Node> contentPart)
If the givenIContentPart
does neither have a parent nor any anchoreds, then it's content is set tonull
and the part is added to theContentPartPool
.protected void
doActivate()
PostAbstractBehavior.activate()
hook that may be overwritten to e.g. register listeners.protected void
doDeactivate()
PreAbstractBehavior.deactivate()
hook that may be overwritten to e.g. unregister listeners.protected IContentPart<? extends javafx.scene.Node>
findOrCreatePartFor(java.lang.Object content)
Finds/Revives/Creates anIContentPart
for the given contentObject
.protected IContentPartFactory
getContentPartFactory()
Returns theIContentPartFactory
of the current viewer.protected ContentPartPool
getContentPartPool()
Returns theContentPartPool
that is used to recycle content parts in the context of anIViewer
.void
synchronizeContentPartAnchorages(IVisualPart<? extends javafx.scene.Node> anchored, SetMultimap<? extends java.lang.Object,? extends java.lang.String> contentAnchorages)
Updates the hostIVisualPart
'sIContentPart
anchorages (seeIVisualPart.getAnchoragesUnmodifiable()
) so that it is in sync with the set of content anchorages that is passed in.void
synchronizeContentPartChildren(IVisualPart<? extends javafx.scene.Node> parent, java.util.List<? extends java.lang.Object> contentChildren)
Updates the hostIVisualPart
'sIContentPart
children (seeIVisualPart.getChildrenUnmodifiable()
) so that it is in sync with the set of content children that is passed in.-
Methods inherited from class org.eclipse.gef.mvc.fx.behaviors.AbstractBehavior
activate, activeProperty, adaptableProperty, addAnchoreds, addAnchoreds, addFeedback, addFeedback, addHandles, addHandles, clearFeedback, clearHandles, deactivate, getAdaptable, getFeedback, getFeedback, getFeedbackPartFactory, getFeedbackPartFactory, getFeedbackPerTargetSet, getHandlePartFactory, getHandlePartFactory, getHandles, getHandles, getHandlesPerTargetSet, getHost, hasFeedback, hasFeedback, hasHandles, hasHandles, isActive, removeAnchoreds, removeFeedback, removeFeedback, removeFeedback, removeHandles, removeHandles, removeHandles, setAdaptable, updateHandles, updateHandles
-
-
-
-
Method Detail
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceIDisposable
-
disposeIfObsolete
protected void disposeIfObsolete(IContentPart<? extends javafx.scene.Node> contentPart)
If the givenIContentPart
does neither have a parent nor any anchoreds, then it's content is set tonull
and the part is added to theContentPartPool
.- Parameters:
contentPart
- TheIContentPart
that is eventually disposed.
-
doActivate
protected void doActivate()
Description copied from class:AbstractBehavior
PostAbstractBehavior.activate()
hook that may be overwritten to e.g. register listeners.- Overrides:
doActivate
in classAbstractBehavior
-
doDeactivate
protected void doDeactivate()
Description copied from class:AbstractBehavior
PreAbstractBehavior.deactivate()
hook that may be overwritten to e.g. unregister listeners.- Overrides:
doDeactivate
in classAbstractBehavior
-
findOrCreatePartFor
protected IContentPart<? extends javafx.scene.Node> findOrCreatePartFor(java.lang.Object content)
Finds/Revives/Creates anIContentPart
for the given contentObject
. If anIContentPart
for the given contentObject
can be found in the viewer's content-part-map, then this part is returned. If anIContentPart
for the given contentObject
is stored in theContentPartPool
, then this part is returned. Otherwise, the injectedIContentPartFactory
is used to create a newIContentPart
for the given contentObject
.- Parameters:
content
- The contentObject
for which the correspondingIContentPart
is to be returned.- Returns:
- The
IContentPart
corresponding to the given contentObject
.
-
getContentPartFactory
protected IContentPartFactory getContentPartFactory()
Returns theIContentPartFactory
of the current viewer.- Returns:
- the
IContentPartFactory
of the current viewer.
-
getContentPartPool
protected ContentPartPool getContentPartPool()
Returns theContentPartPool
that is used to recycle content parts in the context of anIViewer
.- Returns:
- The
ContentPartPool
of theIViewer
.
-
synchronizeContentPartAnchorages
public void synchronizeContentPartAnchorages(IVisualPart<? extends javafx.scene.Node> anchored, SetMultimap<? extends java.lang.Object,? extends java.lang.String> contentAnchorages)
Updates the hostIVisualPart
'sIContentPart
anchorages (seeIVisualPart.getAnchoragesUnmodifiable()
) so that it is in sync with the set of content anchorages that is passed in.- Parameters:
anchored
- The anchoredIVisualPart
whose content part anchorages to synchronize with the given content anchorages.contentAnchorages
- * The map of content anchorages with roles to be synchronized with the list ofIContentPart
anchorages (IVisualPart.getAnchoragesUnmodifiable()
).- See Also:
IContentPart.getContentAnchoragesUnmodifiable()
,IVisualPart.getAnchoragesUnmodifiable()
-
synchronizeContentPartChildren
public void synchronizeContentPartChildren(IVisualPart<? extends javafx.scene.Node> parent, java.util.List<? extends java.lang.Object> contentChildren)
Updates the hostIVisualPart
'sIContentPart
children (seeIVisualPart.getChildrenUnmodifiable()
) so that it is in sync with the set of content children that is passed in.- Parameters:
parent
- The parentIVisualPart
whose content part children to synchronize against the given content children.contentChildren
- The list of content part children to be synchronized with the list ofIContentPart
children (IVisualPart.getChildrenUnmodifiable()
).- See Also:
IContentPart.getContentChildrenUnmodifiable()
,IVisualPart.getChildrenUnmodifiable()
-
-