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:
java.io.Serializable, java.lang.Iterable<T>
Direct Known Subclasses:
AjaxRequestTargetListenerCollection, ChangeListenerSet, ComponentInitializationListenerCollection, ComponentInstantiationListenerCollection, ComponentOnAfterRenderListenerCollection, ComponentOnBeforeRenderListenerCollection, HeaderContributorListenerCollection, RequestCycleListenerCollection

public abstract class ListenerCollection<T>
extends java.lang.Object
implements java.io.Serializable, java.lang.Iterable<T>

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:
ivaynberg (Igor Vaynberg), 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.
 java.util.Iterator<T> iterator()
          Returns an iterator that can iterate the listeners.
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.
protected  void reversedNotify(ListenerCollection.INotifier<T> notifier)
          Notifies each listener in this in reversed order
 
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

reversedNotify

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

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

iterator

public java.util.Iterator<T> iterator()
Returns an iterator that can iterate the listeners.

Specified by:
iterator in interface java.lang.Iterable<T>
Returns:
an iterator that can iterate the listeners.


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.