SMACS

smacs.util
Class ComparableEventListenerList

java.lang.Object
  extended byjavax.swing.event.EventListenerList
      extended bysmacs.util.ComparableEventListenerList
All Implemented Interfaces:
Serializable

public class ComparableEventListenerList
extends EventListenerList

the java EventListenerList. The class simply re-exports the standard java2 EventListenerList implementation which very handy to use a single ListenerList for multiple EventListener signal types.

We pick up the chance to add some helpers but they are unimportant in daily usage of this class where you can replace each instance with one of the original java2 EventListenerList.

Author:
Copyright (C) 2004, Guido Draheim. All rights reserved. Part of SMACS project.
See Also:
Serialized Form

Nested Class Summary
 class ComparableEventListenerList.Adapter
          EventListener Adapter. reminder: a String is Comparable
 
Field Summary
 
Fields inherited from class javax.swing.event.EventListenerList
listenerList
 
Constructor Summary
ComparableEventListenerList()
           
 
Method Summary
 void add(Class t, EventListener l, Comparable o)
          add a new EventListener. that pairs the EventListener with a Comparable object like a String.
 int getListenerCount(Class t, Comparable object)
          Return the number of all the listeners of the given type and comparing equal to the object.
 int getListenerCount(Class t, Comparable x, Comparable y)
          Return the number of listeners of the given type and in the range between the objects.
 EventListener[] getListeners(Class t, Comparable object)
          Return an array of all the listeners of the given type and comparing equal to the object.
 EventListener[] getListeners(Class t, Comparable x, Comparable y)
          Return an array of listeners of the given type and in the range between the objects.
 boolean remove(Class t, EventListener listener, Comparable object)
          remove the first EventListener. that matches equal to the given a Comparable object like a String and has the same EventListener wrapped for execution on that Comparable.
 
Methods inherited from class javax.swing.event.EventListenerList
add, getListenerCount, getListenerCount, getListenerList, getListeners, remove, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComparableEventListenerList

public ComparableEventListenerList()
Method Detail

add

public void add(Class t,
                EventListener l,
                Comparable o)
add a new EventListener. that pairs the EventListener with a Comparable object like a String. You can later slice the EventListenerList.listenerList into listeners for a specific value or range of the Comparable / String.

See Also:
getListeners(Class,Comparable)

remove

public boolean remove(Class t,
                      EventListener listener,
                      Comparable object)
remove the first EventListener. that matches equal to the given a Comparable object like a String and has the same EventListener wrapped for execution on that Comparable.

Returns:
true if an object was deleted. May be loop until false is returned.

getListenerCount

public int getListenerCount(Class t,
                            Comparable object)
Return the number of all the listeners of the given type and comparing equal to the object. Remember that it can only count those wrapped EventListeners associated with an Comparable object via some ComparableEventListenerList.Adapter.


getListeners

public EventListener[] getListeners(Class t,
                                    Comparable object)
Return an array of all the listeners of the given type and comparing equal to the object. Remember that it can only find wrapped EventListeners associated with an Comparable object via some ComparableEventListenerList.Adapter. The returned list are the original EventListeners and not the ComparableEventListenerList.Adapters.


getListenerCount

public int getListenerCount(Class t,
                            Comparable x,
                            Comparable y)
Return the number of listeners of the given type and in the range between the objects. Remember that it can only count those wrapped EventListeners associated with an Comparable object via some ComparableEventListenerList.Adapter. The counted listeners have an associated object between x and y (both inclusive).


getListeners

public EventListener[] getListeners(Class t,
                                    Comparable x,
                                    Comparable y)
Return an array of listeners of the given type and in the range between the objects. Remember that it can only find wrapped EventListeners associated with an Comparable object via some ComparableEventListenerList.Adapter. The returned list are the original EventListeners and not the ComparableEventListenerList.Adapters. The selected listeners have an associated object between x and y (both inclusive).


SMACS