1. Domino UI
  2. Components
  3. Dialogs
Top Basic dialogs Docs

Dialogs

The AbstractDialog class is the base class for creating dialog boxes in the Domino-UI framework. It provides various customization options and utility methods for creating and managing dialog boxes.

Usage Example:

 
 AbstractDialog dialog = new AbstractDialog()
     .setTitle("Example Dialog")
     .appendChild(new Text("This is a sample dialog box."))
     .setAutoClose(true)
     .open();
 

T

The concrete subclass of the AbstractDialog .

See also :

Alert dialog

The AlertMessageDialog class provides an alert message dialog that can display messages with a confirmation button.

Sample usage:

 
  AlertMessageDialog dialog = AlertMessageDialog.create("Confirmation", "Are you sure you want to proceed?")
    .onConfirm(alert -> {
      // Handle the confirmation logic here
    })
    .open();
 

Confirmation dialog

A dialog for displaying confirmation messages and getting user confirmation.

This dialog allows you to display a confirmation message to the user and get their response (either confirmation or rejection). It provides buttons for confirming and rejecting the action and can be customized with a title and message.

Usage example:

 
 ConfirmationDialog.create("Delete Item", "Are you sure you want to delete this item?")
   .onConfirm(dialog ->  {
     // Handle the confirmation logic here
     dialog.close();
   })
   .onReject(dialog ->  dialog.close())
   .open();
 

Message dialog

A dialog component for displaying messages to the user. It provides a convenient way to present information or prompt the user for a confirmation.

Usage:

 
 MessageDialog.create("Title", "This is the message")
     .onConfirm(dialog -> {
         // handle confirmation
     })
     .open();
 

Examples

Basic dialogs Use dialogs to get the user attention and to get his feedback.

API Docs: AbstractDialog

Constructors

public void AbstractDialog()
Constructs a new instance of AbstractDialog .

Public methods

public Transition getOpenTransition()
Gets the transition used when opening the dialog.

Returns:

The open transition.

public T setOpenTransition(Transition openTransition)
Sets the transition used when opening the dialog.

openTransition

The open transition to set.



Returns:

This dialog instance for method chaining.

public Transition getCloseTransition()
Gets the transition used when closing the dialog.

Returns:

The close transition.

public T setCloseTransition(Transition closeTransition)
Sets the transition used when closing the dialog.

closeTransition

The close transition to set.



Returns:

This dialog instance for method chaining.

public int getTransitionDuration()
Gets the duration of the open/close animation transition in milliseconds.

Returns:

The transition duration in milliseconds.

public T setTransitionDuration(int transitionDuration)
Sets the duration of the open/close animation transition in milliseconds.

transitionDuration

The transition duration in milliseconds to set.



Returns:

This dialog instance for method chaining.

public boolean isAnimate()
Checks if animations are enabled for opening and closing the dialog.

Returns:

true if animations are enabled, false otherwise.

public T setAnimate(boolean animate)
Enables or disables animations for opening and closing the dialog.

animate

true to enable animations, false to disable.



Returns:

This dialog instance for method chaining.

public T setAutoClose(boolean autoClose)
Enables or disables the automatic closing of the dialog when clicking outside of it.

autoClose

true to enable auto-closing, false to disable.



Returns:

This dialog instance for method chaining.

public T setAutoAppendAndRemove(boolean autoAppendAndRemove)
Enables or disables the automatic appending and removing of the dialog element to/from the document body.

autoAppendAndRemove

true to enable auto-append and auto-remove, false to disable.



Returns:

This dialog instance for method chaining.

public T open()
Opens the dialog box, making it visible to the user.

Returns:

This dialog instance for method chaining.

public T close()
Closes the dialog box, making it invisible to the user.

Returns:

This dialog instance for method chaining.

public boolean isAutoClose()
Checks if the dialog is set to automatically close when clicking outside of it.

Returns:

true if auto-close is enabled, false otherwise.

public T setStretchWidth(IsDialogWidth size)
Sets the width of the dialog to stretch according to the specified size.

size

The dialog width size.



Returns:

This dialog instance for method chaining.

public T setStretchHeight(IsDialogHeight size)
Sets the height of the dialog to stretch according to the specified size.

size

The dialog height size.



Returns:

This dialog instance for method chaining.

public boolean isModal()
Checks if the dialog is modal, i.e., if it blocks interactions with the rest of the page.

Returns:

true if the dialog is modal, false otherwise.

public T setModal(boolean modal)
Sets whether the dialog should be modal, blocking interactions with the rest of the page.

modal

true to make the dialog modal, false otherwise.



Returns:

This dialog instance for method chaining.

public boolean isAutoFocus()
Checks if the dialog is set to automatically focus on the first focusable element when opened.

Returns:

true if auto-focus is enabled, false otherwise.

public T setAutoFocus(boolean autoFocus)
Sets whether the dialog should automatically focus on the first focusable element when opened.

autoFocus

true to enable auto-focus, false to disable.



Returns:

This dialog instance for method chaining.

public HTMLElement getAppendTarget()
Check super implementation documentation.
public HTMLElement getStyleTarget()
Check super implementation documentation.
public HTMLDivElement element()
Check super implementation documentation.
public T appendChild(HeaderContent<?> element)
Appends a child element to the dialog's header.

element

The child element to append.



Returns:

This dialog instance for method chaining.

public T appendChild(FooterContent<?> element)
Appends a child element to the dialog's footer.

element

The child element to append.



Returns:

This dialog instance for method chaining.

public DivElement getModalElement()
Gets the modal element of the dialog, which is the overlay behind the content.

Returns:

The modal element.

public T withHeader(ChildHandler<T, DivElement> handler)
Allows customization of the dialog's header using a ChildHandler .

handler

The handler for customizing the header.



Returns:

This dialog instance for method chaining.

public DivElement getHeader()
Gets the header element of the dialog.

Returns:

The header element.

public T setIcon(Icon<?> icon)
Sets the icon for the dialog panel.

icon

The icon to set.



Returns:

This dialog instance for method chaining.

public T withContentBody(ChildHandler<T, DivElement> handler)
Allows customization of the dialog's content body using a ChildHandler .

handler

The handler for customizing the content body.



Returns:

This dialog instance for method chaining.

public DivElement getContentBody()
Gets the body element of the dialog.

Returns:

The body element.

public T withContentElement(ChildHandler<T, DivElement> handler)
Allows customization of the dialog's content element using a ChildHandler .

handler

The handler for customizing the content element.



Returns:

This dialog instance for method chaining.

public DivElement getContentElement()
Gets the content element of the dialog.

Returns:

The content element.

public T withContentHeader(ChildHandler<T, DivElement> handler)
Allows customization of the dialog's content header using a ChildHandler .

handler

The handler for customizing the content header.



Returns:

This dialog instance for method chaining.

public DivElement getContentHeader()
Gets the content header element of the dialog.

Returns:

The content header element.

public T withContentFooter(ChildHandler<T, DivElement> handler)
Allows customization of the dialog's content footer using a ChildHandler .

handler

The handler for customizing the content footer.



Returns:

This dialog instance for method chaining.

public DivElement getContentFooter()
Gets the content footer element of the dialog.

Returns:

The content footer element.

public Element getDefaultFocusElement()
Gets the default element to focus on when the dialog is opened.

Returns:

The default focus element.

public T setDefaultFocusElement(Element defaultFocusElement)
Sets the default element to focus on when the dialog is opened.

defaultFocusElement

The default focus element to set.



Returns:

This dialog instance for method chaining.

public T setDefaultFocusElement(IsElement<?> defaultFocusElement)
Sets the default element to focus on when the dialog is opened.

defaultFocusElement

The default focus element to set.



Returns:

This dialog instance for method chaining.

public T withMainElement(ChildHandler<T, DivElement> handler)
Use to apply changes to the actual root element of this dialog

handler



Returns:

same dialog instance

public boolean isOpen()
Checks if the dialog is currently open.

Returns:

true if the dialog is open, false otherwise.

API Docs: AlertMessageDialog

Constructors

public void AlertMessageDialog()
Creates an empty AlertMessageDialog.
public void AlertMessageDialog(String title)
Creates an AlertMessageDialog with a specified title.

title

The title of the dialog.

public void AlertMessageDialog(String title, String message)
Creates an AlertMessageDialog with a specified title and message.

title

The title of the dialog.

message

The message to display in the dialog.

Static methods

public static AlertMessageDialog create()
Creates a new instance of AlertMessageDialog .

Returns:

A new AlertMessageDialog instance with no title or message.

public static AlertMessageDialog create(String title)
Creates a new instance of AlertMessageDialog with the specified title.

title

The title for the dialog.



Returns:

A new AlertMessageDialog instance with the specified title and no message.

public static AlertMessageDialog create(String title, String message)
Creates a new instance of AlertMessageDialog with the specified title and message.

title

The title for the dialog.

message

The message to display in the dialog.



Returns:

A new AlertMessageDialog instance with the specified title and message.

Public methods

public AlertMessageDialog setTitle(String title)
Sets the title of the AlertMessageDialog.

title

The title to set.



Returns:

This AlertMessageDialog instance.

public AlertMessageDialog setMessage(String message)
Sets the message to be displayed in the AlertMessageDialog.

message

The message to set.



Returns:

This AlertMessageDialog instance.

public AlertMessageDialog onConfirm(MessageHandler handler)
Sets the handler for the confirmation button click event.

handler

The handler to be invoked when the confirmation button is clicked.



Returns:

This AlertMessageDialog instance.

public Button getConfirmButton()
Gets the confirmation button of the AlertMessageDialog.

Returns:

The confirmation Button.

public AlertMessageDialog withConfirmButton(ChildHandler<AlertMessageDialog, Button> handler)
Allows customization of the confirmation button using a handler.

handler

The handler for customizing the confirmation button.



Returns:

This AlertMessageDialog instance.

public Transition getIconStartTransition()
Gets the transition used for starting the icon animation.

Returns:

The start Transition.

public AlertMessageDialog setIconStartTransition(Transition transition)
Sets the transition used for starting the icon animation.

transition

The start Transition to set.



Returns:

This AlertMessageDialog instance.

public Transition getIconEndTransition()
Gets the transition used for ending the icon animation.

Returns:

The end Transition.

public AlertMessageDialog setIconEndTransition(Transition transition)
Sets the transition used for ending the icon animation.

transition

The end Transition to set.



Returns:

This AlertMessageDialog instance.

public int getIconAnimationDuration()
Gets the duration of the icon animation.

Returns:

The animation duration in milliseconds.

public AlertMessageDialog setIconAnimationDuration(int duration)
Sets the duration of the icon animation.

duration

The animation duration to set in milliseconds.



Returns:

This AlertMessageDialog instance.

public Icon<?> getAlertIcon()
Gets the alert icon displayed in the dialog.

Returns:

The alert Icon.

public AlertMessageDialog setAlertIcon(Icon<?> alertIcon)
Sets the alert icon to be displayed in the dialog.

alertIcon

The alert Icon to set.



Returns:

This AlertMessageDialog instance.

public AlertMessageDialog withNavHeader(ChildHandler<AlertMessageDialog, NavBar> handler)
Allows customization of the navigation header using a handler.

handler

The handler for customizing the navigation header.



Returns:

This AlertMessageDialog instance.

API Docs: ConfirmationDialog

Constructors

public void ConfirmationDialog()
Creates a new empty ConfirmationDialog instance.
public void ConfirmationDialog(String title)
Creates a new ConfirmationDialog instance with the specified title.

title

The title to set for the dialog.

public void ConfirmationDialog(String title, String message)
Creates a new ConfirmationDialog instance with the specified title and message.

title

The title to set for the dialog.

message

The message to display in the dialog.

Static methods

public static ConfirmationDialog create()
Creates a new confirmation dialog with default settings.
public static ConfirmationDialog create(String title)
Creates a new confirmation dialog with a specified title.

title

The title of the confirmation dialog.

public static ConfirmationDialog create(String title, String message)
Creates a new confirmation dialog with a specified title and message.

title

The title of the confirmation dialog.

message

The message to display in the dialog.

Public methods

public ConfirmationDialog setTitle(String title)
Sets the title of the dialog.

title

The title to set for the dialog.



Returns:

This ConfirmationDialog instance for method chaining.

public ConfirmationDialog setMessage(String message)
Sets the message to be displayed in the dialog.

message

The message to display in the dialog.



Returns:

This ConfirmationDialog instance for method chaining.

public ConfirmationDialog onConfirm(ConfirmHandler confirmHandler)
Sets the action to be performed when the confirm button is clicked.

confirmHandler

The action to be executed on confirmation.



Returns:

This ConfirmationDialog instance for method chaining.

public ConfirmationDialog onReject(RejectHandler rejectHandler)
Sets the action to be performed when the reject button is clicked.

rejectHandler

The action to be executed on rejection.



Returns:

This ConfirmationDialog instance for method chaining.

public Button getConfirmButton()
Retrieves the confirm button of the dialog.

Returns:

The confirm button.

public Button getRejectButton()
Retrieves the reject button of the dialog.

Returns:

The reject button.

public ConfirmationDialog withConfirmButton(ChildHandler<ConfirmationDialog, Button> handler)
Configures the confirm button of the dialog using a handler for customization.

handler

The handler to customize the confirm button.



Returns:

This ConfirmationDialog instance for method chaining.

public ConfirmationDialog withRejectButton(ChildHandler<ConfirmationDialog, Button> handler)
Configures the reject button of the dialog using a handler for customization.

handler

The handler to customize the reject button.



Returns:

This ConfirmationDialog instance for method chaining.

public ConfirmationDialog withNavHeader(ChildHandler<ConfirmationDialog, NavBar> handler)
Configures the header of the dialog using a handler for customization.

handler

The handler to customize the dialog header.



Returns:

This ConfirmationDialog instance for method chaining.

API Docs: MessageDialog

Constructors

public void MessageDialog()
Default constructor for creating a new instance of MessageDialog without title and message.
public void MessageDialog(String title)
Constructs a new instance of MessageDialog with a title.

title

The title of the dialog

public void MessageDialog(String title, String message)
Constructs a new instance of MessageDialog with a title and message.

title

The title of the dialog

message

The message to display in the dialog

Static methods

public static MessageDialog create()
Factory method for creating a new instance of MessageDialog without a title and message.

Returns:

A new instance of MessageDialog

public static MessageDialog create(String title)
Factory method for creating a new instance of MessageDialog with a title.

title

The title of the dialog



Returns:

A new instance of MessageDialog

public static MessageDialog create(String title, String message)
Factory method for creating a new instance of MessageDialog with a title and message.

title

The title of the dialog

message

The message to display in the dialog



Returns:

A new instance of MessageDialog

Public methods

public MessageDialog setTitle(String title)
Sets the title for the MessageDialog .

title

The title of the dialog



Returns:

Current instance for chaining

public MessageDialog setMessage(String message)
Sets the message for the MessageDialog .

message

The message to display in the dialog



Returns:

Current instance for chaining

public MessageDialog onConfirm(MessageHandler handler)
Set a handler to be called when the dialog is confirmed.

handler

The MessageHandler to handle the confirmation event



Returns:

Current instance for chaining

public Button getConfirmButton()
Returns the confirm button of the dialog.

Returns:

The Button used for confirming the dialog

public MessageDialog withConfirmButton(ChildHandler<MessageDialog, Button> handler)
Apply custom modifications to the confirm button of the dialog.

handler

The handler to modify the confirm button



Returns:

Current instance for chaining

public MessageDialog withNavHeader(ChildHandler<MessageDialog, NavBar> handler)
Apply custom modifications to the navigation header of the dialog.

handler

The handler to modify the navigation header



Returns:

Current instance for chaining

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

Donate & Support Us