Package rsb.event
Class EventManager
java.lang.Object
rsb.event.EventManager
- All Implemented Interfaces:
Runnable
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(EventListener listener) Registers a listener.voidaddListener(EventListener listener, long mask) Registers a listener.voidAdds the event to the queue for the EventManager to process.booleanIs this thread the event thread?booleanIs the event thread alive?voidkillThread(boolean wait) Kills the event manager thread.voidprocessEvent(EventObject event) Dispatches the given event.voidremoveListener(EventListener listener) Removes a listener.voidrun()The thread entry point.voidstart()Spawns a daemon event thread.
-
Constructor Details
-
EventManager
public EventManager()
-
-
Method Details
-
dispatchEvent
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
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:
trueif the thread is an event thread; otherwisefalse.
-
isEventThreadAlive
public boolean isEventThreadAlive()Is the event thread alive?- Returns:
trueif the thread is alive; otherwisefalse.
-
killThread
public void killThread(boolean wait) Kills the event manager thread.- Parameters:
wait-trueto wait for the kill event to be processed before returning; otherwisefalseto submit the kill event and return immediately.
-
addListener
Registers a listener.- Parameters:
listener- the listener to add.
-
addListener
Registers a listener.- Parameters:
listener- the listener to add.mask- the event type mask.
-
removeListener
Removes a listener.- Parameters:
listener- the listener to remove.
-
run
public void run()The thread entry point. -
start
public void start()Spawns a daemon event thread. Only one can be created unless it is killed.
-