Record Class ModalSpec.Field

java.lang.Object
java.lang.Record
io.github.jbastgen.stemma.app.ui.dialog.ModalSpec.Field
Record Components:
key - the name under which the value is handed on
label - the text above the field
placeholder - the prompt in an empty field
value - the value to start with
required - whether the form cannot be confirmed with the field empty
kind - the kind of control
choices - the options of a ModalSpec.Kind.CHOICE field
Enclosing class:
ModalSpec

public static record ModalSpec.Field(String key, String label, String placeholder, String value, boolean required, ModalSpec.Kind kind, List<ModalSpec.Choice> choices) extends Record
One field of the form.
  • Constructor Details

    • Field

      public Field(String key, String label, String placeholder, String value, boolean required)
      A text field.
    • Field

      public Field(String key, String label, String placeholder, String value, boolean required, ModalSpec.Kind kind)
      A field of a kind other than a choice.
    • Field

      public Field(String key, String label, String placeholder, String value, boolean required, ModalSpec.Kind kind, List<ModalSpec.Choice> choices)
      Creates an instance of a Field record class.
      Parameters:
      key - the value for the key record component
      label - the value for the label record component
      placeholder - the value for the placeholder record component
      value - the value for the value record component
      required - the value for the required record component
      kind - the value for the kind record component
      choices - the value for the choices record component
  • Method Details

    • choice

      public static ModalSpec.Field choice(String key, String label, String selectedKey, List<ModalSpec.Choice> choices)
      One of several options (radio buttons); the value delivered is the key of the chosen one.
    • of

      public static ModalSpec.Field of(String key, String label, String placeholder, boolean required)
      An empty text field.
    • withValue

      public static ModalSpec.Field withValue(String key, String label, String value)
      An optional text field with a start value and no prompt.
    • multiline

      public static ModalSpec.Field multiline(String key, String label, String placeholder, String value, boolean required)
      A text area with several lines.
    • password

      public static ModalSpec.Field password(String key, String label, boolean required)
      A field whose input is hidden; its value is delivered as typed (not trimmed), empty if nothing was typed.
    • check

      public static ModalSpec.Field check(String key, String label, boolean checked)
      A check box; label is its text.
    • 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 '=='.
      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.
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • label

      public String label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • placeholder

      public String placeholder()
      Returns the value of the placeholder record component.
      Returns:
      the value of the placeholder record component
    • value

      public String value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • required

      public boolean required()
      Returns the value of the required record component.
      Returns:
      the value of the required record component
    • kind

      public ModalSpec.Kind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • choices

      public List<ModalSpec.Choice> choices()
      Returns the value of the choices record component.
      Returns:
      the value of the choices record component