Class Notifications


  • public class Notifications
    extends Object
    This class initializes and manages notifications.
    Author:
    Anthony
    • Constructor Detail

    • Method Detail

      • create

        public 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 CompletionStage<Boolean> clear​(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 CompletionStage<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 CompletionStage<List<NotificationOptions>> getAll()
        Retrieves all Notifications which were created by the calling application, including child windows.
        Returns:
        new CompletionStage for all NotificationOptions.
      • toggleNotificationCenter

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

        public boolean addEventListener​(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​(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 CompletionStage<ProviderStatus> getProviderStatus()
        Get notification service provider status.
        Returns:
        new CompletionStage for the ProviderStatus.