java.lang.Object
it.tidalwave.ui.core.UserNotification
it.tidalwave.ui.core.UserNotificationWithFeedback
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class provides a few callback methods to notify a choice from the user. -
Field Summary
FieldsFields inherited from class it.tidalwave.ui.core.UserNotification
caption, text -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUserNotificationWithFeedback(String text, String caption, UserNotificationWithFeedback.Feedback feedback) -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Notifies a cancellation to the user notification.voidconfirm()Notifies a confirmation to the user notification.feedback()Returns a newFeedbackthat does nothing.static UserNotificationWithFeedbackReturns a notification with empty caption and text.withCaption(Class<?> bundleClass, String resourceName, Object... params) Returns a notification with a caption from a bundle.withCaption(String caption) Returns a notification with a caption.Returns a notificationUserNotificationWithFeedback.Feedback.Returns a notification with a text from a bundle.Returns a notification with a text.Methods inherited from class it.tidalwave.ui.core.UserNotification
notification
-
Field Details
-
feedback
-
-
Constructor Details
-
UserNotificationWithFeedback
protected UserNotificationWithFeedback(@Nonnull String text, @Nonnull String caption, @Nonnull UserNotificationWithFeedback.Feedback feedback) - Parameters:
text- the notification textcaption- the notification captionfeedback- the feedback
-
-
Method Details
-
notificationWithFeedback
Returns a notification with empty caption and text..- Returns:
- a notification with empty caption and text
-
withCaption
Returns a notification with a caption..- Overrides:
withCaptionin classUserNotification- 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:
withCaptionin classUserNotification- Parameters:
bundleClass- the class where to search the resource bundle fromresourceName- the resource name of the caption in the bundleparams- some (optional) parameters to the resource- Returns:
- a notification with a caption from a bundle
-
withText
Returns a notification with a text..- Overrides:
withTextin classUserNotification- 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:
withTextin classUserNotification- Parameters:
bundleClass- the class where to search the resource bundle fromresourceName- the resource name of the text in the bundleparams- 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 notificationUserNotificationWithFeedback.Feedback..- Parameters:
feedback- theFeedbackto associate- Returns:
- a notification
UserNotificationWithFeedback.Feedback
-
confirm
Notifies a confirmation to the user notification.- Throws:
Exception- in cases of error
-
cancel
Notifies a cancellation to the user notification.- Throws:
Exception- in cases of error
-
feedback
Returns a newFeedbackthat does nothing.. This method should be chained withwithOnConfirm()and/orwithOnCancel(Callback)to specify the relative callbacks.feedback().withOnConfirm(this::doSomething).withOnCancel(this::doSomethingElse); }
- Returns:
- a new
Feedbackthat does nothing
-