- Inherits from:
- (com.apple.client.eocontrol) Object
(com.apple.yellow.eocontrol) NSObject
- Package:
- com.apple.client.eocontrol
- com.apple.yellow.eocontrol
The EODelayedObserverQueue class is a part of EOControl's change tracking mechanism. An EODelayedObserverQueue collects change notifications for observers of multiple objects and notifies them of the changes en masse during the application's run loop, according to their individual priorities. For an overview of the general change tracking mechanism, see "Tracking Enterprise Objects Changes" in the introduction to the EOControl Framework.
EODelayedObserverQueue's style of notification is particularly useful for coalescing and prioritizing multiple changes; the interface layer's EOAssociation classes use it extensively to update Java Client and Application Kit user interfaces, for example. Instead of being told that an object will change, an EODelayedObserver is told that it did change, with a subjectChanged message, as described in the EODelayedObserver class specification. Delayed observation is thus not useful for comparing old and new states, but only for examining the new state. Delayed observation also isn't ordinarily used outside the scope of a Java Client or Application Kit application (in a command line tool or WebObjects application, for example).
The motivation for a delayed change notification mechanism arises mainly from issues in observing multiple objects. Any single change to an observed object typically requires the observer to update some state or perform an action. When many such objects change, it makes no sense to recalculate the new state and perform the action for each object. EODelayedObserverQueue allows these changes to be collected into a single notification. It further orders change notifications according to priorities, allowing observers to be updated in sequence according to dependencies among them. For example, an EOMasterDetailAssociation (EOInterface), which must update its detail EODisplayGroup (EOInterface) according to the selection in the master before any redisplay occurs, has an earlier priority than the default for EOAssociations. This prevents regular EOAssociations from redisplaying old values and then displaying the new values after the EOMasterDetailAssociation updates.
For more information on using EODelayedObserverQueues, see the sections
EODelayedObserverQueue defines the following int
constant:
Constant | Description |
FlushDelayedObserversRunLoopOrdering | Determines when to notify delayed observers during end of event processing. |
- Constructors
- EODelayedObserverQueue
- Getting the default queue
- defaultObserverQueue
- Enqueuing and dequeuing observers
- enqueueObserver
- dequeueObserver
- Sending change notifications
- notifyObserversUpToPriority
- Configuring notification behavior
- runLoopModes (com.apple.yellow.eocontrol only)
- setRunLoopModes (com.apple.yellow.eocontrol only)
public
EODelayedObserverQueue
()
See Also: runLoopModes (com.apple.yellow.eocontrol only)
public static EODelayedObserverQueue
defaultObserverQueue
()
public void
dequeueObserver
(EODelayedObserver anObserver)
See Also: enqueueObserver
public void
enqueueObserver
(EODelayedObserver anObserver)
The first time this method is invoked during the
run loop with an observer whose priority isn't ObserverPriorityImmediate
,
it registers the receiver to be sent a notifyObserversUpToPriority message at
the end of the run loop, using FlushDelayedObserversRunLoopOrdering and
the receiver's run loop modes. This causes enqueued observers
up to a priority of ObserverPrioritySixth to be notified automatically
during each pass of the run loop.
When anObserver is done
observing changes, it should invoke discardPendingNotification to
remove itself from the queue.
See Also: dequeueObserver, priority (EODelayedObserver), discardPendingNotification (EODelayedObserver), runLoopModes (com.apple.yellow.eocontrol only)
public void
notifyObserversUpToPriority
(int priority)
subjectChanged
message
and then returning to the very beginning of the queue, in case another observer
with an earlier priority was enqueued as a result of the message.EODelayedObserverQueue invokes this method automatically as needed during the run loop, with a priority of ObserverPrioritySixth.
See Also: enqueueObserver, priority (EODelayedObserver)
public NSArray
runLoopModes
()
(com.apple.yellow.eocontrol only) Returns the receiver's run loop modes.
public void
setRunLoopModes
(NSArray modes)
(com.apple.yellow.eocontrol only) Sets the receiver's run loop modes to modes, an array of NSString objects representing run loop modes. For more information see the Foundation class NSRunLoop.