it.amattioli.dominate.properties
Class BoundListDecorator<T>

Show UML class diagram
java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<T>
          extended by it.amattioli.dominate.properties.BoundListDecorator<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>

public class BoundListDecorator<T>
extends AbstractList<T>

A decorator for lists that fires an event every time the collection or one of its elements is modified.

If a collection is decorated with this class when the AbstractList.add(Object), set(int, Object) or remove(int) method is called a CollectionChangeEvent is fired and every CollectionChangeListener registered using the addCollectionChangeListener(CollectionChangeListener) method is notified. The same happens every time one of the elements of the collection fires a PropertyChangeEvent.

Author:
andrea

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
BoundListDecorator(List<T> decorated)
           
 
Method Summary
 void add(int index, T element)
           
 void addCollectionChangeListener(CollectionChangeListener listener)
           
 T get(int index)
           
 T remove(int index)
           
 void removeCollectionChangeListener(CollectionChangeListener listener)
           
 T set(int index, T element)
           
 int size()
           
 
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

BoundListDecorator

public BoundListDecorator(List<T> decorated)
Method Detail

get

public T get(int index)
Specified by:
get in interface List<T>
Specified by:
get in class AbstractList<T>

add

public void add(int index,
                T element)
Specified by:
add in interface List<T>
Overrides:
add in class AbstractList<T>

remove

public T remove(int index)
Specified by:
remove in interface List<T>
Overrides:
remove in class AbstractList<T>

set

public T set(int index,
             T element)
Specified by:
set in interface List<T>
Overrides:
set in class AbstractList<T>

size

public int size()
Specified by:
size in interface Collection<T>
Specified by:
size in interface List<T>
Specified by:
size in class AbstractCollection<T>

addCollectionChangeListener

public void addCollectionChangeListener(CollectionChangeListener listener)

removeCollectionChangeListener

public void removeCollectionChangeListener(CollectionChangeListener listener)


Copyright © 2011. All Rights Reserved.