cz.cuni.amis.utils.collections
Class SimpleListener<T>

java.lang.Object
  extended by cz.cuni.amis.utils.collections.SimpleListener<T>
All Implemented Interfaces:
CollectionEventListener<T>, java.util.EventListener
Direct Known Subclasses:
ElementListener

public abstract class SimpleListener<T>
extends java.lang.Object
implements CollectionEventListener<T>

Collection listener with only one method changed() called on each change.


Constructor Summary
SimpleListener()
           
 
Method Summary
protected abstract  void changed(java.util.Collection<T> collection, java.util.Collection<T> added, java.util.Collection<T> removed)
          Called when a change occures on the collection.
 void postAddEvent(java.util.Collection<T> alreadyAdded, java.util.Collection<T> whereWereAdded)
          Called after the elements were added to the collection.
 void postRemoveEvent(java.util.Collection<T> alreadyRemoved, java.util.Collection<T> whereWereRemoved)
          Called after the elements were removed from the collection.
 void preAddEvent(java.util.Collection<T> toBeAdded, java.util.Collection<T> whereToAdd)
          Called before the elements will be added to the collection.
 void preRemoveEvent(java.util.Collection<T> toBeRemoved, java.util.Collection<T> whereToRemove)
          Called before the elements will be removed from the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleListener

public SimpleListener()
Method Detail

preAddEvent

public void preAddEvent(java.util.Collection<T> toBeAdded,
                        java.util.Collection<T> whereToAdd)
Description copied from interface: CollectionEventListener
Called before the elements will be added to the collection.

Specified by:
preAddEvent in interface CollectionEventListener<T>
Parameters:
toBeAdded - collection of items to be added, in case of one item this contains a collection with one item

postAddEvent

public void postAddEvent(java.util.Collection<T> alreadyAdded,
                         java.util.Collection<T> whereWereAdded)
Description copied from interface: CollectionEventListener
Called after the elements were added to the collection.

Specified by:
postAddEvent in interface CollectionEventListener<T>

preRemoveEvent

public void preRemoveEvent(java.util.Collection<T> toBeRemoved,
                           java.util.Collection<T> whereToRemove)
Description copied from interface: CollectionEventListener
Called before the elements will be removed from the collection.

Specified by:
preRemoveEvent in interface CollectionEventListener<T>

postRemoveEvent

public void postRemoveEvent(java.util.Collection<T> alreadyRemoved,
                            java.util.Collection<T> whereWereRemoved)
Description copied from interface: CollectionEventListener
Called after the elements were removed from the collection.

Specified by:
postRemoveEvent in interface CollectionEventListener<T>

changed

protected abstract void changed(java.util.Collection<T> collection,
                                java.util.Collection<T> added,
                                java.util.Collection<T> removed)
Called when a change occures on the collection.

Parameters:
collection - The changed collection.