Class Notifications

java.lang.Object
com.openfin.desktop.notifications.Notifications

public class Notifications
extends java.lang.Object
This class initializes and manages notifications.
Author:
Anthony
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String EVENT_TYPE_ACTION  
    static java.lang.String EVENT_TYPE_CLOSED  
    static java.lang.String EVENT_TYPE_CREATED  
  • Constructor Summary

    Constructors 
    Constructor Description
    Notifications​(DesktopConnection desktopConnection)  
  • Method Summary

    Modifier and Type Method Description
    boolean addEventListener​(java.lang.String eventType, NotificationEventListener listener)
    Add a listener to handle specified notification events.
    java.util.concurrent.CompletionStage<java.lang.Boolean> clear​(java.lang.String id)
    Clears a specific notification from the Notification Center.
    java.util.concurrent.CompletionStage<java.lang.Integer> clearAll()
    Clears all Notifications which were created by the calling application, including child windows.
    java.util.concurrent.CompletionStage<NotificationOptions> create​(NotificationOptions options)
    Creates a new notification.
    java.util.concurrent.CompletionStage<java.util.List<NotificationOptions>> getAll()
    Retrieves all Notifications which were created by the calling application, including child windows.
    java.util.concurrent.CompletionStage<ProviderStatus> getProviderStatus()
    Get notification service provider status.
    boolean removeEventListener​(java.lang.String eventType, NotificationEventListener listener)
    Removes a listener previously added with addEventListener.
    java.util.concurrent.CompletionStage<java.lang.Void> toggleNotificationCenter()
    Toggles the visibility of the Notification Center.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public java.util.concurrent.CompletionStage<NotificationOptions> create​(NotificationOptions options)
      Creates a new notification. The notification will appear in the Notification Center and as a toast if the Center is not visible. If a notification is created with an id of an already existing notification, the existing notification will be recreated with the new content.
      Parameters:
      options - Notification configuration options.
      Returns:
      new CompletionStage for the fully-hydrated NotificationOptions.
    • clear

      public java.util.concurrent.CompletionStage<java.lang.Boolean> clear​(java.lang.String id)
      Clears a specific notification from the Notification Center.
      Parameters:
      id - ID of the notification to clear.
      Returns:
      new CompletionStage for the status, true if the notification was successfully cleared. false if the notification was not cleared, without errors.
    • clearAll

      public java.util.concurrent.CompletionStage<java.lang.Integer> clearAll()
      Clears all Notifications which were created by the calling application, including child windows.
      Returns:
      new CompletionStage for the the number of successfully cleared Notifications.
    • getAll

      public java.util.concurrent.CompletionStage<java.util.List<NotificationOptions>> getAll()
      Retrieves all Notifications which were created by the calling application, including child windows.
      Returns:
      new CompletionStage for all NotificationOptions.
    • toggleNotificationCenter

      public java.util.concurrent.CompletionStage<java.lang.Void> toggleNotificationCenter()
      Toggles the visibility of the Notification Center.
      Returns:
      new CompletionStage when the command is delivered.
    • addEventListener

      public boolean addEventListener​(java.lang.String eventType, NotificationEventListener listener)
      Add a listener to handle specified notification events.
      Parameters:
      eventType - EVENT_TYPE_ACTION, EVENT_TYPE_CREATED or EVENT_TYPE_CLOSED.
      listener - the event listener to be added.
      Returns:
      true if the listener was added as a result of the call.
    • removeEventListener

      public boolean removeEventListener​(java.lang.String eventType, NotificationEventListener listener)
      Removes a listener previously added with addEventListener.
      Parameters:
      eventType - EVENT_TYPE_ACTION, EVENT_TYPE_CREATED or EVENT_TYPE_CLOSED.
      listener - the event listener to be removed.
      Returns:
      true if the listener was removed as a result of the call.
    • getProviderStatus

      public java.util.concurrent.CompletionStage<ProviderStatus> getProviderStatus()
      Get notification service provider status.
      Returns:
      new CompletionStage for the ProviderStatus.