ilog.views.objectinteractor
Class IlvButtonInteractor

java.lang.Object
  extended by ilog.views.IlvObjectInteractor
      extended by ilog.views.objectinteractor.IlvButtonInteractor
All Implemented Interfaces:
Serializable

public class IlvButtonInteractor
extends IlvObjectInteractor

This object interactor makes a graphic object act like a standard interface button. When this object interactor is installed for a given graphic object, clicking on or activating the graphic object produce an action event. The action listeners of the graphic object receive three different kinds of action event: The ARM action event, when the object is clicked on, the DISARM action event when the mouse button is released, and the ACTIVATE action event when the mouse button is released over the object. The ARM and DISARM action events let you perform a specific graphic operation on the object (changing its color, for example) to indicate that an action is about to be performed. The ACTIVATE action event carries out the action associated with the button. You may code a listener as below:

 graphic.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
      if (event.getID() == IlvButtonInteractor.ARM) {
        graphic.setBackgound(Color.red);
        graphic.reDraw();
      }
      else if (event.getID() == IlvButtonInteractor.DISARM) {
        graphic.setBackground(Color.gray);
        graphic.reDraw();
      }
      else // ACTIVATE
        performMyAction();
    }
})

See Also:
IlvGraphic.addActionListener(java.awt.event.ActionListener), Serialized Form

Field Summary
static int ACTIVATE
          The Activate event type
static int ARM
          The Arm event type
static int DISARM
          The Disarm event type
 
Constructor Summary
IlvButtonInteractor()
          Creates a new IlvButtonInteractor.
 
Method Summary
 boolean processEvent(IlvGraphic obj, AWTEvent event, IlvObjectInteractorContext context)
          Processes the events.
 
Methods inherited from class ilog.views.IlvObjectInteractor
Get, handleExpose, onEnter, onExit, Put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARM

public static final int ARM
The Arm event type

See Also:
Constant Field Values

DISARM

public static final int DISARM
The Disarm event type

See Also:
Constant Field Values

ACTIVATE

public static final int ACTIVATE
The Activate event type

See Also:
Constant Field Values
Constructor Detail

IlvButtonInteractor

public IlvButtonInteractor()
Creates a new IlvButtonInteractor. You should not use the constructor to create an instance, you may share instances of this interactor by using the IlvObjectInteractor.Get method.

See Also:
IlvObjectInteractor.Get(java.lang.String)
Method Detail

processEvent

public boolean processEvent(IlvGraphic obj,
                            AWTEvent event,
                            IlvObjectInteractorContext context)
Processes the events.

Specified by:
processEvent in class IlvObjectInteractor
Parameters:
obj - The graphic object.
event - The event to process.
context - The context in which the event occurred.
Returns:
true if the event was handled by this processEvent invocation, false otherwise.


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