| | | | Browse by category |
Question
I set an object interactor to my object but it does not work. How do I make my IlvManagerViewInteractor
work with object interactors?
Answer
If you use an IlvManagerView
, and you want to set an object interactor (IlvObjectInteractor
or subclass) and a view interactor (IlvManagerViewInteractor
or subclass) at the same time, only your view interactor will be called. You will find an explanation in the RogueWave JViews documentation, in the description of the IlvObjectInteractor
:
"When an event is received by a manager view that has no associated view interactor, the event is dispatched to the manager (see IlvManagerView.processEvent(AWTEvent)
and IlvManager.processEvent(AWTEvent, IlvManagerView)
) The manager attempts to send it to the object interactor of the graphic object located at the mouse position."
In other words, your IlvManagerViewInteractor
hides your object interactor.
If you write your own view interactor and want your object interactors to be taken into account, you must pass the event managed by the view interactor to the associated IlvManager
in the method processEvent
of the object interactor.
Sample code:
protected void processMouseEvent (MouseEvent event) { // Forward to the manager for object interactors boolean processed = getManager().processEvent(event, getManagerView()); // Call the listeners attached to the interactor. if (!processed ) super.processMouseEvent(event); }
Starting with JViews version 6.0, IlvSelectInteractor
offers the option for IlvObjectInteractor
to be called on the target IlvGraphic
before completing its usual event dispatching. This is done through the lvSelectInteractor.setObjectInteractorEnabled(boolean)
. See IlvSelectInteractor
documentation for more details.
Similarly, RogueWave JTGO IltSelectInteractor
will invoke the object interactor, if existed, when the InvokeObjectInteractor
property is set to true.
This can be enable via the method IltSelectInteractor.setInvokeObjectInteractor(true)