portaview.model
Class ObservableCollection

java.lang.Object
  extended byjava.util.Observable
      extended byportaview.model.ObservableCollection
Direct Known Subclasses:
AlbumCollection, PortaViewCollection

public class ObservableCollection
extends java.util.Observable

Generic collection class that can be observed. One needs to use this class if there is a collection of items that they want to observe when added or removed from this collection.

Author:
William Lee

Constructor Summary
ObservableCollection()
           
 
Method Summary
 void add(java.lang.Object obj)
          Adds an object to this collection.
 void addAll(ObservableCollection col)
          Add all the element in col to this collecion.
 void clear()
          Clear the collection.
 java.util.Iterator iterator()
          Returns the iterator for this collection.
 void notifyChange()
          Can be called externally to change notify the observers of the observables.
 void notifyChildrenObservers()
          Notify the children's observers.
 void remove(java.lang.Object obj)
          Removes an object and notify the observing observers.
 int size()
          Returns the size of this collection.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObservableCollection

public ObservableCollection()
Method Detail

iterator

public java.util.Iterator iterator()
Returns the iterator for this collection.

Returns:
iterator for the collection.

clear

public void clear()
Clear the collection.


notifyChange

public void notifyChange()
Can be called externally to change notify the observers of the observables.


notifyChildrenObservers

public void notifyChildrenObservers()
Notify the children's observers. If the instance inside this collection extends the Observable class, notify the change also.


addAll

public void addAll(ObservableCollection col)
Add all the element in col to this collecion.

Parameters:
col - collection to add to this collection.

size

public int size()
Returns the size of this collection.

Returns:
int representing the size.

remove

public void remove(java.lang.Object obj)
Removes an object and notify the observing observers. This will fire the event.

Parameters:
obj - object within this collection to remove.

add

public void add(java.lang.Object obj)
Adds an object to this collection. This will fire the event.

Parameters:
obj - object to add.


Copyright © 2003 The PortaView Team. All Rights Reserved.