|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sdljava.event.SDLEventManager
public class SDLEventManager
The SDLEventManager is a thread helping us to handling SDL events.
Field Summary | |
---|---|
private static SDLEventManager |
instance
Class Instance |
private boolean |
isStopped
Stop thread flag |
private java.lang.Thread |
managerThread
Internal daemon thread reference |
private java.util.HashMap |
repository
Inner repository contains listener list by event type. |
Constructor Summary | |
---|---|
private |
SDLEventManager()
Constructor |
Method Summary | |
---|---|
int |
countEventListeners()
Count how many event type is listened. |
java.util.Iterator |
getEventListeners()
Get an Iterator of events type listen. |
static SDLEventManager |
getInstance()
Get instance of this class |
java.util.Iterator |
getRegisteredListeners(java.lang.Class eventType)
Get an Iterator of registered listeners for a particular event type. |
void |
notifyEvent(SDLEvent event)
Notify all listeners registered for the event type of the new SDLEvent. |
boolean |
register(SDLEventListener listener,
java.lang.Class eventType)
Register a listener for an event type |
boolean |
register(SDLEventListener listener,
java.util.List events)
Register a listener for a list of events |
void |
run()
Run method for our thread. |
void |
startAndWait()
Start listening and Wait a for events. |
void |
stop()
Stop handling the events. |
boolean |
unregister(SDLEventListener listener)
Unregister a SDLEventListener |
boolean |
unregisterAll()
Unregistered all listeners. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static SDLEventManager instance
private java.util.HashMap repository
private java.lang.Thread managerThread
private volatile boolean isStopped
Constructor Detail |
---|
private SDLEventManager()
Method Detail |
---|
public static SDLEventManager getInstance()
public boolean register(SDLEventListener listener, java.util.List events)
listener
- The class implements SDLEventListener interfaceevents
- A list of events or event types.
public boolean register(SDLEventListener listener, java.lang.Class eventType)
listener
- The class implements SDLEventListener interfaceeventType
- An SDL event type.
public boolean unregister(SDLEventListener listener)
listener
- The class implements SDLEventListener interface
public java.util.Iterator getRegisteredListeners(java.lang.Class eventType)
Iterator
of registered listeners for a particular event type.
eventType
- SDLEvent type.
public java.util.Iterator getEventListeners()
Iterator
of events type listen.
public boolean unregisterAll()
public int countEventListeners()
public void startAndWait()
public void stop()
public void run()
run
in interface java.lang.Runnable
public void notifyEvent(SDLEvent event)
event
- The new SDLEvent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |