org.dishevelled.observable.impl
Class ObservableCollectionImpl<E>

java.lang.Object
  extended by org.dishevelled.observable.AbstractCollectionDecorator<E>
      extended by org.dishevelled.observable.AbstractObservableCollection<E>
          extended by org.dishevelled.observable.impl.ObservableCollectionImpl<E>
Type Parameters:
E - collection element type
All Implemented Interfaces:
Iterable<E>, Collection<E>, ObservableCollection<E>

public class ObservableCollectionImpl<E>
extends AbstractObservableCollection<E>

Observable collection decorator that fires empty vetoable collection change events in preXxx methods and empty collection change events in postXxx methods. Observable collection listeners may query the source of events to determine what may or may not have changed due to the event.

Version:
$Revision$ $Date$
Author:
Michael Heuer

Constructor Summary
ObservableCollectionImpl(Collection<E> collection)
          Create a new observable decorator for the specified collection.
 
Method Summary
protected  void postAdd(E e)
          Notify subclasses the add method has just been called on the wrapped collection with the specified parameter.
protected  void postAddAll(Collection<? extends E> coll)
          Notify subclasses the addAll method has just been called on the wrapped collection with the specified parameter.
protected  void postClear()
          Notify subclasses the clear method has just been called on the wrapped collection.
protected  void postIteratorRemove()
          Notify subclasses the remove method has just been called on the wrapped collection's iterator.
protected  void postRemove(Object o)
          Notify subclasses the remove method has just been called on the wrapped collection with the specified parameter.
protected  void postRemoveAll(Collection<?> coll)
          Notify subclasses the removeAll method has just been called on the wrapped collection with the specified parameter.
protected  void postRetainAll(Collection<?> coll)
          Notify subclasses the retainAll method has just been called on the wrapped collection with the specified parameter.
protected  boolean preAdd(E e)
          Notify subclasses the add method is about to be called on the wrapped collection with the specified parameter.
protected  boolean preAddAll(Collection<? extends E> coll)
          Notify subclasses the addAll method is about to be called on the wrapped collection with the specified parameter.
protected  boolean preClear()
          Notify subclasses the clear method is about to be called on the wrapped collection.
protected  boolean preIteratorRemove()
          Notify subclasses the remove method is about to be called on the wrapped collection's iterator.
protected  boolean preRemove(Object o)
          Notify subclasses the remove method is about to be called on the wrapped collection with the specified parameter.
protected  boolean preRemoveAll(Collection<?> coll)
          Notify subclasses the removeAll method is about to be called on the wrapped collection with the specified parameter.
protected  boolean preRetainAll(Collection<?> coll)
          Notify subclasses the retainAll method is about to be called on the wrapped collection with the specified parameter.
 
Methods inherited from class org.dishevelled.observable.AbstractObservableCollection
add, addAll, addCollectionChangeListener, addVetoableCollectionChangeListener, clear, fireCollectionChanged, fireCollectionChanged, fireCollectionWillChange, fireCollectionWillChange, getCollectionChangeListenerCount, getCollectionChangeListeners, getObservableCollectionChangeSupport, getVetoableCollectionChangeListenerCount, getVetoableCollectionChangeListeners, iterator, remove, removeAll, removeCollectionChangeListener, removeVetoableCollectionChangeListener, retainAll
 
Methods inherited from class org.dishevelled.observable.AbstractCollectionDecorator
contains, containsAll, equals, getCollection, hashCode, isEmpty, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, isEmpty, size, toArray, toArray
 

Constructor Detail

ObservableCollectionImpl

public ObservableCollectionImpl(Collection<E> collection)
Create a new observable decorator for the specified collection.

Parameters:
collection - collection to decorate, must not be null
Method Detail

preAdd

protected boolean preAdd(E e)
Notify subclasses the add method is about to be called on the wrapped collection with the specified parameter. Return true to proceed with the change.

Specified by:
preAdd in class AbstractObservableCollection<E>
Parameters:
e - add method parameter
Returns:
true to proceed with the change

postAdd

protected void postAdd(E e)
Notify subclasses the add method has just been called on the wrapped collection with the specified parameter.

Specified by:
postAdd in class AbstractObservableCollection<E>
Parameters:
e - add method parameter

preAddAll

protected boolean preAddAll(Collection<? extends E> coll)
Notify subclasses the addAll method is about to be called on the wrapped collection with the specified parameter. Return true to proceed with the change.

Specified by:
preAddAll in class AbstractObservableCollection<E>
Parameters:
coll - addAll method parameter
Returns:
true to proceed with the change

postAddAll

protected void postAddAll(Collection<? extends E> coll)
Notify subclasses the addAll method has just been called on the wrapped collection with the specified parameter.

Specified by:
postAddAll in class AbstractObservableCollection<E>
Parameters:
coll - addAll method parameter

preClear

protected boolean preClear()
Notify subclasses the clear method is about to be called on the wrapped collection. Return true to proceed with the change.

Specified by:
preClear in class AbstractObservableCollection<E>
Returns:
true to proceed with the change

postClear

protected void postClear()
Notify subclasses the clear method has just been called on the wrapped collection.

Specified by:
postClear in class AbstractObservableCollection<E>

preRemove

protected boolean preRemove(Object o)
Notify subclasses the remove method is about to be called on the wrapped collection with the specified parameter. Return true to proceed with the change.

Specified by:
preRemove in class AbstractObservableCollection<E>
Parameters:
o - remove method parameter
Returns:
true to proceed with the change

postRemove

protected void postRemove(Object o)
Notify subclasses the remove method has just been called on the wrapped collection with the specified parameter.

Specified by:
postRemove in class AbstractObservableCollection<E>
Parameters:
o - remove method parameter

preRemoveAll

protected boolean preRemoveAll(Collection<?> coll)
Notify subclasses the removeAll method is about to be called on the wrapped collection with the specified parameter. Return true to proceed with the change.

Specified by:
preRemoveAll in class AbstractObservableCollection<E>
Parameters:
coll - removeAll method parameter
Returns:
true to proceed with the change

postRemoveAll

protected void postRemoveAll(Collection<?> coll)
Notify subclasses the removeAll method has just been called on the wrapped collection with the specified parameter.

Specified by:
postRemoveAll in class AbstractObservableCollection<E>
Parameters:
coll - removeAll method parameter

preRetainAll

protected boolean preRetainAll(Collection<?> coll)
Notify subclasses the retainAll method is about to be called on the wrapped collection with the specified parameter. Return true to proceed with the change.

Specified by:
preRetainAll in class AbstractObservableCollection<E>
Parameters:
coll - retainAll method parameter
Returns:
true to proceed with the change

postRetainAll

protected void postRetainAll(Collection<?> coll)
Notify subclasses the retainAll method has just been called on the wrapped collection with the specified parameter.

Specified by:
postRetainAll in class AbstractObservableCollection<E>
Parameters:
coll - retainAll method parameter

preIteratorRemove

protected boolean preIteratorRemove()
Notify subclasses the remove method is about to be called on the wrapped collection's iterator. Return true to proceed with the change.

Specified by:
preIteratorRemove in class AbstractObservableCollection<E>
Returns:
true to proceed with the change

postIteratorRemove

protected void postIteratorRemove()
Notify subclasses the remove method has just been called on the wrapped collection's iterator.

Specified by:
postIteratorRemove in class AbstractObservableCollection<E>


Copyright (c) 2003-2012 held jointly by the individual authors. Licensed under the GNU Lesser General Public License (LGPL).