org.eodisp.ui.common.base
Class EodispDelegate
java.lang.Object
org.eodisp.ui.common.base.EodispDelegate
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.util.EventListener
public class EodispDelegate
- extends java.lang.Object
- implements java.awt.event.ActionListener
This is an implementation of a delegate. It is capable of delegating the
execution of a method to the registered method within the target class. It
can be used as a delegation mechanism for virtually anything where an
ActionListener is suitable.
For instance, it can be used by a controller to register itself as a handler
for an action. The example here assumes that you want to register the event
'OnAppExit' in the application controller. The following has to be done:
- Create an action class 'ExitAppAction'
- Instantiate this action in the appropriate frame. In the case of the
application controller, this will be the main frame of the application. In
general, it is the frame which the controller is responsible for.
- Register the controller as the action handler for the event.
- Create a method 'OnAppExit' in the controller that handles the event.
The corresponding code in the controller would look like this:
Frame.onAppExitAction.registerTargetHandler(new EodispDelegate(this, "onAppExit"));
public void OnAppExit(ActionEvent e) {
//implementation
}
- Version:
- $Id:EodispDelegate.java 2047 2006-05-09 12:20:54Z eglimi $
- Author:
- eglimi
|
Field Summary |
(package private) static org.apache.log4j.Logger |
logger
Log4J logger for this class |
|
Constructor Summary |
EodispDelegate(java.lang.Object target,
java.lang.String methodString)
Default constructor. |
|
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent e)
Called when an action is performed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
static org.apache.log4j.Logger logger
- Log4J logger for this class
EodispDelegate
public EodispDelegate(java.lang.Object target,
java.lang.String methodString)
- Default constructor. Finds the method on the target object to be called.
- Parameters:
target - The target object that is responsible to act upon the action
performed event.methodString - The name of the method that should be invoked when by the
action performed event.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Called when an action is performed. It invokes the specified method in
the target object.
- Specified by:
actionPerformed in interface java.awt.event.ActionListener
- Parameters:
e - ActionEvent - the event object of the event