org.apache.pivot.util
Class ListenerList<T>

java.lang.Object
  extended by org.apache.pivot.util.ListenerList<T>
All Implemented Interfaces:
Iterable<T>
Direct Known Subclasses:
Image.ImageListenerList, List.ListListenerList, ListView.ItemEditor.ItemEditorListenerList, Map.MapListenerList, Movie.MovieListenerList, Queue.QueueListenerList, Set.SetListenerList, Stack.StackListenerList, TableView.RowEditor.RowEditorListenerList, TreeView.NodeEditor.NodeEditorListenerList

public abstract class ListenerList<T>
extends Object
implements Iterable<T>

Abstract base class for listener lists.

NOTE This class is not inherently thread safe. Subclasses that require thread-safe access should synchronize method access appropriately. Callers must manually synchronize on the listener list instance to ensure thread safety during iteration.


Constructor Summary
ListenerList()
           
 
Method Summary
 void add(T listener)
          Adds a listener to the list, if it has not previously been added.
 boolean contains(T listener)
          Tests the existence of a listener in the list.
 boolean isEmpty()
          Tests the emptiness of the list.
 Iterator<T> iterator()
           
 void remove(T listener)
          Removes a listener from the list, if it has previously been added.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerList

public ListenerList()
Method Detail

add

public void add(T listener)
Adds a listener to the list, if it has not previously been added.

Parameters:
listener -

remove

public void remove(T listener)
Removes a listener from the list, if it has previously been added.

Parameters:
listener -

contains

public boolean contains(T listener)
Tests the existence of a listener in the list.

Parameters:
listener -
Returns:
true if the listener exists in the list; false, otherwise.

isEmpty

public boolean isEmpty()
Tests the emptiness of the list.

Returns:
true if the list contains no listeners; false, otherwise.

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T>