Package rsb.event

Class EventManager

java.lang.Object
rsb.event.EventManager
All Implemented Interfaces:
Runnable

public class EventManager extends Object implements Runnable
  • Constructor Details

    • EventManager

      public EventManager()
  • Method Details

    • dispatchEvent

      public void dispatchEvent(EventObject e)
      Adds the event to the queue for the EventManager to process. Events are processed with the default mask.
      Parameters:
      e - The event object to dispatch.
    • processEvent

      public void processEvent(EventObject event)
      Dispatches the given event. Calling this avoids the use of the event queue.
      Parameters:
      event - The event to fire.
    • isEventThread

      public boolean isEventThread()
      Is this thread the event thread?
      Returns:
      true if the thread is an event thread; otherwise false.
    • isEventThreadAlive

      public boolean isEventThreadAlive()
      Is the event thread alive?
      Returns:
      true if the thread is alive; otherwise false.
    • killThread

      public void killThread(boolean wait)
      Kills the event manager thread.
      Parameters:
      wait - true to wait for the kill event to be processed before returning; otherwise false to submit the kill event and return immediately.
    • addListener

      public void addListener(EventListener listener)
      Registers a listener.
      Parameters:
      listener - the listener to add.
    • addListener

      public void addListener(EventListener listener, long mask)
      Registers a listener.
      Parameters:
      listener - the listener to add.
      mask - the event type mask.
    • removeListener

      public void removeListener(EventListener listener)
      Removes a listener.
      Parameters:
      listener - the listener to remove.
    • run

      public void run()
      The thread entry point.
      Specified by:
      run in interface Runnable
    • start

      public void start()
      Spawns a daemon event thread. Only one can be created unless it is killed.