Class ConfirmDialog.Builder

java.lang.Object
dev.xichil.mvui.ConfirmDialog.Builder
Enclosing class:
ConfirmDialog

public static final class ConfirmDialog.Builder extends Object
Builds a ConfirmDialog; from ConfirmDialog.builder(String). Setters return the builder for chaining.
  • Method Details

    • title

      public ConfirmDialog.Builder title(Text title)
      The question, shown at the top, e.g. "Delete profile 'default'?". Required.
      Parameters:
      title - the question
      Returns:
      this builder
    • message

      public ConfirmDialog.Builder message(Text message)
      The explanation below the question, e.g. "This can't be undone.". Required.
      Parameters:
      message - the explanation
      Returns:
      this builder
    • yesLabel

      public ConfirmDialog.Builder yesLabel(Text yesLabel)
      The "yes" button's label; UiTexts.YES by default. A verb ("Delete", "Overwrite") is clearer.
      Parameters:
      yesLabel - the label
      Returns:
      this builder
    • noLabel

      public ConfirmDialog.Builder noLabel(Text noLabel)
      The "no" button's label; UiTexts.NO by default, e.g. UiTexts.CANCEL.
      Parameters:
      noLabel - the label
      Returns:
      this builder
    • onYes

      public ConfirmDialog.Builder onYes(Runnable onYes)
      What "yes" does, run on the main thread after the dialog has closed. Required.
      Parameters:
      onYes - the action
      Returns:
      this builder
    • onNo

      public ConfirmDialog.Builder onNo(Runnable onNo)
      What "no" does, run on the main thread after the dialog has closed. Optional: by default "no" just closes the dialog.
      Parameters:
      onNo - the action
      Returns:
      this builder
    • build

      public ConfirmDialog build()
      Builds the dialog.
      Returns:
      the dialog
      Throws:
      IllegalStateException - if title, message or onYes is missing