Record Class DialogListDialog

java.lang.Object
java.lang.Record
fr.fidorial.dialog.DialogListDialog
Record Components:
base - the shared title, contents and behaviour
dialogs - the dialogs to list, never empty
exitAction - the footer button, or null for no footer
columns - how many buttons sit side by side
buttonWidth - the width of each button, between 1 and 1024
All Implemented Interfaces:
Dialog, DialogDefinition, DialogLike

public record DialogListDialog(DialogBase base, List<Dialog> dialogs, @Nullable DialogActionButton exitAction, int columns, int buttonWidth) extends Record implements DialogDefinition
A dialog whose buttons lead to other dialogs.
Since:
0.1.0
Since Minecraft:
1.21.6
  • Field Details

    • DEFAULT_COLUMNS

      public static final int DEFAULT_COLUMNS
      Default number of columns.
      Since:
      0.1.0
      See Also:
  • Constructor Details

    • DialogListDialog

      public DialogListDialog(DialogBase base, List<Dialog> dialogs, @Nullable DialogActionButton exitAction, int columns, int buttonWidth)
      Creates an instance of a DialogListDialog record class.
      Parameters:
      base - the value for the base record component
      dialogs - the value for the dialogs record component
      exitAction - the value for the exitAction record component
      columns - the value for the columns record component
      buttonWidth - the value for the buttonWidth record component
  • Method Details

    • of

      @Contract("_, _ -> new") public static DialogListDialog of(DialogBase base, List<Dialog> dialogs)
      Creates a list of two columns and no footer.
      Parameters:
      base - the shared title, contents and behaviour
      dialogs - the dialogs to list
      Returns:
      the dialog
      Since:
      0.1.0
    • exitAction

      @Contract("_ -> new") public DialogListDialog exitAction(@Nullable DialogActionButton exitAction)
      Parameters:
      exitAction - the footer button, or null for no footer
      Returns:
      a copy of this dialog carrying the given footer
      Since:
      0.1.0
    • holdsReferences

      public boolean holdsReferences()
      Returns whether every entry of this list is a reference rather than a definition.
      Returns:
      whether every entry of this list is a reference rather than a definition
      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.
    • base

      public DialogBase base()
      Returns the value of the base record component.
      Specified by:
      base in interface DialogDefinition
      Returns:
      the value of the base record component
    • dialogs

      public List<Dialog> dialogs()
      Returns the value of the dialogs record component.
      Returns:
      the value of the dialogs record component
    • exitAction

      public @Nullable DialogActionButton exitAction()
      Returns the value of the exitAction record component.
      Returns:
      the value of the exitAction record component
    • columns

      public int columns()
      Returns the value of the columns record component.
      Returns:
      the value of the columns record component
    • buttonWidth

      public int buttonWidth()
      Returns the value of the buttonWidth record component.
      Returns:
      the value of the buttonWidth record component