public class OrientedRectangleIndicatorInstaller extends Object implements ISelectionIndicatorInstaller, IHighlightIndicatorInstaller, IFocusIndicatorInstaller
ISelectionIndicatorInstaller
, IFocusIndicatorInstaller
and IHighlightIndicatorInstaller
implementations that draws an oriented rectangle using a Template
.
In the ICanvasObjectInstaller.addCanvasObject(ICanvasContext, ICanvasObjectGroup, Object)
method, this
implementation will add either a fixed IOrientedRectangle
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 |
---|
OrientedRectangleIndicatorInstaller()
Initializes a new instance of the
OrientedRectangleIndicatorInstaller class without fixed bounds. |
OrientedRectangleIndicatorInstaller(IOrientedRectangle fixedBounds)
Initializes a new instance of the
OrientedRectangleIndicatorInstaller class with fixed bounds and a
ResourceKey . |
OrientedRectangleIndicatorInstaller(IOrientedRectangle fixedBounds,
ResourceKey templateKey)
Initializes a new instance of the
OrientedRectangleIndicatorInstaller 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 IOrientedRectangle |
getRectangle(Object item)
Factory method that returns an
IOrientedRectangle for a given user object. |
IVisualTemplate |
getTemplate()
Gets the
IVisualTemplate to use for this indicator. |
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 OrientedRectangleIndicatorInstaller()
OrientedRectangleIndicatorInstaller
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 OrientedRectangleIndicatorInstaller(IOrientedRectangle fixedBounds)
OrientedRectangleIndicatorInstaller
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 templateKey
is used to lookup a IVisualTemplate
in the resources of the CanvasControl
. If there is none, a default templated is used.
public OrientedRectangleIndicatorInstaller(IOrientedRectangle fixedBounds, ResourceKey templateKey)
OrientedRectangleIndicatorInstaller
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 templateKey
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 IOrientedRectangle getRectangle(Object item)
IOrientedRectangle
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.
IOrientedRectangle
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)
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()