ilog.views.appframe.event
Class IlvMessageMapper

java.lang.Object
  extended by ilog.views.appframe.event.IlvMessageMapper
All Implemented Interfaces:
ActionHandler, ActionListener, EventListener

public class IlvMessageMapper
extends Object
implements ActionHandler

Defines action handlers that map action events or message events with the call to a specified method.

A message mapper is associated with an object that has methods that will be invoked when action events or message events occur. Methods of the associated object are mapped with action or message events with the methods:


Constructor Summary
IlvMessageMapper(Object obj)
          Constructs a IlvMessageMapper that maps actions and message events with methods of the specified object.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Invoked when an action event occurs.
 boolean isProcessingAction(String command)
          Determines whether the action with the specified command key has been associated with a method.
 void receiveMessage(MessageEvent messageEvent)
          Invokes the method that has been mapped to the name of the specified messageEvent.
 void registerActionMethod(String command, String methodName)
          Maps the specified method to the action with the specified command key.
 void registerActionStateMethod(String command, String methodName)
          Maps the specified method with the state of the action with the specified command key.
 void registerMessageMethod(String messageName, String methodName, Class[] paramsType)
          Maps the specified method with the message with the specified name.
 boolean updateAction(Action action)
          Updates the state of the specified action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvMessageMapper

public IlvMessageMapper(Object obj)
Constructs a IlvMessageMapper that maps actions and message events with methods of the specified object.

Parameters:
obj - The object to call the methods of.
Method Detail

receiveMessage

public void receiveMessage(MessageEvent messageEvent)
Invokes the method that has been mapped to the name of the specified messageEvent.

Parameters:
messageEvent - The message event.
See Also:
registerMessageMethod(java.lang.String, java.lang.String, java.lang.Class[])

isProcessingAction

public boolean isProcessingAction(String command)
Determines whether the action with the specified command key has been associated with a method.

Specified by:
isProcessingAction in interface ActionHandler
Parameters:
command - The command key of the action.
Returns:
true if the action has been associated with a method; false otherwise.
See Also:
registerActionMethod(java.lang.String, java.lang.String)

actionPerformed

public void actionPerformed(ActionEvent event)
Invoked when an action event occurs. If a method has been registered with the method registerActionMethod(java.lang.String, java.lang.String) for the action corresponding to the action event, it will be called. Otherwise, nothing is done.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - The action event to process.
See Also:
isProcessingAction(java.lang.String)

updateAction

public boolean updateAction(Action action)
Updates the state of the specified action. If a method has been associated with this action using the method registerActionStateMethod(java.lang.String, java.lang.String), it will be called and the return value of this method will be returned. Otherwise, this method does nothing and returns false.

Specified by:
updateAction in interface ActionHandler
Parameters:
action - The action to update the state of.
Returns:
true if a method has been associated with the state of the specified action; false otherwise.
See Also:
ActionHandler.updateAction(javax.swing.Action), registerActionStateMethod(java.lang.String, java.lang.String)

registerMessageMethod

public void registerMessageMethod(String messageName,
                                  String methodName,
                                  Class[] paramsType)
Maps the specified method with the message with the specified name.

Parameters:
messageName - The name of the message.
methodName - The name of the method associated with the message messageName.
paramsType - An array containing the types of argument of the method methodName.

registerActionMethod

public void registerActionMethod(String command,
                                 String methodName)
Maps the specified method to the action with the specified command key. The specified method must have been defined with one of these signatures:
 public void methodName(ActionEvent e) {
 ...
 }
 
or
 public void methodName() {
 ...
 }
 

Parameters:
command - The command key of the action to associate with the the specified method.
methodName - The name of the method to associate with the action.
See Also:
actionPerformed(java.awt.event.ActionEvent)

registerActionStateMethod

public void registerActionStateMethod(String command,
                                      String methodName)
Maps the specified method with the state of the action with the specified command key. The specified method must have been defined with the following signature:
 public boolean methodName(Action action) {
 ...
 }
 

Parameters:
command - The command key of the action to be updated.
methodName - The name of the method.
See Also:
updateAction(javax.swing.Action)


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