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 Object implements IDisposable
A temporary store for `IContentPart`s that is used by `ContentBehavior`s. They will add `IContentPart`s, 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 recycling `IContentPart`s 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

Modifier and Type
Method
Description
`void`
`add(IContentPart<? extends javafx.scene.Node> part)`
Adds an `IContentPart` to this pool.
`void`
`clear()`
Clears the pool, that is removes all `IContentPart`s.
`void`
`dispose()`
`Collection<IContentPart<? extends javafx.scene.Node>>`
`getPooled()`
Returns the `IContentPart`'s that are contained in this pool.
`IContentPart<? extends javafx.scene.Node>`
`remove(Object content)`
Retrieves an `IContentPart` for the given content element and removes it from the pool.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ContentPartPool

public ContentPartPool()

## Method Details

### add

public void add(IContentPart<? extends javafx.scene.Node> part)
Adds an `IContentPart` to this pool. The `IContentPart` will be stored under its content element (`IContentPart.getContent()`) and may later be retrieved back via this content element (see `remove(Object)`.

Parameters:
  `part` - The `IContentPart` to add to the pool.

### clear

public void clear()
Clears the pool, that is removes all `IContentPart`s.

### dispose

public void dispose()

Specified by:
  `dispose` in interface `IDisposable`

### getPooled

public Collection<IContentPart<? extends javafx.scene.Node>> getPooled()
Returns the `IContentPart`'s that are contained in this pool.

Returns:
  The `IContentPart`s that are currently contained in this pool.

### remove

public IContentPart<? extends javafx.scene.Node> remove(Object content)
Retrieves an `IContentPart` for the given content element and removes it from the pool.

Parameters:
  `content` - The `IContentPart` that was registered for the content element, or `null` if no `IContentPart` could be retrieved for the content element.
Returns:
  The part that was retrieved for the given content element, or `null` if none could be found.