SMACS

smacs.util
Class ObjectEventListenerList

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

public class ObjectEventListenerList
extends EventListenerList

the java EventListenerList. The class simply re-exports the standard java2 java.swing.event.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 ObjectEventListenerList.Adapter
          EventListener Adapter. reminder: a String is Object
 
Field Summary
 
Fields inherited from class javax.swing.event.EventListenerList
listenerList
 
Constructor Summary
ObjectEventListenerList()
           
 
Method Summary
 void add(Class t, EventListener l, Object o)
          add a new EventListener. that pairs the EventListener with a Object object like a String.
 int getListenerCount(Class t, Object object)
          Return the number of all the listeners of the given type and comparing equal to the object.
 int getListenerCount(Class t, Object object, Comparator c)
          Return the number of all the listeners of the given type and comparing equal to the object.
 int getListenerCount(Class t, Object x, Object y, Comparator c)
          Return the number of listeners of the given type and in the range between the objects.
 EventListener[] getListeners(Class t, Object object)
          Return an array of all the listeners of the given type and comparing equal to the object.
 EventListener[] getListeners(Class t, Object object, Comparator c)
          Return an array of all the listeners of the given type and comparing equal to the object.
 EventListener[] getListeners(Class t, Object x, Object y, Comparator c)
          Return an array of listeners of the given type and in the range between the objects.
 boolean remove(Class t, EventListener listener, Object object)
          remove the first EventListener. that matches equal to the given a Object object like a String and has the same EventListener wrapped for execution on that Object.
 
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

ObjectEventListenerList

public ObjectEventListenerList()
Method Detail

add

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

See Also:
getListeners(Class,Object)

remove

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

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

getListenerCount

public int getListenerCount(Class t,
                            Object 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 Object object via some ObjectEventListenerList.Adapter.


getListeners

public EventListener[] getListeners(Class t,
                                    Object 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 Object object via some ObjectEventListenerList.Adapter. The returned list are the original EventListeners and not the ObjectEventListenerList.Adapters.


getListenerCount

public int getListenerCount(Class t,
                            Object object,
                            Comparator c)
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 Object object via some ObjectEventListenerList.Adapter.


getListeners

public EventListener[] getListeners(Class t,
                                    Object object,
                                    Comparator c)
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 Object object via some ObjectEventListenerList.Adapter. The returned list are the original EventListeners and not the ObjectEventListenerList.Adapters.


getListenerCount

public int getListenerCount(Class t,
                            Object x,
                            Object y,
                            Comparator c)
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 Object object via some ObjectEventListenerList.Adapter. The counted listeners have an associated object between x and y (both inclusive).


getListeners

public EventListener[] getListeners(Class t,
                                    Object x,
                                    Object y,
                                    Comparator c)
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 Object object via some ObjectEventListenerList.Adapter. The returned list are the original EventListeners and not the ObjectEventListenerList.Adapters. The selected listeners have an associated object between x and y (both inclusive).


SMACS