public class WebNotifications.NotificationBuilderImpl extends java.lang.Object implements Notifications.NotificationBuilder
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
caption |
protected java.util.function.Consumer<Notifications.CloseEvent> |
closeListener |
protected ContentMode |
contentMode |
protected java.lang.String |
description |
protected int |
hideDelayMs |
protected boolean |
htmlSanitizerEnabled |
protected Notifications.NotificationType |
notificationType |
protected Notifications.Position |
position |
protected java.lang.String |
styleName |
static java.lang.String |
SYSTEM_STYLENAME |
Constructor and Description |
---|
NotificationBuilderImpl() |
Modifier and Type | Method and Description |
---|---|
protected com.vaadin.ui.Notification.Type |
convertType(Notifications.NotificationType notificationType) |
protected com.vaadin.ui.Notification |
createNotification() |
java.lang.String |
getCaption() |
java.util.function.Consumer<Notifications.CloseEvent> |
getCloseListener() |
ContentMode |
getContentMode() |
java.lang.String |
getDescription() |
int |
getHideDelayMs() |
Notifications.Position |
getPosition() |
java.lang.String |
getStyleName() |
Notifications.NotificationType |
getType() |
boolean |
isHtmlSanitizerEnabled() |
protected void |
setNotificationDelayMsec(com.vaadin.ui.Notification notification,
Notifications.NotificationType type) |
void |
show()
Shows notification.
|
Notifications.NotificationBuilder |
withCaption(java.lang.String caption)
Sets notification caption.
|
Notifications.NotificationBuilder |
withCloseListener(java.util.function.Consumer<Notifications.CloseEvent> closeListener)
Sets the listener that will be fired when notification will be closed.
|
Notifications.NotificationBuilder |
withContentMode(ContentMode contentMode)
Sets content mode for caption and description of notification.
|
Notifications.NotificationBuilder |
withDescription(java.lang.String description)
Sets notification description.
|
Notifications.NotificationBuilder |
withHideDelayMs(int hideDelayMs)
Sets the delay before the notification disappears.
|
Notifications.NotificationBuilder |
withHtmlSanitizer(boolean htmlSanitizerEnabled)
Sets whether html sanitizer is enabled or not for notification content.
|
Notifications.NotificationBuilder |
withPosition(Notifications.Position position)
Sets position of notification.
|
Notifications.NotificationBuilder |
withStyleName(java.lang.String styleName)
Sets CSS class name for notification DOM element.
|
Notifications.NotificationBuilder |
withType(Notifications.NotificationType notificationType)
Sets type of notification.
|
public static final java.lang.String SYSTEM_STYLENAME
protected java.lang.String caption
protected java.lang.String description
protected java.lang.String styleName
protected boolean htmlSanitizerEnabled
protected Notifications.Position position
protected int hideDelayMs
protected ContentMode contentMode
protected Notifications.NotificationType notificationType
protected java.util.function.Consumer<Notifications.CloseEvent> closeListener
public Notifications.NotificationBuilder withCaption(java.lang.String caption)
Notifications.NotificationBuilder
withCaption
in interface Notifications.NotificationBuilder
caption
- captionpublic java.lang.String getCaption()
getCaption
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withDescription(java.lang.String description)
Notifications.NotificationBuilder
withDescription
in interface Notifications.NotificationBuilder
description
- descriptionpublic java.lang.String getDescription()
getDescription
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withType(Notifications.NotificationType notificationType)
Notifications.NotificationBuilder
withType
in interface Notifications.NotificationBuilder
notificationType
- typepublic Notifications.NotificationType getType()
getType
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withContentMode(ContentMode contentMode)
Notifications.NotificationBuilder
withContentMode
in interface Notifications.NotificationBuilder
contentMode
- content modepublic ContentMode getContentMode()
getContentMode
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withStyleName(java.lang.String styleName)
Notifications.NotificationBuilder
withStyleName
in interface Notifications.NotificationBuilder
styleName
- CSS class namepublic java.lang.String getStyleName()
getStyleName
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withPosition(Notifications.Position position)
Notifications.NotificationBuilder
withPosition
in interface Notifications.NotificationBuilder
position
- positionpublic Notifications.Position getPosition()
getPosition
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withHtmlSanitizer(boolean htmlSanitizerEnabled)
Notifications.NotificationBuilder
withHtmlSanitizer
in interface Notifications.NotificationBuilder
htmlSanitizerEnabled
- specifies whether html sanitizer is enabledpublic boolean isHtmlSanitizerEnabled()
isHtmlSanitizerEnabled
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withHideDelayMs(int hideDelayMs)
Notifications.NotificationBuilder
withHideDelayMs
in interface Notifications.NotificationBuilder
hideDelayMs
- the desired delay in milliseconds, to
require the user to click the messagepublic int getHideDelayMs()
getHideDelayMs
in interface Notifications.NotificationBuilder
public Notifications.NotificationBuilder withCloseListener(java.util.function.Consumer<Notifications.CloseEvent> closeListener)
Notifications.NotificationBuilder
withCloseListener
in interface Notifications.NotificationBuilder
closeListener
- Notifications.CloseEvent
consumerpublic java.util.function.Consumer<Notifications.CloseEvent> getCloseListener()
getCloseListener
in interface Notifications.NotificationBuilder
protected com.vaadin.ui.Notification.Type convertType(Notifications.NotificationType notificationType)
protected void setNotificationDelayMsec(com.vaadin.ui.Notification notification, Notifications.NotificationType type)
protected com.vaadin.ui.Notification createNotification()
public void show()
Notifications.NotificationBuilder
show
in interface Notifications.NotificationBuilder