Sofia API Reference

  • Package Index
  • Class Index
  • Packages
  • sofia.app
  • sofia.content
  • sofia.data
  • sofia.graphics
  • sofia.util
    • Classes
    • Observable
    • ObservableList
    • Random
    • Timer
  • sofia.view
  • sofia.widget

public class
ObservableList

extends Observable
implements List<E>

Inheritance

  • java.lang.Object
    • sofia.util.Observable
      • sofia.util.ObservableList<E>

Class Overview

An implementation of the List interface that is Observable and notifies its observers whenever the collection is changed.

Users of this class can add themselves as observers to an instance of this class and they will be notified when the structure of the list changes; that is, when items are added, removed, or replaced.


Summary

Public Constructors
ObservableList()
Creates a new ObservableList that is backed by an ArrayList with default capacity.
ObservableList(int capacity)
Creates a new ObservableList that is backed by an ArrayList with the specified capacity.
ObservableList(List<E> listToWrap)
Creates a new ObservableList that provides an observable view of an existing list.
ObservableList(Collection<? extends E> collection)
Creates a new ObservableList that is initialized with a copy of the data in the specified collection.
Public Methods
boolean add(E item)
void add(int index, E item)
boolean addAll(Collection<? extends E> collection)
boolean addAll(int index, Collection<? extends E> collection)
void clear()
boolean contains(Object object)
boolean containsAll(Collection<?> collection)
E get(int index)
int indexOf(Object object)
boolean isEmpty()
Iterator<E> iterator()
int lastIndexOf(Object object)
ListIterator<E> listIterator(int index)
ListIterator<E> listIterator()
E remove(int index)
boolean remove(Object object)
boolean removeAll(Collection<?> collection)
boolean retainAll(Collection<?> collection)
E set(int index, E item)
int size()
List<E> subList(int start, int end)
<T> T[] toArray(T[] array)
Object[] toArray()
Methods inherited from class sofia.util.Observable
synchronized void addObserver(Object observer, String method)

Adds the specified object observer to the set of observers for this object, but using a method name different from the default.

synchronized void addObserver(Object observer)

Adds the specified object observer to the set of observers for this object.

synchronized void clearObservers()
Removes all observers from the receiver.
void notifyObservers(Object... arguments)

Notifies all observers of the receiver that a change has occurred affecting the state of the object.

synchronized void removeObserver(Object observer, String method)
Removes the specified object's named method from the set of observers for the receiver.
synchronized void removeObserver(Object observer)
Removes the specified object's changeWasObserved method from the set of observers for the receiver.
Methods inherited from class java.lang.Object
Object clone()
boolean equals(Object arg0)
void finalize()
final Class<?> getClass()
int hashCode()
final void notify()
final void notifyAll()
String toString()
final void wait()
final void wait(long arg0, int arg1)
final void wait(long arg0)
Methods inherited from interface java.lang.Iterable
abstract Iterator<T> iterator()
Methods inherited from interface java.util.Collection
abstract boolean add(E arg0)
abstract boolean addAll(Collection<? extends E> arg0)
abstract void clear()
abstract boolean contains(Object arg0)
abstract boolean containsAll(Collection<?> arg0)
abstract boolean equals(Object arg0)
abstract int hashCode()
abstract boolean isEmpty()
abstract Iterator<E> iterator()
abstract boolean remove(Object arg0)
abstract boolean removeAll(Collection<?> arg0)
abstract boolean retainAll(Collection<?> arg0)
abstract int size()
abstract <T> T[] toArray(T[] arg0)
abstract Object[] toArray()
Methods inherited from interface java.util.List
abstract boolean add(E arg0)
abstract void add(int arg0, E arg1)
abstract boolean addAll(Collection<? extends E> arg0)
abstract boolean addAll(int arg0, Collection<? extends E> arg1)
abstract void clear()
abstract boolean contains(Object arg0)
abstract boolean containsAll(Collection<?> arg0)
abstract boolean equals(Object arg0)
abstract E get(int arg0)
abstract int hashCode()
abstract int indexOf(Object arg0)
abstract boolean isEmpty()
abstract Iterator<E> iterator()
abstract int lastIndexOf(Object arg0)
abstract ListIterator<E> listIterator(int arg0)
abstract ListIterator<E> listIterator()
abstract E remove(int arg0)
abstract boolean remove(Object arg0)
abstract boolean removeAll(Collection<?> arg0)
abstract boolean retainAll(Collection<?> arg0)
abstract E set(int arg0, E arg1)
abstract int size()
abstract List<E> subList(int arg0, int arg1)
abstract <T> T[] toArray(T[] arg0)
abstract Object[] toArray()

Public Constructors

public ObservableList ()

Creates a new ObservableList that is backed by an ArrayList with default capacity.

public ObservableList (int capacity)

Creates a new ObservableList that is backed by an ArrayList with the specified capacity.

Parameters
capacity
the capacity of the array list
public ObservableList (List<E> listToWrap)

Creates a new ObservableList that provides an observable view of an existing list. The list passed to this constructor is not copied; changes made to the observable list will also be reflected in the list being wrapped, and vice versa.

Parameters
listToWrap
the list to wrap with an observable front-end
public ObservableList (Collection<? extends E> collection)

Creates a new ObservableList that is initialized with a copy of the data in the specified collection. Since this constructor creates a copy, changes to the observable list will not be reflected in the source collection, and vice versa.

Parameters
collection
the collection to be copied into the new list

Public Methods

public boolean add (E item)

public void add (int index, E item)

public boolean addAll (Collection<? extends E> collection)

public boolean addAll (int index, Collection<? extends E> collection)

public void clear ()

public boolean contains (Object object)

public boolean containsAll (Collection<?> collection)

public E get (int index)

public int indexOf (Object object)

public boolean isEmpty ()

public Iterator<E> iterator ()

public int lastIndexOf (Object object)

public ListIterator<E> listIterator (int index)

public ListIterator<E> listIterator ()

public E remove (int index)

public boolean remove (Object object)

public boolean removeAll (Collection<?> collection)

public boolean retainAll (Collection<?> collection)

public E set (int index, E item)

public int size ()

public List<E> subList (int start, int end)

public T[] toArray (T[] array)

public Object[] toArray ()