Class DialogBase.Builder

java.lang.Object
fr.fidorial.dialog.DialogBase.Builder
Enclosing class:
DialogBase

public static final class DialogBase.Builder extends Object
Fluent builder for DialogBase.
Since:
0.1.0
  • Method Details

    • title

      @Contract("_ -> this") public DialogBase.Builder title(ComponentLike title)
      Parameters:
      title - the screen title
      Returns:
      this builder
      Since:
      0.1.0
    • externalTitle

      @Contract("_ -> this") public DialogBase.Builder externalTitle(@Nullable ComponentLike externalTitle)
      Parameters:
      externalTitle - the label of the button leading to this dialog, or null to reuse the title
      Returns:
      this builder
      Since:
      0.1.0
    • body

      @Contract("_ -> this") public DialogBase.Builder body(DialogBody element)
      Appends a body element.
      Parameters:
      element - the element to append
      Returns:
      this builder
      Since:
      0.1.0
    • body

      @Contract("_ -> this") public DialogBase.Builder body(ComponentLike message)
      Appends a plain text body element.
      Parameters:
      message - the text to display
      Returns:
      this builder
      Since:
      0.1.0
    • body

      @Contract("_ -> this") public DialogBase.Builder body(List<? extends DialogBody> elements)
      Appends several body elements.
      Parameters:
      elements - the elements to append
      Returns:
      this builder
      Since:
      0.1.0
    • input

      @Contract("_ -> this") public DialogBase.Builder input(DialogInput input)
      Appends an input control.
      Parameters:
      input - the control to append
      Returns:
      this builder
      Since:
      0.1.0
    • inputs

      @Contract("_ -> this") public DialogBase.Builder inputs(List<? extends DialogInput> inputs)
      Appends several input controls.
      Parameters:
      inputs - the controls to append
      Returns:
      this builder
      Since:
      0.1.0
    • canCloseWithEscape

      @Contract("_ -> this") public DialogBase.Builder canCloseWithEscape(boolean canCloseWithEscape)
      Parameters:
      canCloseWithEscape - whether the escape key dismisses the dialog
      Returns:
      this builder
      Since:
      0.1.0
    • pause

      @Contract("_ -> this") public DialogBase.Builder pause(boolean pause)
      Parameters:
      pause - whether the dialog pauses a single-player game
      Returns:
      this builder
      Since:
      0.1.0
    • afterAction

      @Contract("_ -> this") public DialogBase.Builder afterAction(DialogAfterAction afterAction)
      Sets what the client does once a button has been pressed.

      Picking DialogAfterAction.NONE also clears the pause flag, since the two are mutually exclusive.

      Parameters:
      afterAction - the behaviour to apply
      Returns:
      this builder
      Since:
      0.1.0
    • build

      @Contract("-> new") public DialogBase build()
      Returns the built base.
      Returns:
      the built base
      Since:
      0.1.0