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 TypeMethodDescriptionvoid
addListener
(EventListener listener) Registers a listener.void
addListener
(EventListener listener, long mask) Registers a listener.void
Adds the event to the queue for the EventManager to process.boolean
Is this thread the event thread?boolean
Is the event thread alive?void
killThread
(boolean wait) Kills the event manager thread.void
processEvent
(EventObject event) Dispatches the given event.void
removeListener
(EventListener listener) Removes a listener.void
run()
The thread entry point.void
start()
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:
true
if the thread is an event thread; otherwisefalse
.
-
isEventThreadAlive
public boolean isEventThreadAlive()Is the event thread alive?- Returns:
true
if the thread is alive; otherwisefalse
.
-
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; otherwisefalse
to 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.
-