org.springframework.binding.value.support
Class ListListModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by org.springframework.binding.value.support.ListListModel
All Implemented Interfaces:
Serializable, Iterable, Collection, List, ListModel, ObservableList
Direct Known Subclasses:
ComboBoxListModel, DynamicListModel

public class ListListModel
extends AbstractListModel
implements ObservableList

Author:
Keith Donald
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
ListListModel()
           
ListListModel(List items)
           
ListListModel(List items, Comparator sorter)
           
 
Method Summary
 void add(int index, Object o)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 boolean addAll(int index, Collection c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
protected  void fireContentsChanged(int index)
          Notifies the list model that one of the list elements has changed.
protected  void fireContentsChanged(int startIndex, int endIndex)
          Notifies the list model that one or more of the list elements have changed.
 Object get(int index)
           
 Object getElementAt(int index)
           
 IndexAdapter getIndexAdapter(int index)
           
protected  List getItems()
           
 int getSize()
           
protected  boolean hasChanged(Object oldElement, Object newElement)
          Determine if the provided objects are different (have changed).
 int indexOf(Object o)
           
 boolean isEmpty()
           
 Iterator iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 boolean replaceWith(Collection collection)
          Replace this list model's items with the contents of the provided collection.
 boolean retainAll(Collection c)
           
 Object set(int index, Object element)
          Set the value of a list element at the specified index.
 void setComparator(Comparator sorter)
           
 int size()
           
 void sort()
           
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Constructor Detail

ListListModel

public ListListModel()

ListListModel

public ListListModel(List items)

ListListModel

public ListListModel(List items,
                     Comparator sorter)
Method Detail

setComparator

public void setComparator(Comparator sorter)

sort

public void sort()

getItems

protected List getItems()

getSize

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

getElementAt

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

add

public void add(int index,
                Object o)
Specified by:
add in interface List

getIndexAdapter

public IndexAdapter getIndexAdapter(int index)
Specified by:
getIndexAdapter in interface ObservableList

add

public boolean add(Object o)
Specified by:
add in interface Collection
Specified by:
add in interface List

addAll

public boolean addAll(Collection c)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface List

addAll

public boolean addAll(int index,
                      Collection c)
Specified by:
addAll in interface List

clear

public void clear()
Specified by:
clear in interface Collection
Specified by:
clear in interface List

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection
Specified by:
contains in interface List

containsAll

public boolean containsAll(Collection c)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List

get

public Object get(int index)
Specified by:
get in interface List

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface List

remove

public Object remove(int index)
Specified by:
remove in interface List

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection
Specified by:
remove in interface List

removeAll

public boolean removeAll(Collection c)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List

retainAll

public boolean retainAll(Collection c)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List

set

public Object set(int index,
                  Object element)
Set the value of a list element at the specified index.

Specified by:
set in interface List
Parameters:
index - of element to set
element - New element value
Returns:
old element value

hasChanged

protected boolean hasChanged(Object oldElement,
                             Object newElement)
Determine if the provided objects are different (have changed). This method essentially embodies the "change semantics" for elements in this list. If list elements have an altered "equals" implementation, it may not be sufficient to detect changes in a pair of objects. In that case, you can override this method and implement whatever change detection mechanism is appropriate.

Parameters:
oldElement - Old (original) value to compare
newElement - New (updated) value to compare
Returns:
true if objects are different (have changed)

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List

subList

public List subList(int fromIndex,
                    int toIndex)
Specified by:
subList in interface List

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

fireContentsChanged

protected void fireContentsChanged(int index)
Notifies the list model that one of the list elements has changed.


fireContentsChanged

protected void fireContentsChanged(int startIndex,
                                   int endIndex)
Notifies the list model that one or more of the list elements have changed. The changed elements are specified by the range startIndex to endIndex inclusive.


replaceWith

public boolean replaceWith(Collection collection)
Replace this list model's items with the contents of the provided collection.

Parameters:
collection - The collection to replace with


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.