public abstract class IlpAbstractInteractor extends Object implements IlpInteractor
IlpInteractor.
 This implementation is able to manage two kinds of interactions:
The method processEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.AWTEvent) is called by an
 IlpGraphicController each time an event occurs
 on the IlpGraphicView this controller is
 attached to. This method recognizes IlpGestures from mouse or focus events.
 
 
This interactor triggers registered actions when specific gestures or key strokes are recognized.
Register actions as follows:
setGestureAction(ilog.cpl.interactor.IlpGesture, javax.swing.Action) to register an action
     to be triggered when a specific gesture is recognized.setKeyStrokeAction(javax.swing.KeyStroke, javax.swing.Action) to register an action
     to be triggered when a specific keystroke is recognizedIlpGesture, 
processEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.AWTEvent), 
IlpGraphicView, 
IlpGraphicController| Constructor and Description | 
|---|
| IlpAbstractInteractor() | 
| Modifier and Type | Method and Description | 
|---|---|
| protected ActionEvent | createActionEvent(Action action,
                 IlpInteractionContext ctxt,
                 IlpInteractionState state,
                 int modifiers)Returns a new  ActionEvent. | 
| protected ActionEvent | createActionEvent(IlpInteractionContext ctxt,
                 IlpInteractionState state,
                 int modifiers)Deprecated. 
 Please use  IlpActionEventFactoryinstead. | 
| protected boolean | delegateEvent(IlpInteractionContext ctxt,
             MouseEvent e)This method may be redefined by subclasses if the event process
 needs to be delegated to a sub-interactor. | 
| protected boolean | displayPopupMenu(IlpInteractionContext ctxt,
                MouseEvent e)Displays a pop-up menu on the source and at the location given by
 the specified mouse event if this
 event corresponds to a pop-up trigger and a pop-up menu factory is set
 for this interactor and if this factory does not return  null. | 
| IlpInteractorAction[] | getAction()Returns the list of interactor actions supported by this instance. | 
| IlpInteractorAction | getAction(int index)Returns the interactor action supported by this instance in the given position. | 
| IlpActionEventFactory | getActionEventFactory()Retrieves the  ActionEventfactory used to create events
 when actions are triggered by this interactor. | 
| Action | getGestureAction(IlpGesture gesture)Returns the customized action associated with the given gesture, if any. | 
| Action | getGestureAction(IlpGesture gesture,
                int modifiers)Returns the customized action associated with the given gesture, if any. | 
| int | getGestureButton(IlpGesture gesture)Retrieves the mouse button that will trigger the specified gesture. | 
| int | getGestureModifiers(IlpGesture gesture)Deprecated. 
 Please use method  setGestureAction(ilog.cpl.interactor.IlpGesture, javax.swing.Action)and (@link #getGestureAction}
             to register and retrieve actions associated to gestures and modifiers. | 
| protected abstract IlpInteractionState | getInteractionState(IlpInteractionContext ctxt)Looks up the interaction state corresponding to the given context. | 
| Action | getKeyStrokeAction(KeyStroke keyStroke)Retrieves the customized action associated with the given keystroke,
 if any. | 
| IlpPopupMenuFactory | getPopupMenuFactory()Retrieves the pop-up menu factory used to create a pop-up menu using
 this interactor, if any. | 
| protected boolean | isSelectable(IlpInteractionContext ctx,
            IlpRepresentationObject ro)Identifies whether an object can be selected or not, this method is 
 used in conjunction with 
  manageSelection(IlpInteractionContext, IlpRepresentationObjectSelectionModel, IlpRepresentationObject). | 
| protected void | manageSelection(IlpInteractionContext ctxt,
               IlpRepresentationObjectSelectionModel selectionModel,
               IlpRepresentationObject ro)This method is called before displaying a pop-up menu to update the
 selection. | 
| boolean | processEvent(IlpInteractionContext ctxt,
            AWTEvent event)This method is called by an  IlpGraphicControllereach time an event occurs on theIlpGraphicViewthis controller is attached to. | 
| protected boolean | processGesture(IlpGesture gesture,
              IlpInteractionContext ctxt,
              IlpInteractionState state,
              AWTEvent e)Manages a completely recognized gesture, trying to trigger the
 associated action. | 
| protected boolean | processKeyEvent(IlpInteractionContext ctxt,
               KeyEvent event)Manages the key events occurring on the entity to which this interactor
 is attached. | 
| protected boolean | processMouseOrFocusEvent(IlpInteractionContext ctxt,
                        AWTEvent event)This method recognizes gestures from mouse or focus events and tries to
 trigger the associated action, if any. | 
| void | setAction(IlpInteractorAction[] actions)Sets the actions supported by this interactor. | 
| void | setAction(int index,
         IlpInteractorAction action)Sets an action supported by this interactor. | 
| void | setActionEventFactory(IlpActionEventFactory factory)Sets the  ActionEventfactory used to create events
 when actions are triggered by this interactor. | 
| void | setGestureAction(IlpGesture gesture,
                Action action)Associates an action with a given gesture. | 
| void | setGestureAction(IlpGesture gesture,
                int modifiers,
                Action action)Associates an action with a given gesture. | 
| void | setKeyStrokeAction(KeyStroke keyStroke,
                  Action action)Associates an action with the specified keystroke. | 
| void | setPopupMenuFactory(IlpPopupMenuFactory factory)Sets the pop-up menu factory to be used to create a pop-up menu. | 
public IlpPopupMenuFactory getPopupMenuFactory()
getPopupMenuFactory in interface IlpInteractorsetPopupMenuFactory(ilog.cpl.interactor.IlpPopupMenuFactory)public void setPopupMenuFactory(IlpPopupMenuFactory factory)
setPopupMenuFactory in interface IlpInteractorfactory - The factory to be used to create a pop-up menu.
 If this parameter equals null, no pop-up menu will be
 displayed.getPopupMenuFactory()public IlpActionEventFactory getActionEventFactory()
ActionEvent factory used to create events
 when actions are triggered by this interactor.ActionEvents.setActionEventFactory(ilog.cpl.interactor.IlpActionEventFactory), 
createActionEvent(ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, int), 
IlpActionEventFactorypublic void setActionEventFactory(IlpActionEventFactory factory)
ActionEvent factory used to create events
 when actions are triggered by this interactor.factory - The factory to be used to create ActionEvents.
 If this parameter equals null, events will not be
 created.getActionEventFactory(), 
createActionEvent(ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, int), 
IlpActionEventFactorypublic Action getGestureAction(IlpGesture gesture)
This method returns the action associated with the given gestures without any modifiers.
getGestureAction in interface IlpInteractorgesture - The gesture with which action is associated.setGestureAction(ilog.cpl.interactor.IlpGesture, javax.swing.Action)public Action getGestureAction(IlpGesture gesture, int modifiers)
getGestureAction in interface IlpInteractorgesture - The gesture with which action is associated.modifiers - The gesture modifiers which specify when an action should
                  be triggered.
 
 Note: In the modifiers argument, due to overlap in the values of 
 ALT_MASK/BUTTON2_MASK and META_MASK/BUTTON3_MASK,
 it is recommended the use of extended modifiers such as 
 InputEvent.ALT_DOWN_MASK instead of InputEvent.ALT_MASK, 
 and InputEvent.META_DOWN_MASK instead of InputEvent.META_MASK.
setGestureAction(ilog.cpl.interactor.IlpGesture, javax.swing.Action), 
InputEventpublic void setGestureAction(IlpGesture gesture, Action action)
setGestureAction in interface IlpInteractorgesture - The gesture which triggers an action.action - The action to be triggered by the specified gesture.
                If this parameter equals null, the 
                specified gesture triggers no action.IllegalArgumentException - if the given gesture equals
 null.getGestureAction(ilog.cpl.interactor.IlpGesture)public void setGestureAction(IlpGesture gesture, int modifiers, Action action)
setGestureAction in interface IlpInteractorgesture - The gesture which triggers an action.modifiers - The gesture modifiers which trigger an action.action - The action to be triggered by the specified gesture.
                  If this parameter equals null, the specified 
                  gesture triggers no action.IllegalArgumentException - if the given gesture equals
 null.
 Note: In the modifiers argument, InputEvent.ALT_DOWN_MASK
 should be used instead of InputEvent.ALT_MASK, and
 InputEvent.META_DOWN_MASK
 should be used instead of InputEvent.META_MASK,
 because the values of ALT_MASK/BUTTON2_MASK and
 META_MASK/BUTTON3_MASK overlap.
 
 
The following example illustrates the use of this method that registers an action that is triggered when button 1 is clicked with the CTRL key pressed.
setGestureAction (IlpGesture.BUTTON1_CLICKED, InputEvent.CTRL_DOWN_MASK, action);
getGestureAction(ilog.cpl.interactor.IlpGesture), 
InputEventpublic int getGestureButton(IlpGesture gesture)
Retrieves the mouse button that will trigger the specified gesture.
This default implementation returns 
 MouseEvent.BUTTON1_DOWN_MASK,
 MouseEvent.BUTTON2_DOWN_MASK, 
 MouseEvent.BUTTON3_DOWN_MASK or 
 MouseEvent.NOBUTTON depending on the value of the given 
 gesture.
Modifications should be implemented by redefining this method.
 Basic gestures do not use this method since they implicitly involve
 a button (IlpGesture.BUTTON1_CLICKED, for instance).
getGestureButton in interface IlpInteractorgesture - The gesture concerned.@Deprecated public int getGestureModifiers(IlpGesture gesture)
setGestureAction(ilog.cpl.interactor.IlpGesture, javax.swing.Action) and (@link #getGestureAction}
             to register and retrieve actions associated to gestures and modifiers.0.
 Modifications should be implemented by redefining this method.
Note: In the modifiers argument, due to overlap in the values of 
 ALT_MASK/BUTTON2_MASK and META_MASK/BUTTON3_MASK,
 it is recommended the use of extended modifiers such as 
 InputEvent.ALT_DOWN_MASK instead of InputEvent.ALT_MASK, 
 and InputEvent.META_DOWN_MASK instead of InputEvent.META_MASK.
getGestureModifiers in interface IlpInteractorgesture - The gesture concerned.public Action getKeyStrokeAction(KeyStroke keyStroke)
getKeyStrokeAction in interface IlpInteractorkeyStroke - The keystroke with which action is associated.setKeyStrokeAction(javax.swing.KeyStroke, javax.swing.Action)public void setKeyStrokeAction(KeyStroke keyStroke, Action action)
setKeyStrokeAction in interface IlpInteractorkeyStroke - The keystroke which triggers an action.action - The action to be triggered by the specified gesture.
 If this parameter equals null, no action will be triggered.IllegalArgumentException - if the given keystroke equals
 null.getKeyStrokeAction(javax.swing.KeyStroke)public void setAction(IlpInteractorAction[] actions)
IlpGestureAction, 
IlpKeyStrokeActionpublic void setAction(int index,
                      IlpInteractorAction action)
IlpInteractorActionpublic IlpInteractorAction[] getAction()
public IlpInteractorAction getAction(int index)
index - Index of the action in the interactor collectionpublic boolean processEvent(IlpInteractionContext ctxt, AWTEvent event)
IlpGraphicController
 each time an event occurs on the IlpGraphicView
 this controller is attached to.
 The method does the following:
processKeyEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.KeyEvent) if the event
     is a key event.delegateEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.MouseEvent),
     or display a pop-up menu, calling displayPopupMenu(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.MouseEvent).processMouseOrFocusEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.AWTEvent).The given IlpInteractionContext will be used to store
 contextual information about the event such as partially recognized
 gestures or mouse position where event occurred.
processEvent in interface IlpInteractorctxt - The view where the event occurred.event - The event that occurred.processKeyEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.KeyEvent), 
delegateEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.MouseEvent), 
displayPopupMenu(ilog.cpl.interactor.IlpInteractionContext, java.awt.event.MouseEvent), 
processMouseOrFocusEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.AWTEvent), 
IlpInteractionContextprotected boolean processMouseOrFocusEvent(IlpInteractionContext ctxt, AWTEvent event)
The event handling is as follows:
processGesture(ilog.cpl.interactor.IlpGesture, ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, java.awt.AWTEvent) to remove
         the gesture from the incomplete gesture list and tries to trigger the
         associated action.Note:This method may be extended by subclasses to recognize more gestures than the basic ones.
ctxt - The interaction context used to store persistent information.event - The event that occurred.true if a complete gesture has been recognized and
         the method processGesture(ilog.cpl.interactor.IlpGesture, ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, java.awt.AWTEvent) returned true,
         false otherwise.processGesture(ilog.cpl.interactor.IlpGesture, ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, java.awt.AWTEvent), 
IlpGesture, 
IlpInteractionContext, 
setGestureAction(ilog.cpl.interactor.IlpGesture, javax.swing.Action)protected boolean processKeyEvent(IlpInteractionContext ctxt, KeyEvent event)
Note: An action associated with a keystroke will be
 triggered on KEY_PRESSED, KEY_RELEASED or
 KEY_TYPED, depending on the way the registered keystroke
 has been constructed:
ctxt - The context where the event occurred.event - The key event that occurred.processEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.AWTEvent), 
setKeyStrokeAction(javax.swing.KeyStroke, javax.swing.Action)protected boolean delegateEvent(IlpInteractionContext ctxt, MouseEvent e)
false.ctxt - The interaction context of the event.e - The mouse event to be delegated.true if the given event has been handled by a
 sub-interactor.processEvent(ilog.cpl.interactor.IlpInteractionContext, java.awt.AWTEvent), 
IlpInteractionContextprotected boolean displayPopupMenu(IlpInteractionContext ctxt, MouseEvent e)
null.
 When a pop-up menu is triggered, the selection is updated by calling the
 method manageSelection(ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.util.selection.IlpRepresentationObjectSelectionModel, ilog.cpl.model.IlpRepresentationObject).ctxt - The interaction context of the event.e - The mouse event which may correspond to a pop-up trigger.true if a pop-up menu has been shown.setPopupMenuFactory(ilog.cpl.interactor.IlpPopupMenuFactory), 
manageSelection(ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.util.selection.IlpRepresentationObjectSelectionModel, ilog.cpl.model.IlpRepresentationObject), 
IlpInteractionContextprotected void manageSelection(IlpInteractionContext ctxt, IlpRepresentationObjectSelectionModel selectionModel, IlpRepresentationObject ro)
This method is called before displaying a pop-up menu to update the selection. The default behavior is the following:
isSelectable(IlpInteractionContext, IlpRepresentationObject)):
     Subclasses could redefine this method to handle the selection a different way.
ctxt - The interaction context of the event.selectionModel - The selection model handling the selected objects.
                       It should not be null in this method.ro - The representation object which was under the 
                       mouse when the event occurred. It could be 
                       null.displayPopupMenu(IlpInteractionContext, MouseEvent), 
setPopupMenuFactory(IlpPopupMenuFactory), 
isSelectable(IlpInteractionContext, IlpRepresentationObject), 
IlpInteractionContextprotected boolean isSelectable(IlpInteractionContext ctx, IlpRepresentationObject ro)
Identifies whether an object can be selected or not, this method is 
 used in conjunction with 
 manageSelection(IlpInteractionContext, IlpRepresentationObjectSelectionModel, IlpRepresentationObject).
For predefined business objects (IltObject),
 the default implementation will return based on the CSS property 
 selectable. For any other cases it will return 
 true.
ctx - The current interaction context.ro - The representation object to be verified.protected boolean processGesture(IlpGesture gesture, IlpInteractionContext ctxt, IlpInteractionState state, AWTEvent e)
gesture - The recognized gesture.ctxt - The interaction context used to store persistent information.state - The interaction state.e - The event that ended the gesture.true if an enabled action was associated with the given
         gesture, false otherwise.createActionEvent(ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, int), 
IlpGesture, 
IlpInteractionContext@Deprecated protected ActionEvent createActionEvent(IlpInteractionContext ctxt, IlpInteractionState state, int modifiers)
IlpActionEventFactory instead.ActionEvent.
 This method is called when a gesture has been recognized and has an
 associated action. The created ActionEvent will be passed
 to the action when it is triggered.
 Each subclass has to define an implementation for this method in order to
 provide the right ActionEvent instance.
ctxt - The context where the event occurred.state - The interaction's state.modifiers - The modifiers associated with the recognized gesture.IlpInteractionContext, 
processGesture(ilog.cpl.interactor.IlpGesture, ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, java.awt.AWTEvent), 
setActionEventFactory(ilog.cpl.interactor.IlpActionEventFactory), 
ActionEvent, 
ActionListenerprotected ActionEvent createActionEvent(Action action, IlpInteractionContext ctxt, IlpInteractionState state, int modifiers)
ActionEvent.
 This method is called when a gesture has been recognized and has an
 associated action. The created ActionEvent will be passed
 to the action when it is triggered.
 
 By default, this method checks if there is an 
 IlpActionEventFactory registered. If so, it is used to create 
 the new event. Otherwise, each subclass has to define an implementation for 
 this method in order to provide the right ActionEvent 
 instance.
action - The action that is about to be triggered.ctxt - The context in which the event occurred.state - The state of the interaction.modifiers - The modifiers associated with the recognized gesture.IlpInteractionContext, 
processGesture(ilog.cpl.interactor.IlpGesture, ilog.cpl.interactor.IlpInteractionContext, ilog.cpl.interactor.IlpInteractionState, java.awt.AWTEvent), 
ActionEvent, 
ActionListenerprotected abstract IlpInteractionState getInteractionState(IlpInteractionContext ctxt)
ctxt - The context where the event occurred.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.