Package io.jmix.ui

Interface Dialogs

All Known Implementing Classes:
DialogsImpl

public interface Dialogs
Utility dialogs API.
  • Method Details

    • createOptionDialog

      Dialogs.OptionDialogBuilder createOptionDialog()
      Creates option dialog builder.
      Example of showing an option dialog:
      
       dialogs.createOptionDialog()
               .withCaption("Question")
               .withMessage("Do you want to discard data?")
               .withActions(
                       new DialogAction(DialogAction.Type.YES).withHandler(e -> {
                           // YES option selected
                       }),
                       new DialogAction(DialogAction.Type.NO).withHandler(e -> {
                           // NO option selected
                       })
               )
               .show();
       
      Returns:
      builder
    • createMessageDialog

      Dialogs.MessageDialogBuilder createMessageDialog()
      Creates message dialog builder.
      Example of showing a message dialog:
      
       dialogs.createMessageDialog()
               .withCaption("Alert")
               .withMessage("Report has been saved")
               .show();
       
      Returns:
      builder
    • createExceptionDialog

      Dialogs.ExceptionDialogBuilder createExceptionDialog()
      Creates exception dialog builder.
      Example of showing an exception dialog:
      
       dialogs.createExceptionDialog()
               .withCaption("Alert")
               .withMessage("Report has been saved")
               .withThrowable(exception)
               .show();
       
      Returns:
      builder
    • createInputDialog

      Dialogs.InputDialogBuilder createInputDialog(FrameOwner owner)
      Creates input dialog builder.

      Example of showing an input dialog:

      
       dialogs.createInputDialog(this)
               .withParameters(
                       stringParameter("name").withCaption("Name"),
                       intParameter("count").withCaption("Count"))
               .withActions(DialogActions.OK_CANCEL)
               .withCloseListener(closeEvent ->
                       notifications.create(Notifications.NotificationType.TRAY)
                               .withCaption("Dialog is closed")
                               .show())
               .withCaption("Goods")
               .show();
       
      Parameters:
      owner - origin screen from input dialog is invoked
      Returns:
      builder
    • createBackgroundWorkDialog

      <T extends Number, V> Dialogs.BackgroundWorkDialogBuilder<T,V> createBackgroundWorkDialog(FrameOwner owner, BackgroundTask<T,V> backgroundTask)
      Creates background work dialog builder.

      Example of showing a background work dialog:

      
       dialogs.createBackgroundWorkDialog(this, backgroundTask)
               .withCaption("Task")
               .withMessage("My Task is Running")
               .withTotal(total)
               .withShowProgressInPercentage(true)
               .withCancelAllowed(true)
               .show();
       
      Parameters:
      owner - origin screen from the dialog is invoked
      Returns:
      builder