Interface EnumSwitchField<F extends EnumSwitchField<F>>

All Superinterfaces:
Comparable<F>, Component<F>, Copyable<F>, Field<F>, FormComponent<F>, Serializable
All Known Implementing Classes:
DefaultEnumSwitchField

public interface EnumSwitchField<F extends EnumSwitchField<F>> extends Field<F>
Defines a type of field use to display enumerated values in a boolean-like toggle switch component. However, unlike boolean, there can be as many switch values as enumerated values. Generally, SelectField is preferred as it presents a dropdown, but there may be special cases where a switch that shows all available values at once in a row is desired.

This component also automatically adds an empty value or "None" to display if the field is not required to allow nulling it out.

Since:
2.x.x
Author:
Nathan Moore (nathandmoore)
  • Method Details

    • displaySingle

      default F displaySingle(boolean value)
      Parameters:
      value - the value to set
      Returns:
      this
    • displaySingle

      default F displaySingle()
      Sets the EnumSwitchField.Attributes.DISPLAY_SINGLE attribute to true.
      Returns:
      this
    • notDisplaySingle

      default F notDisplaySingle()
      Sets the EnumSwitchField.Attributes.DISPLAY_SINGLE attribute to false.
      Returns:
      this
    • option

      default F option(String value, String label)
      Provides an option which can be selected by a select field.
      Parameters:
      value - the value of the option
      label - the label of the option
      Returns:
      this
    • option

      default F option(SelectOption... options)
      Provides options which can be selected by a select field.
      Parameters:
      options - SelectOptions to be set as options
      Returns:
      this
    • options

      default <O extends SelectOption> F options(Collection<O> optionsToAdd)
      Provides options which can be selected by a select field using a collection of SelectOptions.
      Parameters:
      optionsToAdd - A collection of SelectOptions
      Returns:
      this
    • clearOptions

      default F clearOptions()
      Removes all the options from the select field.
      Returns:
      this