ABLE, Version 1.1b

com.ibm.able
Class AbleEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--com.ibm.able.AbleEvent

public class AbleEvent
extends java.util.EventObject

This class defines the event object used for notification and actions (method invocation) on other AbleBeans and AbleObjects. It supports specification of both synchronous and asynchronous treatment by the AbleEventListeners.

AbleEvent objects are immutable; however, an argument object can be manipulated by the user. If this is undesirable, the user must clone() the argument object before constructing an AbleEvent object.

AbleEvent objects consist of:

Note that for action events (those events that have an action string specified), the "action" is taken to be the name of a method on the target AbleEventListener object, and the argument object is passed to that method as the single argument.

Note that all event attributes and the argument object (if used) must be specified when the event is constructed. There is no provision for setting these items after an AbleEvent is constructed.

Version:
$Revision: 1.2 $, $Date: 2000/01/24 14:52:08 $
See Also:
AbleEventListener, Serialized Form

Field Summary
protected  java.lang.String action
          action is either null or it contains the name of a method to call on an AbleEventListener.
static int ACTION
           
protected  java.lang.Object argObject
          argObject is either null or it contains any arbitrary object that makes sense to the AbleEventListener.
protected  boolean asynchronous
          asynchronous indicates the type of event processing desired.
static int DATACHANGED
           
static int EOF
           
protected  java.lang.Object genSource
          genSource contains a nontransient version of the source generating the event.
protected  int id
          id is the type of AbleEvent.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
AbleEvent(java.lang.Object theSource, java.lang.Object theArgObject)
          Create a new AbleEvent.
AbleEvent(java.lang.Object theSource, java.lang.Object theArgObject, int theId)
          Create a new asynchronous AbleEvent.
AbleEvent(java.lang.Object theSource, java.lang.Object theArgObject, int theId, boolean sync)
          Create a new AbleEvent.
AbleEvent(java.lang.Object theSource, java.lang.Object theArgObject, java.lang.String theAction)
          Create a new asynchronous AbleEvent.
AbleEvent(java.lang.Object theSource, java.lang.Object theArgObject, java.lang.String theAction, boolean sync)
          Create a new action AbleEvent.
 
Method Summary
 java.lang.String getAction()
          Retrieve the event's action string.
 java.lang.Object getArgObject()
          Retrieve the event's argument object.
 java.lang.Object getGenSource()
          Retrieve the event's generating source.
 int getId()
          Return the event id
 boolean isAsynchronous()
          Returns true if the event should be handled asynchronously or false if synchronous
 java.lang.String toString()
          Retrieve a string describing (the contents of) the object.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTION

public static int ACTION

DATACHANGED

public static int DATACHANGED

EOF

public static int EOF

action

protected final java.lang.String action
action is either null or it contains the name of a method to call on an AbleEventListener. If a method name is specified, the argObject is passed to the method as the single argument. (Note that the argObject itself may be null.)

id

protected final int id
id is the type of AbleEvent.

asynchronous

protected boolean asynchronous
asynchronous indicates the type of event processing desired.

argObject

protected java.lang.Object argObject
argObject is either null or it contains any arbitrary object that makes sense to the AbleEventListener. If action is specified and if argObject is specified, the method named by action is passed argObject as the single argument.

When an argObject exists, but no action is specified, the default behavior is UNDEFINED. *FIX* ?


genSource

protected final java.lang.Object genSource
genSource contains a nontransient version of the source generating the event. For a distributed agent application, this would probably be an interface.
Constructor Detail

AbleEvent

public AbleEvent(java.lang.Object theSource,
                 java.lang.Object theArgObject)
Create a new AbleEvent. This event is the simplest. It has no action and is processed asynchronously. The argument object may be specified as .
Parameters:
theSource - The object that is creating and using this event.

theArgObject - An object to be passed to the event listener. This parameter is optional and therefore may be specified as null.


AbleEvent

public AbleEvent(java.lang.Object theSource,
                 java.lang.Object theArgObject,
                 int theId)
Create a new asynchronous AbleEvent. This event specifies an argument and an event Id, but indicates no action for the listener.
Parameters:
theSource - The Able object that is creating and using this event.

theArgObject - An object to be passed to the event listener. This parameter is optional and therefore may be specified as null.

theId - An event type of identified constant. null.


AbleEvent

public AbleEvent(java.lang.Object theSource,
                 java.lang.Object theArgObject,
                 java.lang.String theAction)
Create a new asynchronous AbleEvent. This event specifies an argument and an action for the AbleEventListener.
Parameters:
theSource - The Able object that is creating and using this event.

theArgObject - An object to be passed to the event listener. This parameter is optional and therefore may be specified as null.

theAction - A string containing the name of a method to invoke on the event listener. The method will be passed the argObject.


AbleEvent

public AbleEvent(java.lang.Object theSource,
                 java.lang.Object theArgObject,
                 java.lang.String theAction,
                 boolean sync)
Create a new action AbleEvent. This event specifies an argument and an action for the AbleEventListener.
Parameters:
theSource - The Able object that is creating and using this event.

theArgObject - An object to be passed to the event listener. This parameter is optional and therefore may be specified as null.

theAction - A string containing the name of a method to invoke on the event listener. The method will be passed the argObject.

sync - Whether the event should be processed asynchronously or synchronously


AbleEvent

public AbleEvent(java.lang.Object theSource,
                 java.lang.Object theArgObject,
                 int theId,
                 boolean sync)
Create a new AbleEvent. This event specifies an argument and an event Id, but indicates no action for the listener.
Parameters:
theSource - The Able object that is creating and using this event.

theArgObject - An object to be passed to the event listener. This parameter is optional and therefore may be specified as null.

theId - An event type of identified constant. null.

sync - Whether the event should be processed asynchronously or synchronously. null.

Method Detail

getArgObject

public java.lang.Object getArgObject()
Retrieve the event's argument object.

Note that it is not guaranteed that the argument is immutable, unless the argument is restricted (by the caller) to clonable.

Returns:
the event's argument object or null if no argument object has been specified.

getId

public int getId()
Return the event id

getAction

public java.lang.String getAction()
Retrieve the event's action string.
Returns:
the event's action string or null if no action string has been specified.

isAsynchronous

public boolean isAsynchronous()
Returns true if the event should be handled asynchronously or false if synchronous

getGenSource

public java.lang.Object getGenSource()
Retrieve the event's generating source.
Returns:
an interface representing the object that generated the event. NOTE that in a distributed application, this must be cast to an appropriate interface!

toString

public java.lang.String toString()
Retrieve a string describing (the contents of) the object.
Returns:
A String containing the current contents of the object.

Overrides:
toString in class java.util.EventObject

ABLE, Version 1.1b

ABLE: Produced by Joe, Don, and Jeff who say, 'Thanks for your support.'