T
- The type of items this instance deals with.public abstract class ModelManager<T> extends Object
CanvasControl
.Modifier | Constructor and Description |
---|---|
protected |
ModelManager(CanvasControl canvas)
Creates a new instance that will manage the items for the given canvas.
|
Modifier and Type | Method and Description |
---|---|
protected ICanvasObject |
add(T item)
Installs an itemm and adds it to this managers set of managed items.
|
CanvasControl |
getCanvas()
Gets the canvas instance this instance is managing.
|
protected abstract ICanvasObjectGroup |
getCanvasObjectGroup(T item)
Callback used by
install(java.lang.Object) to retrieve the canvas object group for a given item. |
protected abstract ICanvasObjectInstaller |
getInstaller(T item)
Callback used by
install(java.lang.Object) to retrieve the installer for a given item. |
protected ICanvasObject |
install(T item)
Installs a member of the collection into the canvas using the
ICanvasObjectDescriptor
which is returned by getInstaller(java.lang.Object) . |
boolean |
isEnabled()
Gets whether this
ModelManager is enabled. |
protected abstract void |
onDisabled()
Called when this mode gets
disabled . |
protected abstract void |
onEnabled()
Called when this mode gets
enabled . |
protected void |
remove(T item)
Uninstalls the provided item and removes it from this managers set of managed items.
|
void |
setEnabled(boolean value)
Sets whether this
ModelManager is enabled. |
protected void |
unInstall(ICanvasObject canvasObject)
Simple implementation that removes the given
ICanvasObject . |
protected ModelManager(CanvasControl canvas)
canvas
- The canvas to manage.protected ICanvasObject add(T item)
If Enabled
is set to false the item will not be installed.
item
- The item to add.null
if nothing was installed.public final CanvasControl getCanvas()
protected abstract ICanvasObjectGroup getCanvasObjectGroup(T item)
install(java.lang.Object)
to retrieve the canvas object group for a given item.
Returning null
will cause install(java.lang.Object)
not to install anything.
item
- The item to find a canvas object group for.ICanvasObjectGroup
or null
protected abstract ICanvasObjectInstaller getInstaller(T item)
install(java.lang.Object)
to retrieve the installer for a given item.
Implementations may use the ILookup.lookup(java.lang.Class)
of the item.
Returning null
will cause install(java.lang.Object)
not to install anything.
item
- The item to find an installer for.null
protected ICanvasObject install(T item)
ICanvasObjectDescriptor
which is returned by getInstaller(java.lang.Object)
.item
- The member to install.public final boolean isEnabled()
ModelManager
is enabled.
If the manager is disabled, it will not install the ICanvasObject
s into the associated CanvasControl
.
The default is true
, i.e. this manager is enabled by default.
true
if enabled; false
otherwise.setEnabled(boolean)
protected abstract void onDisabled()
disabled
.protected abstract void onEnabled()
enabled
.protected void remove(T item)
item
- The item to remove.public final void setEnabled(boolean value)
ModelManager
is enabled.
If the manager is disabled, it will not install the ICanvasObject
s into the associated CanvasControl
.
The default is true
, i.e. this manager is enabled by default.
value
- true
if enabled; false
otherwise.isEnabled()
protected void unInstall(ICanvasObject canvasObject)
ICanvasObject
.canvasObject
- The canvas objects that have been associated with the descriptor.ICanvasObject.remove()