|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.util.event.IlvAbstractEventListenerCollection
ilog.views.util.event.IlvEventListenerSet
public class IlvEventListenerSet
IlvEventListenerSet implements a thread-safe collection of
event listeners backed by a hashed set. Some of the pros and cons of using
an IlvEventListenerSet to manage the event dispatch system
for a class are:
IlvEventListenerSet has nearly constant performance for
adding and removing event listeners.Here is an example that shows how a class can use an
IlvEventListenerSet for registering event
listeners and dispatching events to them:
public class MyClass {
IlvAbstractEventListenerCollection 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);
}
}
}
| Constructor Summary | |
|---|---|
IlvEventListenerSet()
Creates a new IlvEventListenerSet. |
|
| Method Summary | |
|---|---|
protected Collection |
cloneListeners()
Returns a copy of the collection of event listeners. |
protected void |
initListeners()
Initializes the collection of event listeners. |
| Methods inherited from class ilog.views.util.event.IlvAbstractEventListenerCollection |
|---|
addListener, contains, getListeners, removeListener, save, size |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlvEventListenerSet()
IlvEventListenerSet.
| Method Detail |
|---|
protected void initListeners()
initListeners in class IlvAbstractEventListenerCollectionprotected Collection cloneListeners()
cloneListeners in class IlvAbstractEventListenerCollection
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||