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

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 WritableList

java.lang.Object
  extended by 

org.eclipse.core.databinding.observable.AbstractObservable
      extended by 

org.eclipse.core.databinding.observable.list.ObservableList
          extended by 
org.eclipse.core.databinding.observable.list.WritableList
All Implemented Interfaces:
Iterable, Collection, List, IObservable, IObservableCollection, IObservableList

public class WritableList
extends ObservableList

Mutable observable list backed by an ArrayList.

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 org.eclipse.core.databinding.observable.list. ObservableList
wrappedList
 
Constructor Summary
WritableList ()
          Creates an empty writable list in the default realm with a null element type.
WritableList ( Collection collection, Object elementType)
          Constructs a new instance in the default realm containing the elements of the given collection.
WritableList ( List toWrap, Object elementType)
          Constructs a new instance with the default realm.
WritableList ( Realm realm)
          Creates an empty writable list with a null element type.
WritableList ( Realm realm, Collection collection, Object elementType)
          Constructs a new instance in the default realm containing the elements of the given collection.
WritableList ( Realm realm, List toWrap, Object elementType)
          Creates a writable list containing elements of the given type, wrapping an existing client-supplied list.
 
Method Summary
 void add (int index, Object element)
           
 boolean add ( Object element)
           
 boolean addAll ( Collection c)
           
 boolean addAll (int index, Collection c)
           
protected  void addListener ( Object listenerType, IObservablesListener listener)
           
 void clear ()
           
protected   Object clone ()
           
protected  void fireEvent ( ObservableEvent event)
           
protected  void firstListenerAdded ()
           
  Realm getRealm ()
           
protected  boolean hasListeners ()
           
protected  void lastListenerRemoved ()
           
  Object move (int oldIndex, int newIndex)
          Moves the element located at oldIndex to newIndex.
  Object remove (int index)
           
 boolean remove ( Object o)
           
 boolean removeAll ( Collection c)
           
protected  void removeListener ( Object listenerType, IObservablesListener listener)
           
 boolean retainAll ( Collection c)
           
  Object set (int index, Object element)
           
static  WritableList withElementType ( Object elementType)
           
 
Methods inherited from class org.eclipse.core.databinding.observable.list. ObservableList
addListChangeListener, contains, containsAll, dispose, equals, fireChange, fireListChange, get, getElementType, getterCalled, hashCode, indexOf, isEmpty, isStale, iterator, lastIndexOf, listIterator, listIterator, removeListChangeListener, setStale, size, subList, toArray, toArray, toString, updateWrappedList
 
Methods inherited from class org.eclipse.core.databinding.observable. AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
 
Methods inherited from class java.lang. Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.databinding.observable. IObservable
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
 

Constructor Detail

WritableList

public WritableList()
Creates an empty writable list in the default realm with a null element type.


WritableList

public WritableList(
Realm realm)
Creates an empty writable list with a null element type.

Parameters:
realm - the observable's realm

WritableList

public WritableList(
List toWrap,
                    
Object elementType)
Constructs a new instance with the default realm. Note that for backwards compatibility reasons, the contents of the created WritableList will change with the contents of the given list. If this is not desired, WritableList(Collection, Object) should be used by casting the first argument to Collection .

Parameters:
toWrap - The java.util.List to wrap
elementType - can be null

WritableList

public WritableList(
Collection collection,
                    
Object elementType)
Constructs a new instance in the default realm containing the elements of the given collection. Changes to the given collection after calling this method do not affect the contents of the created WritableList.

Parameters:
collection - the collection to copy
elementType - can be null
Since:
1.2

WritableList

public WritableList(
Realm realm,
                    
List toWrap,
                    
Object elementType)
Creates a writable list containing elements of the given type, wrapping an existing client-supplied list. Note that for backwards compatibility reasons, the contents of the created WritableList will change with the contents of the given list. If this is not desired, WritableList(Realm, Collection, Object) should be used by casting the second argument to Collection .

Parameters:
realm - the observable's realm
toWrap - The java.util.List to wrap
elementType - can be null

WritableList

public WritableList(
Realm realm,
                    
Collection collection,
                    
Object elementType)
Constructs a new instance in the default realm containing the elements of the given collection. Changes to the given collection after calling this method do not affect the contents of the created WritableList.

Parameters:
realm - the observable's realm
collection - the collection to copy
elementType - can be null
Since:
1.2
Method Detail

set

public 
Object set(int index,
                  
Object element)
Specified by:
set in interface List
Specified by:
set in interface IObservableList
Overrides:
set in class ObservableList

move

public 
Object move(int oldIndex,
                   int newIndex)
Description copied from class: ObservableList
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
Overrides:
move in class ObservableList
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.
Since:
1.1
See Also:
ListDiffVisitor.handleMove(int, int, Object), ListDiff.accept(ListDiffVisitor)

remove

public 
Object remove(int index)
Specified by:
remove in interface List
Specified by:
remove in interface IObservableList
Overrides:
remove in class ObservableList

add

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

add

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

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 ObservableList

addAll

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

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 ObservableList

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 ObservableList

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 ObservableList

clear

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

withElementType

public static 
WritableList withElementType(
Object elementType)
Parameters:
elementType - can be null
Returns:
new list with the default realm.

addListener

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

removeListener

protected void removeListener(
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.

clone

protected 
Object clone()
                throws 
CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

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