T
- The type of items in the observable collection.public class CollectionModelManager<T> extends ItemModelManager<T>
ItemModelManager
that automatically installs and removes visual representations of items in a IObservableCollection
into or from the canvas.Constructor and Description |
---|
CollectionModelManager(Class<T> itemType)
Creates a new instance.
|
CollectionModelManager(Class<T> itemType,
IObservableCollection<T> model)
Creates a new instance using the given
model . |
Modifier and Type | Method and Description |
---|---|
void |
addItem(T item)
Registers and
installs the given item into the canvas. |
T |
getItem(ICanvasObject canvasObject)
Tries to find the item managed by this instance that is associated with the given canvas object.
|
IObservableCollection<T> |
getModel()
Gets the model of the items to display in the canvas.
|
boolean |
isEnabled()
Gets a value indicating whether this
CollectionModelManager is enabled. |
protected void |
onDisabled()
Called when this mode gets
disabled . |
protected void |
onEnabled()
Called when this mode gets
enabled . |
void |
removeItem(T item)
Deregisters and uninstalls the given
item from the canvas. |
void |
setEnabled(boolean value)
Sets a value indicating whether this
CollectionModelManager is enabled. |
void |
setModel(IObservableCollection<T> value)
Sets the model of the items to display in the canvas.
|
void |
update(T item)
This method may be called to update the visual representation of the given item in the canvas.
|
addItems, getCanvasObject, getCanvasObjectGroup, getCanvasObjectGroup, getComparator, getDescriptor, getDescriptor, install, itemAddedHandler, itemChangedHandler, itemRemovedHandler, removeItems, setCanvasObjectGroup, setComparator, setDescriptor
public CollectionModelManager(Class<T> itemType)
itemType
- The type of items in the observable collection.getModel()
public CollectionModelManager(Class<T> itemType, IObservableCollection<T> model)
model
.itemType
- The type of items in the observable collection.model
- The model to manage.public void addItem(T item)
ItemModelManager
installs
the given item
into the canvas.addItem
in class ItemModelManager<T>
item
- The item to install.public T getItem(ICanvasObject canvasObject)
ItemModelManager
getItem
in class ItemModelManager<T>
canvasObject
- The canvas object to query the corresponding model item for.null
if no such item could be found.public final IObservableCollection<T> getModel()
Setting the model will automatically remove the items installed for a previously installed model. Also the items contained in the new model will immediately be queried and installed into the canvas.
setModel(IObservableCollection)
public final boolean isEnabled()
CollectionModelManager
is enabled.
If the manager is disabled, it will not install the ICanvasObject
s into the associated
CanvasControl
.
true
if enabled; otherwise, false
.setEnabled(boolean)
protected void onDisabled()
disabled
.protected void onEnabled()
enabled
.public void removeItem(T item)
ItemModelManager
item
from the canvas.removeItem
in class ItemModelManager<T>
item
- The item to uninstall.public final void setEnabled(boolean value)
CollectionModelManager
is enabled.
If the manager is disabled, it will not install the ICanvasObject
s into the associated
CanvasControl
.
value
- true
if enabled; otherwise, false
.isEnabled()
public final void setModel(IObservableCollection<T> value)
Setting the model will automatically remove the items installed for a previously installed model. Also the items contained in the new model will immediately be queried and installed into the canvas.
value
- The Model to set.getModel()
public void update(T item)
ItemModelManager
If no visual representation is registered, yet, ItemModelManager.install(Object)
will be called.
update
in class ItemModelManager<T>
item
- The item to update.