public class IlvMessageMapper extends Object implements ActionHandler
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 and Description |
---|
IlvMessageMapper(Object obj)
Constructs a
IlvMessageMapper that maps actions and message
events with methods of the specified object. |
Modifier and Type | Method and Description |
---|---|
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.
|
public IlvMessageMapper(Object obj)
IlvMessageMapper
that maps actions and message
events with methods of the specified object.obj
- The object to call the methods of.public void receiveMessage(MessageEvent messageEvent)
messageEvent
.messageEvent
- The message event.registerMessageMethod(java.lang.String, java.lang.String, java.lang.Class<?>[])
public boolean isProcessingAction(String command)
command
key has been associated with a method.isProcessingAction
in interface ActionHandler
command
- The command key of the action.true
if the action has been associated with a method;
false
otherwise.registerActionMethod(java.lang.String, java.lang.String)
public void actionPerformed(ActionEvent event)
registerActionMethod(java.lang.String, java.lang.String)
for the action corresponding to the
action event, it will be called. Otherwise, nothing is done.actionPerformed
in interface ActionListener
event
- The action event to process.isProcessingAction(java.lang.String)
public boolean updateAction(Action action)
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
.updateAction
in interface ActionHandler
action
- The action to update the state of.true
if a method has been associated with the
state of the specified action; false
otherwise.ActionHandler.updateAction(javax.swing.Action)
,
registerActionStateMethod(java.lang.String, java.lang.String)
public void registerMessageMethod(String messageName, String methodName, Class<?>[] paramsType)
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
.public void registerActionMethod(String command, String methodName)
command
key. The specified method must have been defined with one of these signatures:
public void methodName(ActionEvent e) { ... }or
public void methodName() { ... }
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.actionPerformed(java.awt.event.ActionEvent)
public void registerActionStateMethod(String command, String methodName)
command
key.
The specified method must have been defined with the following signature:
public boolean methodName(Action action) { ... }
command
- The command key of the action to be updated.methodName
- The name of the method.updateAction(javax.swing.Action)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.