UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.watch
Interface Watcher

All Superinterfaces:
Cloneable, Serializable
All Known Subinterfaces:
GraphicalObjectCollection, GraphicalObjectGroup, Patch
All Known Implementing Classes:
GraphicalObjectGroupImpl, LineArrow, Sheet, StrokeAssembler

public interface Watcher
extends Serializable, Cloneable

This interface is a replacement for Observer, because Observable is a class instead of an interface.

 Revisions:  - SATIN-v1.0-1.0.0, Mar 08 1999, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )

Method Summary
 Object clone()
          A happy clone we are.
 void onDelete(Watchable w)
          Callback method for notifications of deletions, that is this Graphical Object has been deleted and you should remove it.
 void onNotify(Watchable w, Object arg)
          Callback method for generic notifications.
 void onUpdate(Watchable w, Object arg)
          Callback method for notifications.
 void onUpdate(Watchable w, String strProperty, Object oldVal, Object newVal)
          Callback method for notifications.
 

Method Detail

onNotify

public void onNotify(Watchable w,
                     Object arg)
Callback method for generic notifications. This typically won't be used.
Parameters:
w - is the Watchable object notifying you.
arg - is some agreed upon argument.
See Also:
Watchable.notifyWatchers(), Watchable.notifyWatchers(java.lang.Object)

onUpdate

public void onUpdate(Watchable w,
                     Object arg)
Callback method for notifications.
Parameters:
w - is the Watchable object that has been updated.
arg - is some agreed upon argument.
See Also:
Watchable.notifyWatchersUpdate(Object)

onUpdate

public void onUpdate(Watchable w,
                     String strProperty,
                     Object oldVal,
                     Object newVal)
Callback method for notifications.
Parameters:
w - is the Watchable object that has been updated.
strProperty - is the name of the property to update.
oldVal - is the old value of the property. This should usually be a clone of the old value, so that modifying this value should have no effect. Whether this is a copy or a reference should be defined in the SatinConstants file.
newVal - is the new value of the property. This should usually be a clone of the old value, so that modifying this value should have no effect. However, don't clone if it is prohibitively expensive to do so. Whether this is a copy or a reference should be defined in the SatinConstants file.
See Also:
SatinConstants, Watchable.notifyWatchersUpdate(String, Object, Object)

onDelete

public void onDelete(Watchable w)
Callback method for notifications of deletions, that is this Graphical Object has been deleted and you should remove it.
Parameters:
w - is the Watchable object to be deleted.
See Also:
Watchable.notifyWatchersDelete()

clone

public Object clone()
A happy clone we are.
Overrides:
clone in class Object

Copyright Information