com.microsoft.tfs.core.util.notifications
Class MessageWindowNotificationManager

java.lang.Object
  extended by com.microsoft.tfs.core.util.notifications.MessageWindowNotificationManager
All Implemented Interfaces:
NotificationManager, com.microsoft.tfs.util.Closable

public class MessageWindowNotificationManager
extends java.lang.Object

Implements NotificationManager using a MessageWindow. Currently this implementation is only useful on Windows platforms. It is safe to use on other platforms, but it will not send or receive any messages.

Unlike the Visual Studio implementation, this class does not support "immediate" notification sending (all notifications will be queued and sent in batches).

Also, all queued notifications are always "collapsed" on both params (which is optional but always used in the VS implementation). This means a notification that exactly matches an already-queued notification will not be queued.

Thread-safety:
thread-safe

Constructor Summary
MessageWindowNotificationManager()
          Creates a MessageWindowNotificationManager.
 
Method Summary
 void addListener(NotificationListener listener)
          Adds a notification listener.
protected  void clearListeners()
          Removes all the listeners.
 void close()
          
protected  void fireNotificationReceived(Notification notification, long param1, long param2)
          Fires the NotificationListener.notificationReceived(Notification, long, long) event.
 void removeListener(NotificationListener listener)
          Removes a notification listener.
 void sendNotification(Notification notification, int param1, int param2)
          Sends a Notification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageWindowNotificationManager

public MessageWindowNotificationManager()
Creates a MessageWindowNotificationManager. On Windows this constructor creates a hidden message-only window (MessageWindow) to do IPC. On non-Windows platforms, the class sends or receives no messages.

The application must be in a state where window creation will succeed when this constructor is used.

Method Detail

close

public void close()

Closing a NotificationManager flushes the send queue and removes all listeners.


sendNotification

public void sendNotification(Notification notification,
                             int param1,
                             int param2)
Sends a Notification. The message may be queued before being sent.

Parameters:
notification - the notification to send (must not be null)
param1 - the first parameter to send
param2 - the second parameter to send

addListener

public void addListener(NotificationListener listener)
Adds a notification listener.

Specified by:
addListener in interface NotificationManager
Parameters:
listener - the listener to add

removeListener

public void removeListener(NotificationListener listener)
Removes a notification listener.

Specified by:
removeListener in interface NotificationManager
Parameters:
listener - the listener to remove

clearListeners

protected void clearListeners()
Removes all the listeners.


fireNotificationReceived

protected void fireNotificationReceived(Notification notification,
                                        long param1,
                                        long param2)
Fires the NotificationListener.notificationReceived(Notification, long, long) event.

Parameters:
notification - the notification to send (must not be null)
param1 - the first parameter
param2 - the second parameter


© 2015 Microsoft. All rights reserved.