public class IlpDefaultViewInteractor extends IlpAbstractInteractor implements IlpViewInteractor
IlpViewInteractor
.
View interactors manage interactions with a graphic view.
They are attached to one particular controller at a time.
When an event occurs, the view interactor first determines whether a
graphic object is located at the event position.
If so, and if the graphic object has an object interactor,
the event is dispatched to the object interactor.
When an action is triggered by a view interactor, the action
event received by the action is a view action event IlpViewActionEvent
.
A view interactor is not stateless but nevertheless, it uses an
IlpDefaultViewInteractionContext
which stores information that the interactor
needs.
IlpInteractor
,
IlpViewInteractionContext
,
IlpViewActionEvent
,
IlpObjectInteractor
,
IlpGraphicController
Constructor and Description |
---|
IlpDefaultViewInteractor()
Creates a default view interactor.
|
Modifier and Type | Method and Description |
---|---|
void |
attach(IlpGraphicController controller)
Attaches this view interactor to the specified controller.
|
protected ActionEvent |
createActionEvent(IlpInteractionContext ctxt,
IlpInteractionState state,
int modifiers)
Deprecated.
Please use
IlpActionEventFactory instead. |
protected boolean |
delegateEvent(IlpInteractionContext ctxt,
MouseEvent e)
Redefined to delegate event management to an object interactor.
|
void |
detach()
Detaches this view interactor from its controller.
|
IlpGraphicController |
getController()
Retrieves the controller to which this interactor is attached.
|
static IlpActionEventFactory |
GetDefaultActionEventFactory()
Returns the action event factory that is used by default in this
object interactor.
|
protected IlpInteractionState |
getInteractionState(IlpInteractionContext ctxt)
Looks up the interaction state corresponding to the given context.
|
boolean |
isUsingObjectInteractor()
Indicates whether the events that occur on an
IlpGraphic
or a representation object are delegated to an IlpObjectInteractor . |
boolean |
processEvent(IlpInteractionContext ctxt,
AWTEvent event)
Processes the events applying to the view that this interactor is attached to.
|
void |
setUsingObjectInteractor(boolean use)
Specifies whether the events that occur on an
IlpGraphic
or a representation object should be delegated to an
IlpObjectInteractor . |
createActionEvent, displayPopupMenu, getAction, getAction, getActionEventFactory, getGestureAction, getGestureAction, getGestureButton, getGestureModifiers, getKeyStrokeAction, getPopupMenuFactory, isSelectable, manageSelection, processGesture, processKeyEvent, processMouseOrFocusEvent, setAction, setAction, setActionEventFactory, setGestureAction, setGestureAction, setKeyStrokeAction, setPopupMenuFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGestureAction, getGestureAction, getGestureButton, getGestureModifiers, getKeyStrokeAction, getPopupMenuFactory, setGestureAction, setGestureAction, setKeyStrokeAction, setPopupMenuFactory
public IlpDefaultViewInteractor()
public static IlpActionEventFactory GetDefaultActionEventFactory()
The default action event factory creates IlpViewActionEvent
events.
IlpViewActionEvent
public void attach(IlpGraphicController controller)
attach
in interface IlpViewInteractor
controller
- The controller to which this interactor is to be attached.IllegalStateException
- if this interactor is already attached to a controller.IllegalArgumentException
- if the given controller is
null
.detach()
public void detach()
detach
in interface IlpViewInteractor
attach(ilog.cpl.graphic.IlpGraphicController)
public IlpGraphicController getController()
getController
in interface IlpViewInteractor
public void setUsingObjectInteractor(boolean use)
IlpGraphic
or a representation object should be delegated to an
IlpObjectInteractor
.setUsingObjectInteractor
in interface IlpViewInteractor
use
- Specifies whether the interactor delegates events.isUsingObjectInteractor()
public boolean isUsingObjectInteractor()
IlpGraphic
or a representation object are delegated to an IlpObjectInteractor
.
The default value is true
.isUsingObjectInteractor
in interface IlpViewInteractor
setUsingObjectInteractor(boolean)
protected IlpInteractionState getInteractionState(IlpInteractionContext ctxt)
getInteractionState
in class IlpAbstractInteractor
ctxt
- The context where the event occurred.protected boolean delegateEvent(IlpInteractionContext ctxt, MouseEvent e)
isUsingObjectInteractor()
returns true
,IlpGraphic
,delegateEvent
in class IlpAbstractInteractor
ctxt
- The interaction context used to store persistent information.e
- The mouse event to be managed.true
if the given event has been handled by a
sub-interactor.isUsingObjectInteractor()
public boolean processEvent(IlpInteractionContext ctxt, AWTEvent event)
processEvent
in interface IlpInteractor
processEvent
in class IlpAbstractInteractor
ctxt
- The view interaction context used to store information
between successive calls to this method.event
- The event which occurred over the view that this interactor
is attached to.IllegalArgumentException
- if the given context is not and instance of
IlpViewInteractionContext
.IlpAbstractInteractor.processKeyEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.KeyEvent)
,
IlpAbstractInteractor.delegateEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.MouseEvent)
,
IlpAbstractInteractor.displayPopupMenu(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.MouseEvent)
,
IlpAbstractInteractor.processMouseOrFocusEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.AWTEvent)
,
IlpInteractionContext
@Deprecated protected ActionEvent createActionEvent(IlpInteractionContext ctxt, IlpInteractionState state, int modifiers)
IlpActionEventFactory
instead.IlpViewActionEvent
instance.createActionEvent
in class IlpAbstractInteractor
ctxt
- The context where the event occurred.state
- The interaction's state.modifiers
- The modifiers associated with the recognized gesture.IlpAbstractInteractor.setActionEventFactory(ilog.cpl.interactor.IlpActionEventFactory)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.