Package de.f0rce.notify.util
Class Notification
java.lang.Object
com.vaadin.flow.component.Component
de.f0rce.notify.util.Notification
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.HasElement
,java.io.Serializable
@Tag("pre")
public class Notification
extends com.vaadin.flow.component.Component
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description Notification(com.vaadin.flow.component.UI ui, java.lang.String title, java.lang.String body)
Create a new Notification.Notification(com.vaadin.flow.component.UI ui, java.lang.String title, java.lang.String body, java.lang.String icon)
Create a new Notification. -
Method Summary
Modifier and Type Method Description java.lang.String
getBody()
Returns the current body.java.lang.String
getIcon()
Returns the current icon (uri, filepath or url).java.lang.String
getIdentifier()
Returns the random generated UUID (Identifier) for the frontend to differenciate between the different events.java.lang.String
getTitle()
Returns the current title.com.vaadin.flow.shared.Registration
onClick(com.vaadin.flow.component.ComponentEventListener<NotificationClickEvent> listener)
Adds a listener which listens to the "onclick" event sent by the notifications.com.vaadin.flow.shared.Registration
onClose(com.vaadin.flow.component.ComponentEventListener<NotificationCloseEvent> listener)
Adds a listener which listens to the "onclose" event sent by the notifications.com.vaadin.flow.shared.Registration
onError(com.vaadin.flow.component.ComponentEventListener<NotificationErrorEvent> listener)
Adds a listener which listens to the "onerror" event sent by the notifications.com.vaadin.flow.shared.Registration
onShow(com.vaadin.flow.component.ComponentEventListener<NotificationShowEvent> listener)
Adds a listener which listens to the "onshow" event sent by the notifications.void
send()
Send the notification to the user.void
send(int ms)
Send the notification to the user.Methods inherited from class com.vaadin.flow.component.Component
from, getChildren, getElement, getId, getParent, getTranslation, getTranslation, getUI, isVisible, onEnabledStateChanged, setId, setVisible
-
Constructor Details
-
Notification
public Notification(com.vaadin.flow.component.UI ui, java.lang.String title, java.lang.String body, java.lang.String icon)Create a new Notification. Be sure to useNotify.createNotification(String, String, String)
in order to use the sameUI
.- Parameters:
ui
- where the notification will be displayed - has to match theUI
inNotify
's default constructor.title
- the title of the notificationbody
- the body of the notificationicon
- the icon of the notification (uri, filepath or url)
-
Notification
public Notification(com.vaadin.flow.component.UI ui, java.lang.String title, java.lang.String body)Create a new Notification. Be sure to useNotify.createNotification(String, String)
in order to use the sameUI
.- Parameters:
ui
- where the notification will be displayed - has to match theUI
inNotify
's default constructor.title
- the title of the notificationbody
- the body of the notification
-
-
Method Details
-
getIdentifier
public java.lang.String getIdentifier()Returns the random generated UUID (Identifier) for the frontend to differenciate between the different events.- Returns:
String
-
getTitle
public java.lang.String getTitle()Returns the current title.- Returns:
String
-
getBody
public java.lang.String getBody()Returns the current body.- Returns:
String
-
getIcon
public java.lang.String getIcon()Returns the current icon (uri, filepath or url).- Returns:
String
-
send
public void send()Send the notification to the user. -
send
public void send(int ms)Send the notification to the user.- Parameters:
ms
- the time the notification will be displayed in milliseconds
-
onClick
public com.vaadin.flow.shared.Registration onClick(com.vaadin.flow.component.ComponentEventListener<NotificationClickEvent> listener)Adds a listener which listens to the "onclick" event sent by the notifications.- Parameters:
listener
-NotificationClickEvent
- Returns:
Registration
-
onError
public com.vaadin.flow.shared.Registration onError(com.vaadin.flow.component.ComponentEventListener<NotificationErrorEvent> listener)Adds a listener which listens to the "onerror" event sent by the notifications.- Parameters:
listener
-NotificationErrorEvent
- Returns:
Registration
-
onShow
public com.vaadin.flow.shared.Registration onShow(com.vaadin.flow.component.ComponentEventListener<NotificationShowEvent> listener)Adds a listener which listens to the "onshow" event sent by the notifications.- Parameters:
listener
-NotificationShowEvent
- Returns:
Registration
-
onClose
public com.vaadin.flow.shared.Registration onClose(com.vaadin.flow.component.ComponentEventListener<NotificationCloseEvent> listener)Adds a listener which listens to the "onclose" event sent by the notifications.- Parameters:
listener
-NotificationCloseEvent
- Returns:
Registration
-