org.netbeans.modules.editor.util/1 1.26

org.netbeans.lib.editor.util
Class ListenerList<T extends EventListener>

java.lang.Object
  extended by org.netbeans.lib.editor.util.ListenerList<T>
All Implemented Interfaces:
Serializable

public final class ListenerList<T extends EventListener>
extends Object
implements Serializable

Listener list storing listeners of a single type.

Since:
1.11
See Also:
Serialized Form

Constructor Summary
ListenerList()
           
 
Method Summary
 void add(T listener)
          Adds the given listener to this listener list.
 int getListenerCount()
          Returns the total number of listeners for this listener list.
 List<T> getListeners()
          Returns a list of listeners.
 void remove(T listener)
          Removes the given listener from this listener list.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListenerList

public ListenerList()
Method Detail

getListeners

public List<T> getListeners()
Returns a list of listeners.

The listeners are returned in exactly the same order as they were added to this list. Use the following code for firing events to all the listeners you get from this method.

      List listeners = listenerList.getListeners();
      for (MyListener l : listeners) {
          l.notify(evt);
      }
 

Returns:
An immutable list of listeners contained in this listener list.

getListenerCount

public int getListenerCount()
Returns the total number of listeners for this listener list.


add

public void add(T listener)
Adds the given listener to this listener list.

Parameters:
listener - the listener to be added. If null is passed it is ignored (nothing gets added).

remove

public void remove(T listener)
Removes the given listener from this listener list.

Parameters:
listener - the listener to be removed. If null is passed it is ignored (nothing gets removed).

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.editor.util/1 1.26

Built on December 3 2008.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.