Annotation Interface AbstractFieldBuilder.NullifyCheckbox

Enclosing class:
AbstractFieldBuilder<S extends AbstractFieldBuilder<S,T>,T>

@Retention(RUNTIME) @Target(METHOD) @Documented public static @interface AbstractFieldBuilder.NullifyCheckbox
Causes the field that would otherwise be used for a property to be wrapped in a NullableField, which adds a Checkbox that controls whether the value is null or not.

For example:


 // This is one of our data model classes
 public class FoodItem {

     // This field is mandatory
     @FieldBuilder.TextField
     @NotNull
     public String getName() { ... }

     // This field is optional
     @FieldBuilder.NullifyCheckbox("This item expires on:")
     @FieldBuilder.DatePicker
     public LocalDate getExpirationDate() { ... }
 }
 
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The label for the auto-generated Checkbox.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether the NullableField itself should display error messages.
    boolean
    Whether the value of the inner field should be automatically reset to its empty value when the Checkbox is unchecked.
  • Element Details

    • value

      String value
      The label for the auto-generated Checkbox.
      Returns:
      checkbox label
    • resetOnDisable

      boolean resetOnDisable
      Whether the value of the inner field should be automatically reset to its empty value when the Checkbox is unchecked.
      Returns:
      whether to reset when disabled
      See Also:
      Default:
      true
    • displayErrorMessages

      boolean displayErrorMessages
      Whether the NullableField itself should display error messages.

      If the inner field is a complex field with sub-fields, such that any validation errors will have originated from a sub-field which is already displaying the error, then setting this to false can reduce clutter.

      Returns:
      whether to reset when disabled
      See Also:
      Default:
      true