|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.wotonomy.control.EOObserverCenter
public class EOObserverCenter
EOObserverCenter is a static singleton-like class
that manages EOObservings that want to be notified
of changes to those objects that call
notifyObserversObjectWillChange() before their
properties change.
Implementation note: Because Java implements the
Observer pattern in java.util.Observable, this
class knows how to register itself as an Observer
with Observables as well. However, users should
note that Observables only notify their Observers
of changes after their property has changed.
EODelayedObservers would see no difference because
they always receive their notification after all
changes have taken place.
This implementation uses weak references for observers
and observables. The advantage to this approach is
that you do not need to explicitly unregister observers
or observables; they will be unregistered when they are
garbage-collected. Note that you will need to retain
a reference to any objects you register or they may
become unregistered if no other object references them.
Constructor Summary | |
---|---|
EOObserverCenter()
|
Method Summary | |
---|---|
static void |
addObserver(EOObserving anObserver,
java.lang.Object anObject)
Registers the specified EOObserving for notifications from the specified object. |
static void |
addOmniscientObserver(EOObserving anObserver)
Registers the specified EOObserving for notifications on all object changes. |
static void |
enableObserverNotification()
Enables notifications after they have been suppressed by suppressObserverNotification. |
static void |
notifyObserversObjectWillChange(java.lang.Object anObject)
Notifies all EOObservings registered for notifications for the specified object. |
static EOObserving |
observerForObject(java.lang.Object anObject,
java.lang.Class aClass)
Returns an observer that is an instance of the specified class and that is registered for notifications about the specified object. |
static int |
observerNotificationSuppressCount()
Returns the number of times that notifications have been suppressed. |
static net.wotonomy.foundation.NSArray |
observersForObject(java.lang.Object anObject)
Returns a List of observers for the specified object. |
static void |
removeObserver(EOObserving anObserver,
java.lang.Object anObject)
Unregisters the specified observer for notifications from the specified object. |
static void |
removeOmniscientObserver(EOObserving anObserver)
Unregisters the specified omniscient observer. |
static void |
suppressObserverNotification()
Causes notifications to be suppressed until the next matching call to enableObserverNotification. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Interface Observer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EOObserverCenter()
Method Detail |
---|
public static void addObserver(EOObserving anObserver, java.lang.Object anObject)
public static void addOmniscientObserver(EOObserving anObserver)
public static void notifyObserversObjectWillChange(java.lang.Object anObject)
public static EOObserving observerForObject(java.lang.Object anObject, java.lang.Class aClass)
public static int observerNotificationSuppressCount()
public static net.wotonomy.foundation.NSArray observersForObject(java.lang.Object anObject)
public static void removeObserver(EOObserving anObserver, java.lang.Object anObject)
public static void removeOmniscientObserver(EOObserving anObserver)
public static void enableObserverNotification()
public static void suppressObserverNotification()
public void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |