Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

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


java.lang.Object
  extended by 

java.util.AbstractCollection<E>
      extended by 

java.util.AbstractList
          extended by 
org.eclipse.core.databinding.observable.list.AbstractObservableList
All Implemented Interfaces:
Iterable, Collection, List, IObservable, IObservableCollection, IObservableList
Direct Known Subclasses:
ComputedList, MultiList

public abstract class AbstractObservableList
extends AbstractList
implements IObservableList

Subclasses should override at least get(int index) and size().

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
 
Fields inherited from class java.util. AbstractList
modCount
 
Constructor Summary
AbstractObservableList ()
           
AbstractObservableList ( Realm realm)
           
 
Method Summary
 boolean add ( Object o)
           
 boolean addAll ( Collection c)
           
 boolean addAll (int index, Collection c)
           
 void addChangeListener ( IChangeListener listener)
          Adds the given change listener to the list of change listeners.
 void addDisposeListener ( IDisposeListener listener)
          Adds the given dispose listener to the list of dispose listeners.
 void addListChangeListener ( IListChangeListener listener)
          Adds the given list change listener to the list of list change listeners.
 void addStaleListener ( IStaleListener listener)
          Adds the given stale listener to the list of stale listeners.
protected  void checkRealm ()
          Asserts that the realm is the current realm.
 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.
protected abstract  int doGetSize ()
           
 boolean equals ( Object o)
           
protected  void fireChange ()
          Fires change event.
protected  void fireListChange ( ListDiff diff)
           
protected  void fireStale ()
          Fires stale event.
protected  void firstListenerAdded ()
           
  Realm getRealm ()
          Returns the realm for this observable.
 int hashCode ()
           
protected  boolean hasListeners ()
          Returns whether this observable list has any registered listeners.
 int indexOf ( Object o)
           
 boolean isDisposed ()
          Returns whether the observable has been disposed
 boolean isEmpty ()
           
 boolean isStale ()
          Returns whether the state of this observable is stale and is expected to change soon.
  Iterator iterator ()
           
 int lastIndexOf ( Object o)
           
protected  void lastListenerRemoved ()
           
  Object move (int oldIndex, int newIndex)
          Moves the element located at oldIndex to newIndex.
 boolean remove ( Object o)
           
 boolean removeAll ( Collection c)
           
 void removeChangeListener ( IChangeListener listener)
          Removes the given change listener from the list of change listeners.
 void removeDisposeListener ( IDisposeListener listener)
          Removes the given dispose listener from the list of dispose listeners.
 void removeListChangeListener ( IListChangeListener listener)
          Removes the given list change listener from the list of list change listeners.
 void removeStaleListener ( IStaleListener listener)
          Removes the given stale listener from the list of stale listeners.
 boolean retainAll ( Collection c)
           
 int size ()
           
  Object[] toArray ()
           
  Object[] toArray ( Object[] a)
           
 
Methods inherited from class java.util. AbstractList
add, clear, get, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util. AbstractCollection
toString
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.databinding.observable.list. IObservableList
get, getElementType, listIterator, listIterator, remove, set, subList
 
Methods inherited from interface java.util. List
add, clear
 

Constructor Detail

AbstractObservableList

public AbstractObservableList(
Realm realm)
Parameters:
realm -

AbstractObservableList

public AbstractObservableList()
Method Detail

hasListeners

protected boolean hasListeners()
Returns whether this observable list has any registered listeners.

Returns:
whether this observable list has any registered listeners.
Since:
1.2

isStale

public boolean isStale()
Description copied from interface: IObservable
Returns whether the state of this observable is stale and is expected to change soon. A non-stale observable that becomes stale will notify its stale listeners. A stale object that becomes non-stale does so by changing its state and notifying its change listeners, it does not notify its stale listeners about becoming non-stale. Clients that do not expect asynchronous changes may ignore staleness of observable objects.

Specified by:
isStale in interface IObservable
Returns:
true if this observable's state is stale and will change soon.

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)

addChangeListener

public void addChangeListener(
IChangeListener listener)
Description copied from interface: IObservable
Adds the given change listener to the list of change listeners. Change listeners are notified about changes of the state of this observable in a generic way, without specifying the change that happened. To get the changed state, a change listener needs to query for the current state of this observable.

Specified by:
addChangeListener in interface IObservable

removeChangeListener

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

Specified by:
removeChangeListener in interface IObservable

addStaleListener

public void addStaleListener(
IStaleListener listener)
Description copied from interface: IObservable
Adds the given stale listener to the list of stale listeners. Stale listeners are notified when an observable object becomes stale, not when is becomes non-stale.

Specified by:
addStaleListener in interface IObservable
See Also:
IObservable.isStale()

removeStaleListener

public void removeStaleListener(
IStaleListener listener)
Description copied from interface: IObservable
Removes the given stale listener from the list of stale listeners. Has no effect if the given listener is not registered as a stale listener.

Specified by:
removeStaleListener in interface IObservable

addDisposeListener

public void addDisposeListener(
IDisposeListener listener)
Description copied from interface: IObservable
Adds the given dispose listener to the list of dispose listeners. Dispose listeners are notified when an observable has been disposed.

Specified by:
addDisposeListener in interface IObservable
Parameters:
listener - the listener to add
Since:
1.2

removeDisposeListener

public void removeDisposeListener(
IDisposeListener listener)
Description copied from interface: IObservable
Removes the given dispose listener from the list of dispose listeners. Has no effect if the given listener is not registered as a dispose listener.

Specified by:
removeDisposeListener in interface IObservable
Parameters:
listener - the listener to remove
Since:
1.2

fireChange

protected void fireChange()
Fires change event. Must be invoked from the current realm.


fireStale

protected void fireStale()
Fires stale event. Must be invoked from the current realm.


firstListenerAdded

protected void firstListenerAdded()

lastListenerRemoved

protected void lastListenerRemoved()

isDisposed

public boolean isDisposed()
Description copied from interface: IObservable
Returns whether the observable has been disposed

Specified by:
isDisposed in interface IObservable
Returns:
whether the observable has been disposed
Since:
1.2

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

size

public final int size()
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in interface IObservableList
Specified by:
size in class AbstractCollection

doGetSize

protected abstract int doGetSize()
Returns:
the size

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List
Specified by:
isEmpty in interface IObservableList
Overrides:
isEmpty in class AbstractCollection

contains

public boolean contains(
Object o)
Specified by:
contains in interface Collection
Specified by:
contains in interface List
Specified by:
contains in interface IObservableList
Overrides:
contains in class AbstractCollection

iterator

public 
Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List
Specified by:
iterator in interface IObservableList
Overrides:
iterator in class AbstractList

toArray

public 
Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Specified by:
toArray in interface IObservableList
Overrides:
toArray in class AbstractCollection

toArray

public 
Object[] toArray(
Object[] a)
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Specified by:
toArray in interface IObservableList
Overrides:
toArray in class AbstractCollection

add

public boolean add(
Object o)
Specified by:
add in interface Collection
Specified by:
add in interface List
Specified by:
add in interface IObservableList
Overrides:
add in class AbstractList

move

public 
Object move(int oldIndex,
                   int newIndex)
Moves the element located at oldIndex to newIndex. This method is equivalent to calling add(newIndex, remove(oldIndex)).

Subclasses should override this method to deliver list change notification for the remove and add operations in the same ListChangeEvent, as this allows ListDiff.accept(ListDiffVisitor) to recognize the operation as a move.

Specified by:
move in interface IObservableList
Parameters:
oldIndex - the element's position before the move. Must be within the range 0 <= oldIndex < size().
newIndex - the element's position after the move. Must be within the range 0 <= newIndex < size().
Returns:
the element that was moved.
Throws:
IndexOutOfBoundsException - if either argument is out of range (0 <= index < size()).
Since:
1.1
See Also:
ListDiffVisitor.handleMove(int, int, Object), ListDiff.accept(ListDiffVisitor)

remove

public boolean remove(
Object o)
Specified by:
remove in interface Collection
Specified by:
remove in interface List
Specified by:
remove in interface IObservableList
Overrides:
remove in class AbstractCollection

containsAll

public boolean containsAll(
Collection c)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List
Specified by:
containsAll in interface IObservableList
Overrides:
containsAll in class AbstractCollection

addAll

public boolean addAll(
Collection c)
Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Specified by:
addAll in interface IObservableList
Overrides:
addAll in class AbstractCollection

addAll

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

removeAll

public boolean removeAll(
Collection c)
Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Specified by:
removeAll in interface IObservableList
Overrides:
removeAll in class AbstractCollection

retainAll

public boolean retainAll(
Collection c)
Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Specified by:
retainAll in interface IObservableList
Overrides:
retainAll in class AbstractCollection

equals

public boolean equals(
Object o)
Specified by:
equals in interface Collection
Specified by:
equals in interface List
Specified by:
equals in interface IObservableList
Overrides:
equals in class AbstractList

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection
Specified by:
hashCode in interface List
Specified by:
hashCode in interface IObservableList
Overrides:
hashCode in class AbstractList

indexOf

public int indexOf(
Object o)
Specified by:
indexOf in interface List
Specified by:
indexOf in interface IObservableList
Overrides:
indexOf in class AbstractList

lastIndexOf

public int lastIndexOf(
Object o)
Specified by:
lastIndexOf in interface List
Specified by:
lastIndexOf in interface IObservableList
Overrides:
lastIndexOf in class AbstractList

getRealm

public 
Realm getRealm()
Description copied from interface: IObservable
Returns the realm for this observable. Unless otherwise specified, getters and setters must be accessed from within this realm. Listeners will be within this realm when they receive events from this observable.

Because observables can only be accessed from within one realm, and they always fire events on that realm, their state can be observed in an incremental way. It is always safe to call getters of an observable from within a change listener attached to that observable.

Specified by:
getRealm in interface IObservable
Returns:
the realm

checkRealm

protected void checkRealm()
Asserts that the realm is the current realm.

Throws:
AssertionFailedException - if the realm is not the current realm
See Also:
Realm.isCurrent()

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire