1. Domino UI
  2. Components
  3. Notifications
Top Basic Context Colored Animation Docs

Modals

Represents a UI notification component.

Usage example:

 
 Notification.create("This is a sample message")
             .setPosition(Notification.Position.TOP_RIGHT)
             .show();
 

See also :

Examples

Basic notifications Show a notification in different positions.

Context notifications Notifications based on the context, error, success, warning and others.

Colored notifications Notifications can be customized with different colors.

Notification animations Notifications can have different types of enter and exit animations.

API Docs: Notification

Constructors

public void Notification()
Constructs a default notification instance.

Static methods

public static Notification create(String message)
Creates a new notification with the specified message.

message

the message of the notification



Returns:

a new notification instance

public static Notification create()
Creates a new default notification.

Returns:

a new notification instance

public static void dismissAll()
Close all currently opened notifications
public static void dismissAll(Runnable finalizer)
Close all currently opened notifications

Public methods

public HTMLElement getStyleTarget()
Check super implementation documentation.

Returns the main element of this notification to which styles can be applied.

Returns:

the style target element

public HTMLElement getAppendTarget()
Check super implementation documentation.

Returns the main content element of this notification to which additional content can be appended.

Returns:

the append target element

public RemoveButton getCloseButton()
Retrieves the close button of the notification.

Returns:

the close button

public Notification setDismissible(boolean dismissible)
Sets whether the notification can be dismissed by the user.

dismissible

true if the notification should be dismissible, false otherwise



Returns:

this notification for chaining

public boolean isDismissible()
Checks if the notification is dismissible by the user.

Returns:

true if the notification is dismissible, false otherwise

public Notification setDuration(int duration)
Sets the duration for which the notification will be displayed.

duration

the duration in milliseconds



Returns:

this notification for chaining

public Notification inTransition(Transition inTransition)
Sets the transition animation when the notification is displayed.

inTransition

the in-transition animation



Returns:

this notification for chaining

public Notification outTransition(Transition outTransition)
Sets the transition animation when the notification is hidden.

outTransition

the out-transition animation



Returns:

this notification for chaining

public Notification setMessage(String message)
Sets the message content for the notification.

message

the message to be displayed



Returns:

this notification for chaining

public Notification setPosition(Position position)
Sets the position for the notification on the screen.

position

the desired position for the notification



Returns:

this notification for chaining

public Notification setInfinite(boolean infinite)
Specifies whether the notification should be displayed indefinitely.

infinite

true if the notification should be displayed indefinitely, false otherwise



Returns:

this notification for chaining

public boolean isInfinite()
Checks if the notification is set to be displayed indefinitely.

Returns:

true if the notification is set to be displayed indefinitely, false otherwise

public Notification show()
Check super implementation documentation.

Shows the notification on the screen.

Returns:

this notification for chaining

public Notification hide()
Check super implementation documentation.

Hides the notification from the screen.

Returns:

this notification for chaining

public Notification expand()
Displays the notification on the screen using the set animation and updates its position.

Returns:

this notification for chaining

public final void close()
Closes the notification immediately.
public final void close(int after)
Closes the notification after a specified delay.

after

the delay in milliseconds after which the notification should be closed

public final void close(Runnable finalizer)
Closes the notification immediately.
public final void close(int after, Runnable finalizer)
Closes the notification after a specified delay.

after

the delay in milliseconds after which the notification should be closed

public List<NotificationHandler> getCloseHandlers()
Retrieves the list of close handlers associated with the notification.

Returns:

a list of close handlers

public List<NotificationHandler> getShowHandlers()
Retrieves the list of show handlers associated with the notification.

Returns:

a list of show handlers

public Notification addCloseHandler(NotificationHandler notificationHandler)
Adds a close handler to the notification.

notificationHandler

the close handler to be added



Returns:

this notification for chaining

public Notification addShowHandler(NotificationHandler showHandler)
Adds a show handler to the notification.

showHandler

the show handler to be added



Returns:

this notification for chaining

public Notification removeCloseHandler(NotificationHandler notificationHandler)
Removes a specified close handler from the notification.

notificationHandler

the close handler to be removed



Returns:

this notification for chaining

public Notification removeShowHandler(NotificationHandler showHandler)
Removes a specified show handler from the notification.

showHandler

the show handler to be removed



Returns:

this notification for chaining

public Notification withContent(ChildHandler<Notification, DivElement> handler)
Adds custom content to the notification.

handler

a handler that will be provided with the notification and its content element



Returns:

this notification for chaining

public HTMLDivElement element()
Retrieves the root HTMLDivElement of the notification.

Returns:

the root HTMLDivElement of the notification

We are a group of passionate people who love what we do

Donate & Support Us