|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IlvEventListenerCollection
IlvEventListenerCollection defines the behavior of a thread-safe
collection of event listeners. A class that fires events to a specific listener
interface can use an IlvEventListenerCollection for registering
event listeners and dispatching events to them:
public class MyClass {
IlvEventListenerCollection xyzListeners = new IlvEventListenerSet();
public void addXYZListener (XYZListener aListener) {
xyzListeners.addListener(aListener);
}
public void removeXYZListener (XYZListener aListener) {
xyzListeners.removeListener(aListener);
}
public void notifyXYZListeners () {
XYZEvent event = new XYZEvent(this);
for (Iterator i = xyzListeners.getListeners(); i.hasNext(); ) {
XYZListener xyzListener = (XYZListener) i.next();
xyzListener.xyzHappened(event);
}
}
}
| Method Summary | |
|---|---|
void |
addListener(EventListener listener)
Adds the specified listener to this collection. |
boolean |
contains(EventListener listener)
Returns whether this collection contains the specified listener. |
Iterator |
getListeners()
Returns an iterator over the event listeners. |
void |
removeListener(EventListener listener)
Removes the specified listener from this collection. |
void |
save(ObjectOutputStream s,
String k)
Serializes the collection of event listeners as a series of key-value pairs. |
| Method Detail |
|---|
void addListener(EventListener listener)
listener - The listener.void removeListener(EventListener listener)
listener - The listener.Iterator getListeners()
boolean contains(EventListener listener)
listener - The listener.
true if this collection contains listener,
otherwise false.
void save(ObjectOutputStream s,
String k)
throws IOException
s - The object output stream to write the event listeners.k - A key string that is written in front of
each listener to identify its type.
IOException
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||