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 onlabel- the text above the fieldplaceholder- the prompt in an empty fieldvalue- the value to start withrequired- whether the form cannot be confirmed with the field emptykind- the kind of controlchoices- the options of aModalSpec.Kind.CHOICEfield
- 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 Summary
ConstructorsConstructorDescriptionA text field.Field(String key, String label, String placeholder, String value, boolean required, ModalSpec.Kind kind) A field of a kind other than a choice.Field(String key, String label, String placeholder, String value, boolean required, ModalSpec.Kind kind, List<ModalSpec.Choice> choices) Creates an instance of aFieldrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ModalSpec.FieldA check box;labelis its text.static ModalSpec.FieldOne of several options (radio buttons); the value delivered is the key of the chosen one.choices()Returns the value of thechoicesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.key()Returns the value of thekeyrecord component.kind()Returns the value of thekindrecord component.label()Returns the value of thelabelrecord component.static ModalSpec.FieldA text area with several lines.static ModalSpec.FieldAn empty text field.static ModalSpec.FieldA field whose input is hidden; its value is delivered as typed (not trimmed), empty if nothing was typed.Returns the value of theplaceholderrecord component.booleanrequired()Returns the value of therequiredrecord component.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.static ModalSpec.FieldAn optional text field with a start value and no prompt.
-
Constructor Details
-
Field
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 aFieldrecord class.- Parameters:
key- the value for thekeyrecord componentlabel- the value for thelabelrecord componentplaceholder- the value for theplaceholderrecord componentvalue- the value for thevaluerecord componentrequired- the value for therequiredrecord componentkind- the value for thekindrecord componentchoices- the value for thechoicesrecord 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
An empty text field. -
withValue
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
A field whose input is hidden; its value is delivered as typed (not trimmed), empty if nothing was typed. -
check
A check box;labelis its text. -
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
label
Returns the value of thelabelrecord component.- Returns:
- the value of the
labelrecord component
-
placeholder
Returns the value of theplaceholderrecord component.- Returns:
- the value of the
placeholderrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
required
public boolean required()Returns the value of therequiredrecord component.- Returns:
- the value of the
requiredrecord component
-
kind
Returns the value of thekindrecord component.- Returns:
- the value of the
kindrecord component
-
choices
Returns the value of thechoicesrecord component.- Returns:
- the value of the
choicesrecord component
-