nl.knowledgeplaza.util.collection
Class ObservableListWrapper

java.lang.Object
  extended by nl.knowledgeplaza.util.collection.ObservableListWrapper
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.List, ObservableCollection

public class ObservableListWrapper
extends java.lang.Object
implements java.util.List, ObservableCollection

Version:
$Revision: 1.2 $

Field Summary
protected  java.util.ArrayList listeners
          the observers of this collection
 
Constructor Summary
ObservableListWrapper(java.util.List list)
           
 
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 addCollectionListener(CollectionListener l)
          Adds a CollectionListener to the collection
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 boolean equals(java.lang.Object obj)
           
protected  void fireCollectionEvent(CollectionEvent e)
          Fires a CollectionEvent to all listeners.
 java.lang.Object get(int index)
           
 java.lang.Object getObservedCollection()
          To access the collection that is being observed.
 int hashCode()
           
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int lastIndexOf(java.lang.Object o)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
static void main(java.lang.String[] args)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 void removeCollectionListener(CollectionListener l)
          Removes a CollectionListener to the collection
 boolean retainAll(java.util.Collection c)
           
 java.lang.Object set(int index, java.lang.Object element)
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

listeners

protected java.util.ArrayList listeners
the observers of this collection

Constructor Detail

ObservableListWrapper

public ObservableListWrapper(java.util.List list)
Method Detail

addCollectionListener

public void addCollectionListener(CollectionListener l)
Description copied from interface: ObservableCollection
Adds a CollectionListener to the collection

Specified by:
addCollectionListener in interface ObservableCollection
Parameters:
l -

removeCollectionListener

public void removeCollectionListener(CollectionListener l)
Description copied from interface: ObservableCollection
Removes a CollectionListener to the collection

Specified by:
removeCollectionListener in interface ObservableCollection
Parameters:
l -

fireCollectionEvent

protected void fireCollectionEvent(CollectionEvent e)
Fires a CollectionEvent to all listeners.

Parameters:
e - the CollectionEvent

getObservedCollection

public java.lang.Object getObservedCollection()
To access the collection that is being observed.

Specified by:
getObservedCollection in interface ObservableCollection
Returns:
Unfortunately not all collections implement one interface, so the return type depends on the observed collection.

add

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

add

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

addAll

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

addAll

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

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List

contains

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

containsAll

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

equals

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

get

public java.lang.Object get(int index)
Specified by:
get in interface java.util.List
Parameters:
index -
Returns:

hashCode

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

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List
Parameters:
o -
Returns:

isEmpty

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

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
Returns:

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List
Parameters:
o -
Returns:

listIterator

public java.util.ListIterator listIterator()
Specified by:
listIterator in interface java.util.List
Returns:

listIterator

public java.util.ListIterator listIterator(int index)
Specified by:
listIterator in interface java.util.List
Parameters:
index -
Returns:

remove

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

remove

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

removeAll

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

retainAll

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

set

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

size

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

subList

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

toArray

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

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
Parameters:
a -
Returns:

toString

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

main

public static void main(java.lang.String[] args)


Copyright © 2010. All Rights Reserved.