net.larsan.urd.util
Class EventQueue

java.lang.Object
  |
  +--net.larsan.urd.util.EventQueue
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
NSEventQueue, RegEventQueue

public abstract class EventQueue
extends java.lang.Object
implements java.lang.Runnable

An abstract base class for asynchronouns event dispatching. This class is threaded and must be started and stopped.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Constructor Summary
EventQueue()
           
EventQueue(Executor exec)
           
 
Method Summary
protected abstract  void deliverEvent(java.lang.Object event, java.lang.Object listener)
          Invoke an event on a listener.
protected abstract  java.util.List getListeners()
          Get a list of listeners.
protected  void queueEvent(java.lang.Object event)
          Put an event in the queue.
 void run()
          Run event queue.
 void start(java.lang.String threadName)
          Start event queue with a thread name.
 void stop()
          Stop this event queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventQueue

public EventQueue(Executor exec)

EventQueue

public EventQueue()
Method Detail

getListeners

protected abstract java.util.List getListeners()
Get a list of listeners. This list must be thread safe.

Returns:
A thread safe list of listeners

deliverEvent

protected abstract void deliverEvent(java.lang.Object event,
                                     java.lang.Object listener)
Invoke an event on a listener. The event type and listener type will be as given to the queueEvent method and from the getListeners method.

Parameters:
event - Event object to deliver
listener - Listener to deliver event to

queueEvent

protected void queueEvent(java.lang.Object event)
Put an event in the queue.

Parameters:
event - Event to queue

start

public void start(java.lang.String threadName)
Start event queue with a thread name.

Parameters:
threadName - Name of the thread to run this queue

stop

public void stop()
Stop this event queue.


run

public void run()
Run event queue.

Specified by:
run in interface java.lang.Runnable