T
- The type of the items.public class HighlightIndicatorManager<T extends ILookup> extends ModelManager<T>
ModelManager
implementation that manages the visual decorations of highlighted elements in a canvas.
For each item that should be highlighted this class uses the ILookup
mechanism of the items to lookup an IHighlightIndicatorInstaller
implementation which will do the actual installation of the decoration in the canvas.
Constructor and Description |
---|
HighlightIndicatorManager(CanvasControl canvas)
Creates an instance that for all selected items in the model dynamically installs a highlight decoration.
|
HighlightIndicatorManager(CanvasControl canvas,
ISelectionModel<T> selectionModel)
Creates an instance that for all selected items in the model dynamically installs a highlight decoration.
|
Modifier and Type | Method and Description |
---|---|
void |
addHighlight(T item)
Adds another highlight.
|
void |
clearHighlights()
Removes all highlights.
|
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. |
ISelectionModel<T> |
getSelectionModel()
Gets the selection model that determines which items are highlighted.
|
protected void |
onDisabled()
Called when this mode gets
disabled . |
protected void |
onEnabled()
Called when this mode gets
enabled . |
void |
removeHighlight(T item)
Removes an item from the current highlight selection.
|
void |
setSelectionModel(ISelectionModel<T> value)
Sets the selection model that determines which items are highlighted.
|
add, getCanvas, install, isEnabled, remove, setEnabled, unInstall
public HighlightIndicatorManager(CanvasControl canvas)
canvas
- The canvas to add the selection marks to.public HighlightIndicatorManager(CanvasControl canvas, ISelectionModel<T> selectionModel)
canvas
- The canvas to add the selection marks to.selectionModel
- The model that determines which items are highlighted.public void addHighlight(T item)
item
- The item to highlight.public void clearHighlights()
protected ICanvasObjectGroup getCanvasObjectGroup(T item)
ModelManager.install(Object)
to retrieve the installer for a given item.
This implementation always returns the HighlightGroup
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 IHighlightIndicatorInstaller
instance.
getInstaller
in class ModelManager<T extends ILookup>
item
- The item to find an installer for.null
public final ISelectionModel<T> getSelectionModel()
May be null
, in which case no elements are considered highlighted.
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 removeHighlight(T item)
item
- The item whose highlight decorator will be removed.public final void setSelectionModel(ISelectionModel<T> value)
May be null
, in which case no elements are considered highlighted.
value
- The SelectionModel to set.getSelectionModel()