org.viewaframework.binding.collection
Class EventList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by org.viewaframework.binding.collection.EventList<E>
Type Parameters:
U - Type of the elements this list contains
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess, ListModel

public class EventList<E>
extends ArrayList<E>
implements ListModel

This class is a regular ArrayList which post events each time an element is added, removed or updated.

Author:
Mario Garcia
See Also:
Serialized Form

Field Summary
static String ELEMENTS
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
EventList()
          Default constructor
EventList(Collection<E> c)
          Initializes the adapter with a collection of items
EventList(Collection<E> c, List<ListDataListener> listeners)
          Initializes the adapter with a collection of items and a list of listeners which are going to listen the list data changes.
EventList(int initialCapacity)
          Constructor establishing the initial capacity of the adapter
 
Method Summary
 boolean add(E e)
           
 void add(int index, E element)
           
 boolean addAll(Collection<? extends E> c)
           
 boolean addAll(int index, Collection<? extends E> c)
           
 void addListDataListener(ListDataListener l)
           
 void addPropertyChangeListener(PropertyChangeListener listener)
           
 void clear()
           
 boolean contains(Object o)
           
protected  void fireContentsChanged(Object source, int index0, int index1)
          This method keeps informed listeners of list data changes.
protected  void fireIntervalAdded(Object source, int index0, int index1)
          This method keeps informed listeners of list data changes.
protected  void fireIntervalRemoved(Object source, int index0, int index1)
          This method keeps informed listeners of list data changes.
 void firePropertyChange(PropertyChangeEvent evt)
           
 Object getElementAt(int index)
           
 String getName()
           
 List<PropertyChangeListener> getPropertyChangeListeners()
           
 int getSize()
           
 E remove(int index)
           
 boolean remove(Object o)
           
 void removeListDataListener(ListDataListener l)
           
 void removePropertyChangeListener(PropertyChangeListener listener)
           
protected  void removeRange(int fromIndex, int toIndex)
           
 E set(int index, E element)
           
 void setName(String name)
           
 
Methods inherited from class java.util.ArrayList
clone, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

ELEMENTS

public static final String ELEMENTS
See Also:
Constant Field Values
Constructor Detail

EventList

public EventList()
Default constructor


EventList

public EventList(Collection<E> c)
Initializes the adapter with a collection of items

Parameters:
c -

EventList

public EventList(Collection<E> c,
                 List<ListDataListener> listeners)
Initializes the adapter with a collection of items and a list of listeners which are going to listen the list data changes.

Parameters:
c - collection
listeners -

EventList

public EventList(int initialCapacity)
Constructor establishing the initial capacity of the adapter

Parameters:
initialCapacity -
Method Detail

add

public boolean add(E e)
Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<E>

add

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

addAll

public boolean addAll(Collection<? extends E> c)
Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface List<E>
Overrides:
addAll in class ArrayList<E>

addAll

public boolean addAll(int index,
                      Collection<? extends E> c)
Specified by:
addAll in interface List<E>
Overrides:
addAll in class ArrayList<E>

addListDataListener

public void addListDataListener(ListDataListener l)
Specified by:
addListDataListener in interface ListModel

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)

clear

public void clear()
Specified by:
clear in interface Collection<E>
Specified by:
clear in interface List<E>
Overrides:
clear in class ArrayList<E>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>
Specified by:
contains in interface List<E>
Overrides:
contains in class ArrayList<E>

fireContentsChanged

protected void fireContentsChanged(Object source,
                                   int index0,
                                   int index1)
This method keeps informed listeners of list data changes. Updates.

Parameters:
source - It will usually be this
index0 - The start
index1 - The end

fireIntervalAdded

protected void fireIntervalAdded(Object source,
                                 int index0,
                                 int index1)
This method keeps informed listeners of list data changes. Insertions.

Parameters:
source - It will usually be this
index0 - The start
index1 - The end

fireIntervalRemoved

protected void fireIntervalRemoved(Object source,
                                   int index0,
                                   int index1)
This method keeps informed listeners of list data changes. Deletions.

Parameters:
source - It will usually be this
index0 - The start
index1 - The end

firePropertyChange

public void firePropertyChange(PropertyChangeEvent evt)

getElementAt

public Object getElementAt(int index)
Specified by:
getElementAt in interface ListModel

getName

public String getName()

getPropertyChangeListeners

public List<PropertyChangeListener> getPropertyChangeListeners()

getSize

public int getSize()
Specified by:
getSize in interface ListModel

remove

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

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<E>
Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayList<E>

removeListDataListener

public void removeListDataListener(ListDataListener l)
Specified by:
removeListDataListener in interface ListModel

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)

removeRange

protected void removeRange(int fromIndex,
                           int toIndex)
Overrides:
removeRange in class ArrayList<E>

set

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

setName

public void setName(String name)


Copyright © 2010. All Rights Reserved.