Package org.eclipse.gef.mvc.fx.behaviors
Class ContentPartPool
- java.lang.Object
-
- org.eclipse.gef.mvc.fx.behaviors.ContentPartPool
-
- All Implemented Interfaces:
IDisposable
public class ContentPartPool extends java.lang.Object implements IDisposable
A temporary store forIContentParts that is used byContentBehaviors. They will addIContentParts, which are removed from the viewer during content synchronization (e.g. because the related content element was deleted), to be re-used (i.e. removed again and restored within the viewer) when the content element re-appears during synchronization, e.g. because of an undo of a delete operation. The motivation behind recyclingIContentParts is that after an undo the viewer is in the exact same state as before the execution of an operation (which may be important for feedback or handles).
-
-
Constructor Summary
Constructors Constructor Description ContentPartPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(IContentPart<? extends javafx.scene.Node> part)Adds anIContentPartto this pool.voidclear()Clears the pool, that is removes allIContentParts.voiddispose()java.util.Collection<IContentPart<? extends javafx.scene.Node>>getPooled()Returns theIContentPart's that are contained in this pool.IContentPart<? extends javafx.scene.Node>remove(java.lang.Object content)Retrieves anIContentPartfor the given content element and removes it from the pool.
-
-
-
Method Detail
-
add
public void add(IContentPart<? extends javafx.scene.Node> part)
Adds anIContentPartto this pool. TheIContentPartwill be stored under its content element (IContentPart.getContent()) and may later be retrieved back via this content element (seeremove(Object).- Parameters:
part- TheIContentPartto add to the pool.
-
clear
public void clear()
Clears the pool, that is removes allIContentParts.
-
dispose
public void dispose()
- Specified by:
disposein interfaceIDisposable
-
getPooled
public java.util.Collection<IContentPart<? extends javafx.scene.Node>> getPooled()
Returns theIContentPart's that are contained in this pool.- Returns:
- The
IContentParts that are currently contained in this pool.
-
remove
public IContentPart<? extends javafx.scene.Node> remove(java.lang.Object content)
Retrieves anIContentPartfor the given content element and removes it from the pool.- Parameters:
content- TheIContentPartthat was registered for the content element, ornullif noIContentPartcould be retrieved for the content element.- Returns:
- The part that was retrieved for the given content element, or
nullif none could be found.
-
-