Eclipse Platform
Release 3.3

org.eclipse.core.databinding.observable.list
Class ObservableList

java.lang.Object
  extended byorg.eclipse.core.databinding.observable.ChangeManager
      extended byorg.eclipse.core.databinding.observable.AbstractObservable
          extended byorg.eclipse.core.databinding.observable.list.ObservableList
All Implemented Interfaces:
Collection, IObservable, IObservableCollection, IObservableList, List
Direct Known Subclasses:
WritableList

public abstract class ObservableList
extends AbstractObservable
implements IObservableList

Abstract implementation of IObservableList, based on an underlying regular list.

This class is thread safe. All state accessing methods must be invoked from the current realm. Methods for adding and removing listeners may be invoked from any thread.

Since:
1.0

Field Summary
protected  List wrappedList
           
 
Constructor Summary
protected ObservableList(List wrappedList, Object elementType)
           
protected ObservableList(Realm realm, List wrappedList, Object elementType)
           
 
Method Summary
 void add(int index, Object element)
           
 boolean add(Object o)
           
 boolean addAll(Collection c)
           
 boolean addAll(int index, Collection c)
           
 void addListChangeListener(IListChangeListener listener)
          Adds the given list change listener to the list of list change listeners.
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 void dispose()
          Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.
 boolean equals(Object o)
           
protected  void fireChange()
           
protected  void fireListChange(ListDiff diff)
           
 Object get(int index)
           
 Object getElementType()
           
protected  void getterCalled()
           
 int hashCode()
           
 int indexOf(Object o)
           
 boolean isEmpty()
           
 boolean isStale()
          Returns the stale state.
 Iterator iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int index)
           
 Object remove(int index)
           
 boolean remove(Object o)
           
 boolean removeAll(Collection c)
           
 void removeListChangeListener(IListChangeListener listener)
          Removes the given list change listener from the list of list change listeners.
 boolean retainAll(Collection c)
           
 Object set(int index, Object element)
           
 void setStale(boolean stale)
          Sets the stale state.
 int size()
           
 List subList(int fromIndex, int toIndex)
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 String toString()
           
protected  void updateWrappedList(List newList)
           
 
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addListener, addStaleListener, checkRealm, fireEvent, fireStale, firstListenerAdded, getRealm, hasListeners, lastListenerRemoved, removeChangeListener, removeListener, removeStaleListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addStaleListener, getRealm, removeChangeListener, removeStaleListener
 

Field Detail

wrappedList

protected List wrappedList
Constructor Detail

ObservableList

protected ObservableList(List wrappedList,
                         Object elementType)

ObservableList

protected ObservableList(Realm realm,
                         List wrappedList,
                         Object elementType)
Method Detail

addListChangeListener

public void addListChangeListener(IListChangeListener listener)
Description copied from interface: IObservableList
Adds the given list change listener to the list of list change listeners.

Specified by:
addListChangeListener in interface IObservableList
Parameters:
listener -

removeListChangeListener

public void removeListChangeListener(IListChangeListener listener)
Description copied from interface: IObservableList
Removes the given list change listener from the list of list change listeners. Has no effect if the given listener is not registered as a list change listener.

Specified by:
removeListChangeListener in interface IObservableList
Parameters:
listener -

fireListChange

protected void fireListChange(ListDiff diff)

contains

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

containsAll

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

equals

public boolean equals(Object o)
Specified by:
equals in interface IObservableList

hashCode

public int hashCode()
Specified by:
hashCode in interface IObservableList

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface IObservableList

iterator

public Iterator iterator()
Specified by:
iterator in interface IObservableList

size

public int size()
Specified by:
size in interface IObservableList

toArray

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

toArray

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

toString

public String toString()

get

public Object get(int index)
Specified by:
get in interface IObservableList
"TrackedGetter"

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface IObservableList
"TrackedGetter"

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface IObservableList
"TrackedGetter"

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface IObservableList
"TrackedGetter"

listIterator

public ListIterator listIterator(int index)
Specified by:
listIterator in interface IObservableList
"TrackedGetter"

subList

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

getterCalled

protected void getterCalled()

set

public Object set(int index,
                  Object element)
Specified by:
set in interface IObservableList

remove

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

add

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

add

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

addAll

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

addAll

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

remove

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

removeAll

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

retainAll

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

clear

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

isStale

public boolean isStale()
Returns the stale state. Must be invoked from the current realm.

Specified by:
isStale in interface IObservable
Returns:
stale state

setStale

public void setStale(boolean stale)
Sets the stale state. Must be invoked from the current realm.

Parameters:
stale - The stale state to list. This will fire a stale event if the given boolean is true and this observable list was not already stale.

fireChange

protected void fireChange()
Overrides:
fireChange in class AbstractObservable

dispose

public void dispose()
Description copied from interface: IObservable
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.

Specified by:
dispose in interface IObservable
Overrides:
dispose in class AbstractObservable

getElementType

public Object getElementType()
Specified by:
getElementType in interface IObservableList
Returns:
the type of the elements or null if untyped

updateWrappedList

protected void updateWrappedList(List newList)

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.