|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
EventSystem implements a basic system for sending messages between threads.
| Method Summary | |
java.lang.Object |
addEventListener(java.lang.Object eventType,
EventListener listener)
Add an EventListener to be notified whenever user defined events of eventType are posted to the EventSystem with notifyEvent(java.lang.Object, java.lang.Object). |
java.lang.Object |
addTimer(long timeoutMillis,
EventListener listener,
java.lang.Object data)
Add an event to the system to be sent after the specified delay |
void |
notifyEvent(java.lang.Object eventType,
java.lang.Object data)
Notify all listeners registered through addEventListener(Object, EventListener)
for eventType that the event has occured |
void |
notifyTransientEvent(EventListener listener,
java.lang.Object data)
Notify a single event listener with the given data. |
void |
removeEventListener(java.lang.Object token)
Remove an EventListener that was registered with addEventListener. |
void |
removeTimer(java.lang.Object token)
Remove an event from the EventSystem so that the callback to the EventListener for the event won't be called. |
void |
run()
Starts the EventSystem running in the current thread. |
void |
stop()
Stops the EventSystem. |
| Method Detail |
public void run()
public void stop()
public java.lang.Object addTimer(long timeoutMillis,
EventListener listener,
java.lang.Object data)
timeoutMillis - amount of time to wait before invoking the callback on the EventListenerlistener - the EventListener to be called backdata - data to pass to the callback of the listener
removeTimer(Object)public void removeTimer(java.lang.Object token)
token - a token returned from addTimer(long, EventListener, Object)
public java.lang.Object addEventListener(java.lang.Object eventType,
EventListener listener)
eventType are posted to the EventSystem with notifyEvent(java.lang.Object, java.lang.Object).
Note that eventTypes are distinguished from one another by their hashCode() methods.
eventType - the type of event to register to listen forlistener - an EventListener to be called back whenever events of
eventType are posted to the EventSystem
removeEventListener(Object)public void removeEventListener(java.lang.Object token)
token - a token returned from addEventListener(Object, EventListener)
public void notifyEvent(java.lang.Object eventType,
java.lang.Object data)
addEventListener(Object, EventListener)
for eventType that the event has occured
eventType - the user defined event that has occureddata - the data to give to the listener's callback
public void notifyTransientEvent(EventListener listener,
java.lang.Object data)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||