T
- The type of the items in the collection and selection model.public class SelectionIndicatorManager<T extends ILookup> extends ModelManager<T>
ModelManager
implementation that manages the visual decorations of selected elements in a canvas.
For each item in the Model
that is marked as selected by the SelectionModel
this class uses the ILookup
mechanism of the items to lookup an ISelectionIndicatorInstaller
implementation which will do the actual installation of the decoration in the canvas.
Constructor and Description |
---|
SelectionIndicatorManager(CanvasControl canvas,
IObservableCollection<T> model,
ISelectionModel<T> selectionModel)
Creates an instance that for all selected items in the model dynamically installs a selection render decoration.
|
Modifier and Type | Method and Description |
---|---|
ICanvasObject |
addSelection(T item)
Adds an item to the current selection.
|
protected ICanvasObjectGroup |
getCanvasObjectGroup(T item)
Callback used by
ModelManager.install(Object) to retrieve the installer for a given item. |
protected ICanvasObjectInstaller |
getInstaller(T item)
Callback used by
ModelManager.install(Object) to retrieve the installer for a given item. |
IObservableCollection<T> |
getModel()
Gets the model that describes the domain for the selection.
|
ISelectionModel<T> |
getSelectionModel()
Gets the selection model that determines which items are selected.
|
protected void |
onDisabled()
Called when this mode gets
disabled . |
protected void |
onEnabled()
Called when this mode gets
enabled . |
void |
removeSelection(T item)
Removes an item from the current selection.
|
void |
setModel(IObservableCollection<T> value)
Sets the model that describes the domain for the selection.
|
void |
setSelectionModel(ISelectionModel<T> value)
Sets the selection model that determines which items are selected.
|
add, getCanvas, install, isEnabled, remove, setEnabled, unInstall
public SelectionIndicatorManager(CanvasControl canvas, IObservableCollection<T> model, ISelectionModel<T> selectionModel)
canvas
- The canvas to add the selection marks to.model
- The model that holds the domain.selectionModel
- The model that determines which items are selected.public ICanvasObject addSelection(T item)
item
- The item whose selection decorator will added.protected ICanvasObjectGroup getCanvasObjectGroup(T item)
ModelManager.install(Object)
to retrieve the installer for a given item.
This implementation always returns the SelectionGroup
of the Canvas
of this instance.
getCanvasObjectGroup
in class ModelManager<T extends ILookup>
item
- The item to find a canvas object group for.ICanvasObjectGroup
or null
protected ICanvasObjectInstaller getInstaller(T item)
ModelManager.install(Object)
to retrieve the installer for a given item.
This implementation uses the ILookup.lookup(java.lang.Class)
of the item to retrieve an ISelectionIndicatorInstaller
instance.
getInstaller
in class ModelManager<T extends ILookup>
item
- The item to find an installer for.null
public final IObservableCollection<T> getModel()
Only item contained in this model can be rendered as selected.
setModel(IObservableCollection)
public final ISelectionModel<T> getSelectionModel()
May be null
, in which case no elements are considered selected.
setSelectionModel(ISelectionModel)
protected void onDisabled()
ModelManager
disabled
.onDisabled
in class ModelManager<T extends ILookup>
protected void onEnabled()
ModelManager
enabled
.onEnabled
in class ModelManager<T extends ILookup>
public void removeSelection(T item)
item
- The item whose selection decorator will be removed.public final void setModel(IObservableCollection<T> value)
Only item contained in this model can be rendered as selected.
value
- The Model to set.getModel()
public final void setSelectionModel(ISelectionModel<T> value)
May be null
, in which case no elements are considered selected.
value
- The SelectionModel to set.getSelectionModel()