Record Class DialogBase

java.lang.Object
java.lang.Record
fr.fidorial.dialog.DialogBase
Record Components:
title - the screen title, always visible whatever the dialog type
externalTitle - the label of the button leading to this dialog from elsewhere, for instance the pause menu; falls back to title when absent
body - the elements laid out between the title and the inputs
inputs - the controls the player fills in
canCloseWithEscape - whether the escape key dismisses the dialog
pause - whether the dialog pauses a single-player game; irrelevant on a dedicated server but still part of the format
afterAction - what the client does with the screen once a button has been pressed

public record DialogBase(Component title, @Nullable Component externalTitle, List<DialogBody> body, List<DialogInput> inputs, boolean canCloseWithEscape, boolean pause, DialogAfterAction afterAction) extends Record
Since:
0.1.0
  • Constructor Details

  • Method Details

    • of

      @Contract("_ -> new") public static DialogBase of(ComponentLike title)
      Creates a bare dialog base carrying nothing but a title.
      Parameters:
      title - the screen title
      Returns:
      the base
      Since:
      0.1.0
    • builder

      @Contract("_ -> new") public static DialogBase.Builder builder(ComponentLike title)
      Starts building a dialog base.
      Parameters:
      title - the screen title
      Returns:
      a fresh builder
      Since:
      0.1.0
    • toBuilder

      @Contract("-> new") public DialogBase.Builder toBuilder()
      Returns a builder pre-filled with this base.
      Returns:
      a builder pre-filled with this base
      Since:
      0.1.0
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • title

      public Component title()
      Returns the value of the title record component.
      Returns:
      the value of the title record component
    • externalTitle

      public @Nullable Component externalTitle()
      Returns the value of the externalTitle record component.
      Returns:
      the value of the externalTitle record component
    • body

      public List<DialogBody> body()
      Returns the value of the body record component.
      Returns:
      the value of the body record component
    • inputs

      public List<DialogInput> inputs()
      Returns the value of the inputs record component.
      Returns:
      the value of the inputs record component
    • canCloseWithEscape

      public boolean canCloseWithEscape()
      Returns the value of the canCloseWithEscape record component.
      Returns:
      the value of the canCloseWithEscape record component
    • pause

      public boolean pause()
      Returns the value of the pause record component.
      Returns:
      the value of the pause record component
    • afterAction

      public DialogAfterAction afterAction()
      Returns the value of the afterAction record component.
      Returns:
      the value of the afterAction record component