com.tensegrity.generic.util
Class DefaultObservable

java.lang.Object
  extended bycom.tensegrity.generic.util.DefaultObservable
All Implemented Interfaces:
Observable

public class DefaultObservable
extends java.lang.Object
implements Observable

The class DefaultObservable is meant as a notification-delegator. It represents an observable object, or "data" in the model-view paradigm. An DefaultObservable object can have one or more observers. An observer may be any object that implements interface Observer.

Version:
$Id: DefaultObservable.java,v 1.16 2004/10/11 10:31:11 MichaelKegel Exp $
Author:
Stepan Rutz
See Also:
Observer

Constructor Summary
DefaultObservable()
          Constructs a DefaultObservable with zero observers.
 
Method Summary
 void addObserver(Observer observer)
          Adds an observer to the internally managed list of observers of this observable.
 void clearChanged()
          Sets the state to unchanged.
 void deleteObserver(Observer observer)
          Deletes an observer from the internally managed list of observers of this observable.
 void deleteObservers()
          Deletes all of the observers registered with this observable.
static void dumpAllObservers()
          Dumps all active observers to the System.err-stream.
 java.util.Collection getObservers()
          Returns a collection of the observers currently registered with this observable.
 void notifyObservers()
          Performs a notify on all registered observers, if the state has changed since the last notification.
 void notifyObservers(java.lang.Object arg)
          Performs a notify on all registered observers, if the state has changed since the last notification.
 void setChanged()
          Sets the state to changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultObservable

public DefaultObservable()
Constructs a DefaultObservable with zero observers.

Method Detail

addObserver

public void addObserver(Observer observer)
Description copied from interface: Observable
Adds an observer to the internally managed list of observers of this observable.

Specified by:
addObserver in interface Observable
Parameters:
observer - the observer to add to the internal list.

deleteObserver

public void deleteObserver(Observer observer)
Description copied from interface: Observable
Deletes an observer from the internally managed list of observers of this observable.

Specified by:
deleteObserver in interface Observable
Parameters:
observer - the observer to delete from the internal list.

notifyObservers

public void notifyObservers()
Description copied from interface: Observable
Performs a notify on all registered observers, if the state has changed since the last notification.

Specified by:
notifyObservers in interface Observable
See Also:
Observable.notifyObservers()

notifyObservers

public void notifyObservers(java.lang.Object arg)
Description copied from interface: Observable
Performs a notify on all registered observers, if the state has changed since the last notification.

Specified by:
notifyObservers in interface Observable
Parameters:
arg - additional argument to pass to the observers.
See Also:
Observable.notifyObservers(Object)

deleteObservers

public void deleteObservers()
Description copied from interface: Observable
Deletes all of the observers registered with this observable.

Specified by:
deleteObservers in interface Observable
See Also:
Observable.deleteObservers()

setChanged

public void setChanged()
Description copied from interface: Observable
Sets the state to changed. Affects the next notification.

Specified by:
setChanged in interface Observable
See Also:
Observable.setChanged()

clearChanged

public void clearChanged()
Description copied from interface: Observable
Sets the state to unchanged. Affects the next notification.

Specified by:
clearChanged in interface Observable
See Also:
Observable.clearChanged()

getObservers

public java.util.Collection getObservers()
Description copied from interface: Observable
Returns a collection of the observers currently registered with this observable.

Specified by:
getObservers in interface Observable
Returns:
collection of the observers.
See Also:
Observable.getObservers()

dumpAllObservers

public static final void dumpAllObservers()
Dumps all active observers to the System.err-stream.



Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.