Class UserNotificationWithFeedback

java.lang.Object
it.tidalwave.ui.core.UserNotification
it.tidalwave.ui.core.UserNotificationWithFeedback

@Immutable public class UserNotificationWithFeedback extends UserNotification
This class models a notification that will be presented to a user, and a feedback is expected (confirmation or cancellation).
Since:
2.0-ALPHA-2
Author:
Fabrizio Giudici
  • Field Details

  • Constructor Details

    • UserNotificationWithFeedback

      protected UserNotificationWithFeedback(@Nonnull String text, @Nonnull String caption, @Nonnull UserNotificationWithFeedback.Feedback feedback)
      Parameters:
      text - the notification text
      caption - the notification caption
      feedback - the feedback
  • Method Details

    • notificationWithFeedback

      @Nonnull public static UserNotificationWithFeedback notificationWithFeedback()
      Returns a notification with empty caption and text..
      Returns:
      a notification with empty caption and text
    • withCaption

      @Nonnull public UserNotificationWithFeedback withCaption(@Nonnull String caption)
      Returns a notification with a caption..
      Overrides:
      withCaption in class UserNotification
      Parameters:
      caption - the caption
      Returns:
      a notification with a caption
    • withCaption

      @Nonnull public UserNotificationWithFeedback withCaption(@Nonnull Class<?> bundleClass, @Nonnull String resourceName, @Nonnull Object... params)
      Returns a notification with a caption from a bundle..
      Overrides:
      withCaption in class UserNotification
      Parameters:
      bundleClass - the class where to search the resource bundle from
      resourceName - the resource name of the caption in the bundle
      params - some (optional) parameters to the resource
      Returns:
      a notification with a caption from a bundle
    • withText

      @Nonnull public UserNotificationWithFeedback withText(@Nonnull String text)
      Returns a notification with a text..
      Overrides:
      withText in class UserNotification
      Parameters:
      text - the text
      Returns:
      a notification with a text
    • withText

      @Nonnull public UserNotificationWithFeedback withText(@Nonnull Class<?> bundleClass, @Nonnull String resourceName, @Nonnull Object... params)
      Returns a notification with a text from a bundle..
      Overrides:
      withText in class UserNotification
      Parameters:
      bundleClass - the class where to search the resource bundle from
      resourceName - the resource name of the text in the bundle
      params - some (optional) parameters to the resource
      Returns:
      a notification with a text from a bundle
    • withFeedback

      @Nonnull public UserNotificationWithFeedback withFeedback(@Nonnull UserNotificationWithFeedback.Feedback feedback)
      Returns a notification UserNotificationWithFeedback.Feedback..
      Parameters:
      feedback - the Feedback to associate
      Returns:
      a notification UserNotificationWithFeedback.Feedback
    • confirm

      public void confirm() throws Exception
      Notifies a confirmation to the user notification.
      Throws:
      Exception - in cases of error
    • cancel

      public void cancel() throws Exception
      Notifies a cancellation to the user notification.
      Throws:
      Exception - in cases of error
    • feedback

      @Nonnull public static UserNotificationWithFeedback.Feedback feedback()
      Returns a new Feedback that does nothing.. This method should be chained with withOnConfirm() and/or withOnCancel(Callback) to specify the relative callbacks.
         feedback().withOnConfirm(this::doSomething).withOnCancel(this::doSomethingElse);
       }
      Returns:
      a new Feedback that does nothing