org.apache.wicket.util.listener
Class ListenerCollection<T>

java.lang.Object
  extended by org.apache.wicket.util.listener.ListenerCollection<T>
Type Parameters:
T - type of listeners
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ChangeListenerSet, ComponentInitializationListenerCollection, ComponentInstantiationListenerCollection, ComponentOnAfterRenderListenerCollection, ComponentOnBeforeRenderListenerCollection, RequestCycleListenerCollection

public abstract class ListenerCollection<T>
extends Object
implements Serializable

Represents a collection of listeners. Facilitates invocation of events on each listener.

NOTE: Ordering of listeners is not guaranteed and should not be relied upon

Author:
Jonathan Locke
See Also:
Serialized Form

Nested Class Summary
protected static interface ListenerCollection.INotifier<T>
          Used to notify a listener.
 
Constructor Summary
ListenerCollection()
           
 
Method Summary
 boolean add(T listener)
          Adds a listener to this set of listeners.
protected  boolean isAllowingDuplicates()
          Whether or not added listeners should be checked for duplicates.
protected  boolean isAllowingNulls()
          Whether or not to allow nulls in listener collection.
protected  void notify(ListenerCollection.INotifier<T> notifier)
          Notifies each listener in this
protected  void notifyIgnoringExceptions(ListenerCollection.INotifier<T> notifier)
          Notifies each listener in this set ignoring exceptions.
 void remove(T listener)
          Removes a listener from this set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListenerCollection

public ListenerCollection()
Method Detail

add

public boolean add(T listener)
Adds a listener to this set of listeners.

Parameters:
listener - The listener to add
Returns:
true if the listener was added

notify

protected void notify(ListenerCollection.INotifier<T> notifier)
Notifies each listener in this

Parameters:
notifier - notifier used to notify each listener

notifyIgnoringExceptions

protected void notifyIgnoringExceptions(ListenerCollection.INotifier<T> notifier)
Notifies each listener in this set ignoring exceptions. Exceptions will be logged.

Parameters:
notifier - notifier used to notify each listener

remove

public void remove(T listener)
Removes a listener from this set.

Parameters:
listener - The listener to remove

isAllowingDuplicates

protected boolean isAllowingDuplicates()
Whether or not added listeners should be checked for duplicates.

Returns:
true to ignore duplicates

isAllowingNulls

protected boolean isAllowingNulls()
Whether or not to allow nulls in listener collection.

Returns:
true to allow nulls to be added to the collection


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.