Package it.tidalwave.util.ui
Class UserNotificationWithFeedback
- java.lang.Object
- 
- it.tidalwave.util.ui.UserNotification
- 
- it.tidalwave.util.ui.UserNotificationWithFeedback
 
 
- 
 @Immutable public class UserNotificationWithFeedback extends UserNotification This class models a user notification where a feedback is expected (confirmation or cancellation).- Author:
- Fabrizio Giudici
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classUserNotificationWithFeedback.FeedbackThis class provides a few callback methods to notify a choice from the user.
 - 
Field SummaryFields Modifier and Type Field Description protected UserNotificationWithFeedback.Feedbackfeedback- 
Fields inherited from class it.tidalwave.util.ui.UserNotificationcaption, text
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedUserNotificationWithFeedback(java.lang.String text, java.lang.String caption, UserNotificationWithFeedback.Feedback feedback)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Notifies a cancellation to the user notification.voidconfirm()Notifies a confirmation to the user notification.static UserNotificationWithFeedback.Feedbackfeedback()Creates a newFeedbackthat does nothing.static UserNotificationWithFeedbacknotificationWithFeedback()Creates a notification with empty caption and text.UserNotificationWithFeedbackwithCaption(java.lang.Class<?> bundleClass, java.lang.String resourceName, java.lang.Object... params)Associates a caption to the notification, retrieved from a resource bundle.UserNotificationWithFeedbackwithCaption(java.lang.String caption)Associates a caption to the notification.UserNotificationWithFeedbackwithFeedback(UserNotificationWithFeedback.Feedback feedback)Associates aUserNotificationWithFeedback.Feedbackto the notification.UserNotificationWithFeedbackwithText(java.lang.Class<?> bundleClass, java.lang.String resourceName, java.lang.Object... params)Associates a text to the notification, retrieved from a resource bundle.UserNotificationWithFeedbackwithText(java.lang.String text)Associates a text to the notification.- 
Methods inherited from class it.tidalwave.util.ui.UserNotificationnotification
 
- 
 
- 
- 
- 
Field Detail- 
feedbackprotected final UserNotificationWithFeedback.Feedback feedback 
 
- 
 - 
Constructor Detail- 
UserNotificationWithFeedbackprotected UserNotificationWithFeedback(@Nonnull java.lang.String text, @Nonnull java.lang.String caption, @Nonnull UserNotificationWithFeedback.Feedback feedback)- Parameters:
- text- the notification text
- caption- the notification caption
- feedback- the feedback
 
 
- 
 - 
Method Detail- 
notificationWithFeedback@Nonnull public static UserNotificationWithFeedback notificationWithFeedback() Creates a notification with empty caption and text.- Returns:
- the notification
 
 - 
withCaption@Nonnull public UserNotificationWithFeedback withCaption(@Nonnull java.lang.String caption) Associates a caption to the notification.- Overrides:
- withCaptionin class- UserNotification
- Parameters:
- caption- the caption
- Returns:
- the notification
 
 - 
withCaption@Nonnull public UserNotificationWithFeedback withCaption(@Nonnull java.lang.Class<?> bundleClass, @Nonnull java.lang.String resourceName, @Nonnull java.lang.Object... params) Associates a caption to the notification, retrieved from a resource bundle.- Overrides:
- withCaptionin 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:
- the notification
 
 - 
withText@Nonnull public UserNotificationWithFeedback withText(@Nonnull java.lang.String text) Associates a text to the notification.- Overrides:
- withTextin class- UserNotification
- Parameters:
- text- the text
- Returns:
- the notification
 
 - 
withText@Nonnull public UserNotificationWithFeedback withText(@Nonnull java.lang.Class<?> bundleClass, @Nonnull java.lang.String resourceName, @Nonnull java.lang.Object... params) Associates a text to the notification, retrieved from a resource bundle.- Overrides:
- withTextin 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:
- the notification
 
 - 
withFeedback@Nonnull public UserNotificationWithFeedback withFeedback(@Nonnull UserNotificationWithFeedback.Feedback feedback) Associates aUserNotificationWithFeedback.Feedbackto the notification.- Parameters:
- feedback- the- Feedbackto associate
- Returns:
- the notification
 
 - 
confirmpublic void confirm() throws java.lang.ExceptionNotifies a confirmation to the user notification.- Throws:
- java.lang.Exception- in cases of error
 
 - 
cancelpublic void cancel() throws java.lang.ExceptionNotifies a cancellation to the user notification.- Throws:
- java.lang.Exception- in cases of error
 
 - 
feedback@Nonnull public static UserNotificationWithFeedback.Feedback feedback() Creates 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 feedback that does nothing in any case
- Since:
- 3.2-ALPHA-1 (was previously on Feedback8
 
 
- 
 
-