net.wotonomy.foundation
Class NSNotificationQueue

java.lang.Object
  extended by net.wotonomy.foundation.NSNotificationQueue

public class NSNotificationQueue
extends java.lang.Object

NSNotificationQueue coalesces notifications to be posted to the NSNotificationCenter and can post them asynchronously. While calling postNotification on the notification center does not return until all receivers have been notified, calling enqueueNotification can return immediately. Use this class when you want to coalesce notifications or notify asynchronously, or both, which is the typical case.

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

Field Summary
static int NotificationCoalescingOnName
          Used to indicate that this notification should be coalesced with other notifications with the same name.
static int NotificationCoalescingOnSender
          Used to indicate that this notification should be coalesced with other notifications with the same object argument (which is typically the sender).
static int NotificationNoCoalescing
          Used to indicate that this notification should not be coalesced with other notifications.
static int PostASAP
          Posting style specifying that the notification should be posted on the next available event loop.
static int PostNow
          Posting style specifying that the notification should be posted immediately.
static int PostWhenIdle
          Posting style specifying that the notification should be posted on the next available idle loop.
 
Constructor Summary
NSNotificationQueue()
          Default constructor creates a new notification queue that uses the default notification center.
NSNotificationQueue(NSNotificationCenter aCenter)
          Creates a new notification queue that uses the specified notification center.
 
Method Summary
static NSNotificationQueue defaultQueue()
          Returns the system default queue, creating one if it has not yet been created.
 void dequeueMatchingNotifications(NSNotification aNotification, int aCoalesceMask)
          Removes notifications from the queue that match the specified notification, considering the specified coalesce mask.
 void enqueueNotification(NSNotification aNotification, int aPostingStyle)
          Adds the notification to the queue to be run at the time specified by the posting style.
 void enqueueNotificationWithCoalesceMaskForModes(NSNotification aNotification, int aPostingStyle, int aCoalesceMask, java.util.List aModeList)
          Adds the notification to the queue to be run at the time specified by the posting style and coelesced as the specified mask indicates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PostASAP

public static final int PostASAP
Posting style specifying that the notification should be posted on the next available event loop.

See Also:
Constant Field Values

PostWhenIdle

public static final int PostWhenIdle
Posting style specifying that the notification should be posted on the next available idle loop.

See Also:
Constant Field Values

PostNow

public static final int PostNow
Posting style specifying that the notification should be posted immediately. The enqueue method will not return until all receivers have been notified.

See Also:
Constant Field Values

NotificationNoCoalescing

public static final int NotificationNoCoalescing
Used to indicate that this notification should not be coalesced with other notifications. Ignored if combined with other coalesce flags.

See Also:
Constant Field Values

NotificationCoalescingOnName

public static final int NotificationCoalescingOnName
Used to indicate that this notification should be coalesced with other notifications with the same name. May be combined with NotificationCoalescingOnSender.

See Also:
Constant Field Values

NotificationCoalescingOnSender

public static final int NotificationCoalescingOnSender
Used to indicate that this notification should be coalesced with other notifications with the same object argument (which is typically the sender). May be combined with NotificationCoalescingOnName.

See Also:
Constant Field Values
Constructor Detail

NSNotificationQueue

public NSNotificationQueue()
Default constructor creates a new notification queue that uses the default notification center.


NSNotificationQueue

public NSNotificationQueue(NSNotificationCenter aCenter)
Creates a new notification queue that uses the specified notification center.

Method Detail

defaultQueue

public static NSNotificationQueue defaultQueue()
Returns the system default queue, creating one if it has not yet been created. The system default queue uses the system default notification center.


dequeueMatchingNotifications

public void dequeueMatchingNotifications(NSNotification aNotification,
                                         int aCoalesceMask)
Removes notifications from the queue that match the specified notification, considering the specified coalesce mask.


enqueueNotification

public void enqueueNotification(NSNotification aNotification,
                                int aPostingStyle)
Adds the notification to the queue to be run at the time specified by the posting style. The notification will be coalesced with other notifications that match the same name and object (sender) argument.


enqueueNotificationWithCoalesceMaskForModes

public void enqueueNotificationWithCoalesceMaskForModes(NSNotification aNotification,
                                                        int aPostingStyle,
                                                        int aCoalesceMask,
                                                        java.util.List aModeList)
Adds the notification to the queue to be run at the time specified by the posting style and coelesced as the specified mask indicates. aModeList is currently ignored and may be null.



Copyright © 2006 null. All Rights Reserved.