Usage example:
Notification.create("This is a sample message")
.setPosition(Notification.Position.TOP_RIGHT)
.show();
See also :
public void Notification()
public static Notification create(String message)
message
the message of the notification
a new notification instance
public static Notification create()
a new notification instance
public static void dismissAll()
public static void dismissAll(Runnable finalizer)
public HTMLElement getStyleTarget()
Returns the main element of this notification to which styles can be applied.
Returns:
the style target element
public HTMLElement getAppendTarget()
Returns the main content element of this notification to which additional content can be appended.
Returns:
the append target element
public RemoveButton getCloseButton()
the close button
public Notification setDismissible(boolean dismissible)
dismissible
true if the notification should be dismissible, false otherwise
this notification for chaining
public boolean isDismissible()
true if the notification is dismissible, false otherwise
public Notification setDuration(int duration)
duration
the duration in milliseconds
this notification for chaining
public Notification inTransition(Transition inTransition)
inTransition
the in-transition animation
this notification for chaining
public Notification outTransition(Transition outTransition)
outTransition
the out-transition animation
this notification for chaining
public Notification setMessage(String message)
message
the message to be displayed
this notification for chaining
public Notification setPosition(Position position)
position
the desired position for the notification
this notification for chaining
public Notification setInfinite(boolean infinite)
infinite
true if the notification should be displayed indefinitely, false otherwise
this notification for chaining
public boolean isInfinite()
true if the notification is set to be displayed indefinitely, false otherwise
public Notification show()
Shows the notification on the screen.
Returns:
this notification for chaining
public Notification hide()
Hides the notification from the screen.
Returns:
this notification for chaining
public Notification expand()
this notification for chaining
public final void close()
public final void close(int after)
after
the delay in milliseconds after which the notification should be closed
public final void close(Runnable finalizer)
public final void close(int after, Runnable finalizer)
after
the delay in milliseconds after which the notification should be closed
public List<NotificationHandler> getCloseHandlers()
a list of close handlers
public List<NotificationHandler> getShowHandlers()
a list of show handlers
public Notification addCloseHandler(NotificationHandler notificationHandler)
notificationHandler
the close handler to be added
this notification for chaining
public Notification addShowHandler(NotificationHandler showHandler)
showHandler
the show handler to be added
this notification for chaining
public Notification removeCloseHandler(NotificationHandler notificationHandler)
notificationHandler
the close handler to be removed
this notification for chaining
public Notification removeShowHandler(NotificationHandler showHandler)
showHandler
the show handler to be removed
this notification for chaining
public Notification withContent(ChildHandler<Notification, DivElement> handler)
handler
a handler that will be provided with the notification and its content element
this notification for chaining
public HTMLDivElement element()
the root HTMLDivElement of the notification