Class DialogAction

All Implemented Interfaces:
Action, Action.HasPrimaryState, Action.SecuredAction

public class DialogAction extends BaseAction
Standard action for option dialogs.
You can use fluent API to create instances of DialogAction and assign handlers to them:

     showOptionDialog(
             "Select options",
             "Do you want to print all rows?",
             MessageType.CONFIRMATION,
             new Action[]{
                     new DialogAction(Type.YES).withHandler(event -> {
                         // add action logic here
                     }),
                     new DialogAction(Type.NO)
                             .withCaption("Print selected")
                             .withIcon(JmixIcon.PRINT.source())
                             .withStyleName("print-selected")
                             .withHandler(event -> {
                         // add action logic here
                     }),
                     new DialogAction(Type.CANCEL)
             });
 
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getType

      @Nullable public DialogAction.Type getType()
    • getStyleName

      @Nullable public String getStyleName()
      Returns:
      style name or null if not set
    • withStyleName

      public DialogAction withStyleName(@Nullable String styleName)
      Sets style name that will be used in the corresponding button of the dialog.
      Parameters:
      styleName - style name
      Returns:
      current instance of action
    • withCaption

      public DialogAction withCaption(@Nullable String caption)
      Set caption using fluent API method.
      Overrides:
      withCaption in class BaseAction
      Parameters:
      caption - caption
      Returns:
      current instance of action
    • withDescription

      public DialogAction withDescription(@Nullable String description)
      Set description using fluent API method.
      Overrides:
      withDescription in class BaseAction
      Parameters:
      description - description
      Returns:
      current instance of action
    • withIcon

      public DialogAction withIcon(@Nullable String icon)
      Set icon using fluent API method.
      Overrides:
      withIcon in class BaseAction
      Parameters:
      icon - icon
      Returns:
      current instance of action
    • withShortcut

      public DialogAction withShortcut(@Nullable String shortcut)
      Set shortcut using fluent API method.
      Overrides:
      withShortcut in class BaseAction
      Parameters:
      shortcut - shortcut
      Returns:
      current instance of action
    • withHandler

      public DialogAction withHandler(Consumer<Action.ActionPerformedEvent> handler)
      Set action performed event handler using fluent API method. Can be used instead of subclassing BaseAction class.
      Overrides:
      withHandler in class BaseAction
      Parameters:
      handler - action performed handler
      Returns:
      current instance of action
    • withPrimary

      public DialogAction withPrimary(boolean primary)
      Set whether this action is primary using fluent API method. Can be used instead of subclassing BaseAction class.
      Overrides:
      withPrimary in class BaseAction
      Parameters:
      primary - primary
      Returns:
      current instance of action