|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webrenderer.se.event.internal.EventListenerManager
public abstract class EventListenerManager
The EventListenerManager is a generic listener manager and event propogation
system. EventListener
's can register with this, and receive
events pertaining to this listener.
This abstract class can not be instantiated. Classes can extend this, and
with no modifications, have a working EventListener system. In 99.999% of
cases, it is not necessary to override the propogation method. Instead,
Functor
s should be written.
The Functor interface is used to call the correct method for each event in a listener. Most listener interfaces have several callback methods, and the propogation algorithm does not have any information about this. The functor is used to invoke the correct callback method, while allowing the generic propogation algorithm to reside in this base class.
Nested Class Summary | |
---|---|
static interface |
EventListenerManager.Functor
The Functor interface is used to call the correct method for each event in a listener. |
Field Summary | |
---|---|
protected java.util.Vector |
listeners
A list of all registered event listeners |
Constructor Summary | |
---|---|
EventListenerManager()
|
Method Summary | |
---|---|
void |
addListener(java.util.EventListener l)
Add an event listener. |
boolean |
noListeners()
|
void |
propogate(EventListenerManager.Functor f,
java.util.EventObject e)
Propogates a given event object to all of the registered event listeners. |
void |
removeListener(java.util.EventListener l)
Remove a event listener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector listeners
Constructor Detail |
---|
public EventListenerManager()
Method Detail |
---|
public void addListener(java.util.EventListener l)
l
- A listener.public void removeListener(java.util.EventListener l)
l
- A listener.public boolean noListeners()
public void propogate(EventListenerManager.Functor f, java.util.EventObject e)
f
- Functor that invokes each event listeners methods.e
- The event object being propogated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |