Class WebNotificationOptions.Builder
java.lang.Object
com.vaadin.flow.component.webnotification.WebNotificationOptions.Builder
- All Implemented Interfaces:
Serializable
- Enclosing class:
WebNotificationOptions
Builds
WebNotificationOptions. Every setter returns the builder
for chaining.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionSets the text shown below the title.build()Creates the options from the settings of this builder.Sets the URL of an image shown with the notification.renotify(boolean renotify) Sets whether replacing a notification with the same tag alerts the user again with sound or vibration.requireInteraction(boolean requireInteraction) Sets whether the notification stays visible until the user clicks or dismisses it, instead of closing automatically after a while.silent(boolean silent) Sets whether the notification is shown without sound or vibration.Sets the group the notification belongs to.
-
Method Details
-
body
Sets the text shown below the title.- Parameters:
body- the text, ornullfor none- Returns:
- this builder
-
icon
Sets the URL of an image shown with the notification. A relative URL is resolved against the page.- Parameters:
icon- the image URL, ornullfor the browser's default- Returns:
- this builder
-
tag
Sets the group the notification belongs to. Showing a notification replaces a notification with the same tag that is still visible, so repeated updates about the same thing do not pile up.- Parameters:
tag- the tag, ornullfor none- Returns:
- this builder
-
renotify
Sets whether replacing a notification with the same tag alerts the user again with sound or vibration. Without it the replacement is silent. Requires atag, and cannot be combined withsilent.- Parameters:
renotify-trueto alert the user again- Returns:
- this builder
-
requireInteraction
Sets whether the notification stays visible until the user clicks or dismisses it, instead of closing automatically after a while.- Parameters:
requireInteraction-trueto keep the notification visible- Returns:
- this builder
-
silent
Sets whether the notification is shown without sound or vibration.- Parameters:
silent-trueto show the notification silently- Returns:
- this builder
-
build
Creates the options from the settings of this builder.- Returns:
- the options
- Throws:
IllegalArgumentException- ifrenotifyis set without atagor together withsilent
-