com.droplets.api.event
Class EventListenerList

java.lang.Object
  |
  +--com.droplets.api.event.EventListenerList
All Implemented Interfaces:
java.io.Serializable

public class EventListenerList
extends java.lang.Object
implements java.io.Serializable

This class mimics javax.swing.event.EventListenerList. See the Javadoc for that class. It also provides a removeAll method to deregister all listeners at once.

See Also:
Serialized Form

Field Summary
protected  java.lang.Object[] listenerList
           
 
Constructor Summary
EventListenerList()
           
 
Method Summary
 void add(java.lang.Class cls, java.util.EventListener l)
          Adds the listener specified by the second arg to the list.
 int getListenerCount()
          Returns the number of listeners in this list.
 int getListenerCount(java.lang.Class t)
          Returns the number of listeners of the supplied type in this list.
 java.lang.Object[] getListenerList()
          Gets an array of all listeners.
 void remove(java.lang.Class cls, java.util.EventListener l)
          Removes a listener.
 void removeAll()
          Removes all listeners.
 java.lang.String toString()
          Gets a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listenerList

protected transient java.lang.Object[] listenerList
Constructor Detail

EventListenerList

public EventListenerList()
Method Detail

getListenerList

public java.lang.Object[] getListenerList()
Gets an array of all listeners.
Returns:
an array of all listeners

getListenerCount

public int getListenerCount()
Returns the number of listeners in this list.

getListenerCount

public int getListenerCount(java.lang.Class t)
Returns the number of listeners of the supplied type in this list.

add

public void add(java.lang.Class cls,
                java.util.EventListener l)
Adds the listener specified by the second arg to the list. The first arg should describe the listener's type.
Parameters:
cls - the type of the listener to be added
l - the listener to be added
Throws:
java.lang.IllegalArgumentException - if the second argument's type is not the first argument

remove

public void remove(java.lang.Class cls,
                   java.util.EventListener l)
Removes a listener.
Parameters:
cls - the type of the listener to be removed
l - the listener to be removed
Throws:
java.lang.IllegalArgumentException - if the second argument's type is not the first argument

removeAll

public void removeAll()
Removes all listeners.

toString

public java.lang.String toString()
Gets a string representation of this object. Useful for debugging.
Overrides:
toString in class java.lang.Object


Copyright © Droplets, 2001. All Rights Reserved.