net.wotonomy.control
Class EODelayedObserver

java.lang.Object
  extended by net.wotonomy.control.EODelayedObserver
All Implemented Interfaces:
java.util.Observer, EOObserving
Direct Known Subclasses:
EOObserverProxy

public abstract class EODelayedObserver
extends java.lang.Object
implements EOObserving, java.util.Observer

This is an abstract class for receiving coalesced notifications of changes from objects. This class also implements Observer for greater compatibility. The point of EODelayedObservers is that when they receive a willChange message, they queue themselves with a EODelayedObserverQueue so they can receive a single subjectChanged() after all changes from an observed object take place.

Version:
$Revision: 894 $
Author:
michael@mpowers.net, $Author: cgruber $

Field Summary
static int ObserverNumberOfPriorities
           
static int ObserverPriorityFifth
           
static int ObserverPriorityFirst
           
static int ObserverPriorityFourth
           
static int ObserverPriorityImmediate
          Notified immediately.
static int ObserverPriorityLater
           
static int ObserverPrioritySecond
           
static int ObserverPrioritySixth
           
static int ObserverPriorityThird
           
 
Constructor Summary
EODelayedObserver()
          Default constructor.
 
Method Summary
 void discardPendingNotification()
          Removes this observer from the observer queue for a currently pending notification.
 void objectWillChange(java.lang.Object anObject)
          Called when the specified object is about to change.
 EODelayedObserverQueue observerQueue()
          Returns the observer queue to which this observer belongs.
 int priority()
          Returns the priority of this observer in the queue.
abstract  void subjectChanged()
          Notifies observer that one or more objects that it is observing have changed.
 void update(java.util.Observable anObject, java.lang.Object aValue)
          Called when the specified object has changed, with the specified argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ObserverPriorityImmediate

public static final int ObserverPriorityImmediate
Notified immediately.

See Also:
Constant Field Values

ObserverPriorityFirst

public static final int ObserverPriorityFirst
See Also:
Constant Field Values

ObserverPrioritySecond

public static final int ObserverPrioritySecond
See Also:
Constant Field Values

ObserverPriorityThird

public static final int ObserverPriorityThird
See Also:
Constant Field Values

ObserverPriorityFourth

public static final int ObserverPriorityFourth
See Also:
Constant Field Values

ObserverPriorityFifth

public static final int ObserverPriorityFifth
See Also:
Constant Field Values

ObserverPrioritySixth

public static final int ObserverPrioritySixth
See Also:
Constant Field Values

ObserverPriorityLater

public static final int ObserverPriorityLater
See Also:
Constant Field Values

ObserverNumberOfPriorities

public static final int ObserverNumberOfPriorities
See Also:
Constant Field Values
Constructor Detail

EODelayedObserver

public EODelayedObserver()
Default constructor.

Method Detail

discardPendingNotification

public void discardPendingNotification()
Removes this observer from the observer queue for a currently pending notification.


observerQueue

public EODelayedObserverQueue observerQueue()
Returns the observer queue to which this observer belongs. This implementation returns the default EODelayedObserverQueue. Override to use a different one.


priority

public int priority()
Returns the priority of this observer in the queue. This implementation returns ObserverPriorityThird. Override to be notified before other observers.


subjectChanged

public abstract void subjectChanged()
Notifies observer that one or more objects that it is observing have changed. The observer should check all objects it is observing for changes.


objectWillChange

public void objectWillChange(java.lang.Object anObject)
Called when the specified object is about to change. This implementation puts this observer on a notification queue.

Specified by:
objectWillChange in interface EOObserving

update

public void update(java.util.Observable anObject,
                   java.lang.Object aValue)
Called when the specified object has changed, with the specified argument. This method is included for interacting with the java.lang.Observer pattern. This implementation simply objectWillChange(anObject) so that the observer still gets a single subjectChanged call in response to multiple changes.

Specified by:
update in interface java.util.Observer


Copyright © 2006 null. All Rights Reserved.