com.tensegrity.generic.util
Interface Observable

All Known Subinterfaces:
CompositeNavigatorProvider, CompositeView, GraphController, MDIComponent, SwingMDIComponent, SwtMDIComponent, VisualGraphView
All Known Implementing Classes:
DefaultObservable, DockMDIComponent, FramedMDIComponent, MDIDelegate, PanelMDIComponent, SwtTabbedMDIComponent, TabbedMDIComponent, WindowMDIComponent

public interface Observable

This interface specifies a role for objects that are capable of being observed. That is to say, objects which play this role are the providers of zero or more Observer client notifications.

Observer objects are also role-players that hide their basic types from an Observable. Basically speaking, an Observer is simply interested in receiving a notification invocation whenever something happens to change inside an object that implements this interface.

One normally extends this interface because it does not represent a business role. It represents rather a communication or infrastructure role.

The method notifyObservers() informs an Observer that something has changed inside this Observable.

This class depends on the client Observer interface.

Version:
$Id: Observable.java,v 1.14 2005/01/12 12:37:16 KevinCVS Exp $
Author:
S. Rutz
See Also:
Observer

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.
 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.
 

Method Detail

addObserver

public void addObserver(Observer observer)
Adds an observer to the internally managed list of observers of this observable.

Parameters:
observer - the observer to add to the internal list.
Throws:
InvalidArgumentException - if the observer is currently registered or if the argument is null.

deleteObserver

public void deleteObserver(Observer observer)
                    throws InvalidArgumentException
Deletes an observer from the internally managed list of observers of this observable.

Parameters:
observer - the observer to delete from the internal list.
Throws:
InvalidArgumentException - if the observer is not currently registered or if the argument is null.

deleteObservers

public void deleteObservers()
Deletes all of the observers registered with this observable.


notifyObservers

public void notifyObservers()
Performs a notify on all registered observers, if the state has changed since the last notification.

See Also:
setChanged()

notifyObservers

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

Parameters:
arg - additional argument to pass to the observers.
See Also:
setChanged()

setChanged

public void setChanged()
Sets the state to changed. Affects the next notification.


clearChanged

public void clearChanged()
Sets the state to unchanged. Affects the next notification.


getObservers

public java.util.Collection getObservers()
Returns a collection of the observers currently registered with this observable.

Returns:
collection of the observers.


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