public class RectangleIndicatorInstaller extends Object implements ISelectionIndicatorInstaller, IHighlightIndicatorInstaller, IFocusIndicatorInstaller
ISelectionIndicatorInstaller
, IFocusIndicatorInstaller
and IHighlightIndicatorInstaller
that draws a rectangle using a Template
.
In the ICanvasObjectInstaller.addCanvasObject(ICanvasContext, ICanvasObjectGroup, Object)
method, this
implementation will add either a fixed IRectangle
instance that is passed in the constructor as a parameter or
the return value of the method getRectangle(Object)
if the former does not exist (i.e. the parameterless
constructor was used to instantiate this class).
Modifier and Type | Field and Description |
---|---|
static ResourceKey |
FOCUS_TEMPLATE_KEY
A
ResourceKey that will be used to find the IVisualTemplate for drawing the focus indicator. |
static ResourceKey |
HIGHLIGHT_TEMPLATE_KEY
A
ResourceKey that will be used to find the IVisualTemplate for drawing the highlight indicator. |
static ResourceKey |
SELECTION_TEMPLATE_KEY
A
ResourceKey that will be used to find the IVisualTemplate for drawing the selection indicator. |
Constructor and Description |
---|
RectangleIndicatorInstaller()
Initializes a new instance of the
RectangleIndicatorInstaller class without fixed bounds. |
RectangleIndicatorInstaller(IRectangle fixedBounds)
Initializes a new instance of the
RectangleIndicatorInstaller class with fixed bounds and a
ResourceKey . |
RectangleIndicatorInstaller(IRectangle fixedBounds,
ResourceKey resourceKey)
Initializes a new instance of the
RectangleIndicatorInstaller class with fixed bounds and a
ResourceKey . |
Modifier and Type | Method and Description |
---|---|
ICanvasObject |
addCanvasObject(ICanvasContext context,
ICanvasObjectGroup group,
Object item)
This the main method of the interface that performs the installation of an item's visual representation in the
canvas
by adding ICanvasObject s. |
protected IRectangle |
getRectangle(Object userObject)
Factory method that returns an
IRectangle for a given user object. |
IVisualTemplate |
getTemplate()
Gets the
IVisualTemplate to use for this indicator. |
protected ResourceKey |
getTemplateKey()
Gets the
ResourceKey that will be used to find the IVisualTemplate to use for drawing the rectangle. |
void |
setTemplate(IVisualTemplate value)
Sets the
IVisualTemplate to use for this indicator. |
public static final ResourceKey FOCUS_TEMPLATE_KEY
ResourceKey
that will be used to find the IVisualTemplate
for drawing the focus indicator.public static final ResourceKey HIGHLIGHT_TEMPLATE_KEY
ResourceKey
that will be used to find the IVisualTemplate
for drawing the highlight indicator.public static final ResourceKey SELECTION_TEMPLATE_KEY
ResourceKey
that will be used to find the IVisualTemplate
for drawing the selection indicator.public RectangleIndicatorInstaller()
RectangleIndicatorInstaller
class without fixed bounds.
The object that is created through this constructor relies on the value returned by the getRectangle(Object)
method to add
to the ICanvasObjectGroup
in
the ICanvasObjectInstaller.addCanvasObject(ICanvasContext, ICanvasObjectGroup, Object)
method.
public RectangleIndicatorInstaller(IRectangle fixedBounds)
RectangleIndicatorInstaller
class with fixed bounds and a
ResourceKey
.
The given IOrientedRectangle
is used for all items as object that is added to the ICanvasObjectGroup
in the ICanvasObjectInstaller.addCanvasObject(ICanvasContext, ICanvasObjectGroup, Object)
method.
If the Template
property is not set, the resourceKey
is used to lookup a IVisualTemplate
in the resources of the CanvasControl
. If there is none, a default templated is used.
public RectangleIndicatorInstaller(IRectangle fixedBounds, ResourceKey resourceKey)
RectangleIndicatorInstaller
class with fixed bounds and a
ResourceKey
.
The given IOrientedRectangle
is used for all items as object that is added to the ICanvasObjectGroup
in the ICanvasObjectInstaller.addCanvasObject(ICanvasContext, ICanvasObjectGroup, Object)
method.
If the Template
property is not set, the resourceKey
is used to lookup a IVisualTemplate
in the resources of the CanvasControl
. If there is none, a default templated is used.
public final ICanvasObject addCanvasObject(ICanvasContext context, ICanvasObjectGroup group, Object item)
ICanvasObjectInstaller
canvas
by adding ICanvasObject
s.addCanvasObject
in interface ICanvasObjectInstaller
context
- The context that contains the information required to install the visual representation.group
- The canvas object group to add the newly generated ICanvasObject
to.item
- The item to install.ICanvasObject
for the item's visual representation. null
if nothing was installed.protected IRectangle getRectangle(Object userObject)
IRectangle
for a given user object.
This method is called for the object to add
to the
ICanvasObjectGroup
, if there are no fixed bounds set on this instance (i.e. the parameterless constructor
was used to instantiate this class).
This implementation returns null for every given object.
IRectangle
for the given item that is added
to the ICanvasObjectGroup
.public final IVisualTemplate getTemplate()
IVisualTemplate
to use for this indicator.
If this property is not set, the ResourceKey
passed in the constructor is used to lookup a IVisualTemplate
in the resources of the CanvasControl
. If there is none, a default templated is used.
setTemplate(IVisualTemplate)
protected ResourceKey getTemplateKey()
ResourceKey
that will be used to find the IVisualTemplate
to use for drawing the rectangle.ResourceKey
that can be used to find an instance of IVisualTemplate
or null
.public final void setTemplate(IVisualTemplate value)
IVisualTemplate
to use for this indicator.
If this property is not set, the ResourceKey
passed in the constructor is used to lookup a IVisualTemplate
in the resources of the CanvasControl
. If there is none, a default templated is used.
value
- The Template to set.getTemplate()