Eclipse Platform
Release 3.3

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

java.lang.Object
  extended by org.eclipse.core.databinding.observable.AbstractObservable
      extended by org.eclipse.core.databinding.observable.list.ObservableList
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.List, IObservable, IObservableCollection, IObservableList
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  java.util.List wrappedList
           
 
Constructor Summary
protected ObservableList(java.util.List wrappedList, java.lang.Object elementType)
           
protected ObservableList(Realm realm, java.util.List wrappedList, java.lang.Object elementType)
           
 
Method Summary
 void add(int index, java.lang.Object element)
           
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addAll(int index, java.util.Collection c)
           
 void addListChangeListener(IListChangeListener listener)
          Adds the given list change listener to the list of list change listeners.
protected  void addListener(java.lang.Object listenerType, IObservablesListener listener)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.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(java.lang.Object o)
           
protected  void fireChange()
           
protected  void fireEvent(ObservableEvent event)
           
protected  void fireListChange(ListDiff diff)
           
protected  void firstListenerAdded()
           
 java.lang.Object get(int index)
           
 java.lang.Object getElementType()
           
 Realm getRealm()
           
protected  void getterCalled()
           
 int hashCode()
           
protected  boolean hasListeners()
           
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 boolean isStale()
          Returns the stale state.
 java.util.Iterator iterator()
           
 int lastIndexOf(java.lang.Object o)
           
protected  void lastListenerRemoved()
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 void removeListChangeListener(IListChangeListener listener)
          Removes the given list change listener from the list of list change listeners.
protected  void removeListener(java.lang.Object listenerType, IObservablesListener listener)
           
 boolean retainAll(java.util.Collection c)
           
 java.lang.Object set(int index, java.lang.Object element)
           
 void setStale(boolean stale)
          Sets the stale state.
 int size()
           
 java.util.List subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] a)
           
 java.lang.String toString()
           
protected  void updateWrappedList(java.util.List newList)
           
 
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addStaleListener, checkRealm, fireStale, removeChangeListener, 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 java.util.List wrappedList
Constructor Detail

ObservableList

protected ObservableList(java.util.List wrappedList,
                         java.lang.Object elementType)

ObservableList

protected ObservableList(Realm realm,
                         java.util.List wrappedList,
                         java.lang.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

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

fireListChange

protected void fireListChange(ListDiff diff)

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.List
Specified by:
contains in interface IObservableList

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.List
Specified by:
containsAll in interface IObservableList

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.List
Specified by:
equals in interface IObservableList
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.List
Specified by:
hashCode in interface IObservableList
Overrides:
hashCode in class java.lang.Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.List
Specified by:
isEmpty in interface IObservableList

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.List
Specified by:
iterator in interface IObservableList

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List
Specified by:
size in interface IObservableList

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.List
Specified by:
toArray in interface IObservableList

toArray

public java.lang.Object[] toArray(java.lang.Object[] a)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.List
Specified by:
toArray in interface IObservableList

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

get

public java.lang.Object get(int index)
Specified by:
get in interface java.util.List
Specified by:
get in interface IObservableList
"TrackedGetter"

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List
Specified by:
indexOf in interface IObservableList
"TrackedGetter"

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List
Specified by:
lastIndexOf in interface IObservableList
"TrackedGetter"

listIterator

public java.util.ListIterator listIterator()
Specified by:
listIterator in interface java.util.List
Specified by:
listIterator in interface IObservableList
"TrackedGetter"

listIterator

public java.util.ListIterator listIterator(int index)
Specified by:
listIterator in interface java.util.List
Specified by:
listIterator in interface IObservableList
"TrackedGetter"

subList

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

getterCalled

protected void getterCalled()

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Specified by:
set in interface java.util.List
Specified by:
set in interface IObservableList

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List
Specified by:
remove in interface IObservableList

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.List
Specified by:
add in interface IObservableList

add

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

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.List
Specified by:
addAll in interface IObservableList

addAll

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

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.List
Specified by:
remove in interface IObservableList

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.List
Specified by:
removeAll in interface IObservableList

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.List
Specified by:
retainAll in interface IObservableList

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.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 java.lang.Object getElementType()
Specified by:
getElementType in interface IObservableCollection
Specified by:
getElementType in interface IObservableList
Returns:
the element type of this observable value, or null if this observable collection is untyped.

updateWrappedList

protected void updateWrappedList(java.util.List newList)

addListener

protected void addListener(java.lang.Object listenerType,
                           IObservablesListener listener)
Parameters:
listenerType -
listener -

removeListener

protected void removeListener(java.lang.Object listenerType,
                              IObservablesListener listener)
Parameters:
listenerType -
listener -

hasListeners

protected boolean hasListeners()

fireEvent

protected void fireEvent(ObservableEvent event)

firstListenerAdded

protected void firstListenerAdded()

lastListenerRemoved

protected void lastListenerRemoved()

getRealm

public Realm getRealm()
Returns:
Returns the realm.

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

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