When you want to associate a specific behavior with an
object, you can use an object interactor (class IlvObjectInteractor
and
its subclasses). Whenever an event is received by a manager view that
has no associated view interactor, the manager attempts to send it
to an object by a call to an attached object interactor. If there
is an object at the event location, and if this object is connected
to an object interactor, the manager sends the event to that interactor.
If the interactor does not manage this event, or if the situation
is not applicable, the manager tries to handle the event by means
of accelerators.
You can create an IlvObjectInteractor
instance
and bind it to an object or a set of objects using the IlvGraphic
method setObjectInteractor
.
As soon as this binding occurs, the object receives user events and
deals with them, therefore it is the interactor and not the object
itself that manages these events.
Querying, setting, or removing an object interactor can
be done by means of calls to the following methods on the IlvGraphic
instance:
IlvObjectInteractor getObjectInteractor()
void setObjectInteractor(IlvObjectInteractor interactor)
An instance of
IlvObjectInteractor
can
be shared by several graphic objects. This allows you to reduce the
amount of memory needed to handle the same interaction on a large
number of graphic objects. To share the same object interactor instance,
do not use
new
to create your interactor;
use the
Get method of the class
IlvObjectInteractor
.