ilog.cpl.interactor
Class IlpDefaultViewInteractor

java.lang.Object
  extended by ilog.cpl.interactor.IlpAbstractInteractor
      extended by ilog.cpl.interactor.IlpDefaultViewInteractor
All Implemented Interfaces:
IlpInteractor, IlpViewInteractor
Direct Known Subclasses:
IlpDefaultTableViewInteractor, IlpViewsViewInteractor

public class IlpDefaultViewInteractor
extends IlpAbstractInteractor
implements IlpViewInteractor

Provides a default implementation for 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.
Otherwise, the view interactor attempts to handle the event. To do so, it translates atomic input events into Swing action invocations in a given context, recognizing higher-level gestures when applicable, and invoking the associated Swing actions.

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.

Since:
JTGO 3.0
See Also:
IlpInteractor, IlpViewInteractionContext, IlpViewActionEvent, IlpObjectInteractor, IlpGraphicController

Constructor Summary
IlpDefaultViewInteractor()
          Creates a default view interactor.
 
Method Summary
 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.
 
Methods inherited from class ilog.cpl.interactor.IlpAbstractInteractor
createActionEvent, displayPopupMenu, getAction, getAction, getActionEventFactory, getGestureAction, getGestureAction, getGestureButton, getGestureModifiers, getKeyStrokeAction, getPopupMenuFactory, manageSelection, processGesture, processKeyEvent, processMouseOrFocusEvent, setAction, setAction, setActionEventFactory, setGestureAction, setGestureAction, setKeyStrokeAction, setPopupMenuFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ilog.cpl.interactor.IlpInteractor
getGestureAction, getGestureButton, getGestureModifiers, getKeyStrokeAction, getPopupMenuFactory, setGestureAction, setKeyStrokeAction, setPopupMenuFactory
 

Constructor Detail

IlpDefaultViewInteractor

public IlpDefaultViewInteractor()
Creates a default view interactor.

Method Detail

GetDefaultActionEventFactory

public static IlpActionEventFactory GetDefaultActionEventFactory()
Returns the action event factory that is used by default in this object interactor.

The default action event factory creates IlpViewActionEvent events.

Since:
JTGO 4.0
See Also:
IlpViewActionEvent

attach

public void attach(IlpGraphicController controller)
Attaches this view interactor to the specified controller.

Specified by:
attach in interface IlpViewInteractor
Parameters:
controller - The controller to which this interactor is to be attached.
Throws:
IllegalStateException - if this interactor is already attached to a controller.
IllegalArgumentException - if the given controller is null.
See Also:
detach()

detach

public void detach()
Detaches this view interactor from its controller.

Specified by:
detach in interface IlpViewInteractor
See Also:
attach(ilog.cpl.graphic.IlpGraphicController)

getController

public IlpGraphicController getController()
Retrieves the controller to which this interactor is attached.

Specified by:
getController in interface IlpViewInteractor

setUsingObjectInteractor

public void setUsingObjectInteractor(boolean use)
Specifies whether the events that occur on an IlpGraphic or a representation object should be delegated to an IlpObjectInteractor.

Specified by:
setUsingObjectInteractor in interface IlpViewInteractor
Parameters:
use - Specifies whether the interactor delegates events.
See Also:
isUsingObjectInteractor()

isUsingObjectInteractor

public boolean isUsingObjectInteractor()
Indicates whether the events that occur on an IlpGraphic or a representation object are delegated to an IlpObjectInteractor. The default value is true.

Specified by:
isUsingObjectInteractor in interface IlpViewInteractor
See Also:
setUsingObjectInteractor(boolean)

getInteractionState

protected IlpInteractionState getInteractionState(IlpInteractionContext ctxt)
Looks up the interaction state corresponding to the given context. In view interactors, the interaction state is stored in the interactor.

Specified by:
getInteractionState in class IlpAbstractInteractor
Parameters:
ctxt - The context where the event occurred.

delegateEvent

protected boolean delegateEvent(IlpInteractionContext ctxt,
                                MouseEvent e)
Redefined to delegate event management to an object interactor. The delegation is done if:

Overrides:
delegateEvent in class IlpAbstractInteractor
Parameters:
ctxt - The interaction context used to store persistent information.
e - The mouse event to be managed.
Returns:
true if the given event has been handled by a sub-interactor.
See Also:
isUsingObjectInteractor()

processEvent

public boolean processEvent(IlpInteractionContext ctxt,
                            AWTEvent event)
Processes the events applying to the view that this interactor is attached to.

Specified by:
processEvent in interface IlpInteractor
Overrides:
processEvent in class IlpAbstractInteractor
Parameters:
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.
Throws:
IllegalArgumentException - if the given context is not and instance of IlpViewInteractionContext.
See Also:
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

createActionEvent

protected ActionEvent createActionEvent(IlpInteractionContext ctxt,
                                        IlpInteractionState state,
                                        int modifiers)
Deprecated. Please use IlpActionEventFactory instead.

Returns a new ActionEvent. Redefined to provide an IlpViewActionEvent instance.

Overrides:
createActionEvent in class IlpAbstractInteractor
Parameters:
ctxt - The context where the event occurred.
state - The interaction's state.
modifiers - The modifiers associated with the recognized gesture.
See Also:
IlpAbstractInteractor.setActionEventFactory(ilog.cpl.interactor.IlpActionEventFactory)
Deprecated Since:
JTGO 4.0


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.