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).- Version:
- $Id$
- Author:
- Fabrizio Giudici
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUserNotificationWithFeedback.FeedbackThis class provides a few callback methods to notify a choice from the user.
-
Field Summary
Fields Modifier and Type Field Description protected UserNotificationWithFeedback.Feedbackfeedback-
Fields inherited from class it.tidalwave.util.ui.UserNotification
caption, text
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedUserNotificationWithFeedback(String text, String caption, UserNotificationWithFeedback.Feedback feedback)
-
Method Summary
All 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 UserNotificationWithFeedbacknotificationWithFeedback()Creates a notification with empty caption and text.UserNotificationWithFeedbackwithCaption(Class<?> bundleClass, String resourceName, Object... params)Associates a caption to the notification, retrieved from a resource bundle.UserNotificationWithFeedbackwithCaption(String caption)Associates a caption to the notification.UserNotificationWithFeedbackwithFeedback(UserNotificationWithFeedback.Feedback feedback)Associates aUserNotificationWithFeedback.Feedbackto the notification.UserNotificationWithFeedbackwithText(Class<?> bundleClass, String resourceName, Object... params)Associates a text to the notification, retrieved from a resource bundle.UserNotificationWithFeedbackwithText(String text)Associates a text to the notification.-
Methods inherited from class it.tidalwave.util.ui.UserNotification
notification
-
-
-
-
Field Detail
-
feedback
protected final UserNotificationWithFeedback.Feedback 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 String caption)
Associates a caption to the notification.- Overrides:
withCaptionin classUserNotification- Parameters:
caption- the caption- Returns:
- the notification
-
withCaption
@Nonnull public UserNotificationWithFeedback withCaption(@Nonnull Class<?> bundleClass, @Nonnull String resourceName, @Nonnull Object... params)
Associates a caption to the notification, retrieved from a resource 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:
- the notification
-
withText
@Nonnull public UserNotificationWithFeedback withText(@Nonnull String text)
Associates a text to the notification.- Overrides:
withTextin classUserNotification- Parameters:
text- the text- Returns:
- the notification
-
withText
@Nonnull public UserNotificationWithFeedback withText(@Nonnull Class<?> bundleClass, @Nonnull String resourceName, @Nonnull Object... params)
Associates a text to the notification, retrieved from a resource 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:
- the notification
-
withFeedback
@Nonnull public UserNotificationWithFeedback withFeedback(@Nonnull UserNotificationWithFeedback.Feedback feedback)
Associates aUserNotificationWithFeedback.Feedbackto the notification.- Parameters:
feedback- theFeedbackto associate- Returns:
- the notification
-
confirm
public void confirm() throws ExceptionNotifies a confirmation to the user notification.- Throws:
Exception- in cases of error
-
-