Interface HasClearButton

All Superinterfaces:
HasElement, Serializable
All Known Implementing Classes:
AbstractNumberField, BigDecimalField, ComboBox, ComboBoxBase, DatePicker, EmailField, IntegerField, MultiSelectComboBox, NumberField, PasswordField, TextArea, TextField, TextFieldBase, TimePicker

public interface HasClearButton extends HasElement
Mixin interface for components that support a clear button.

Used to toggle the visibility of the clear button.

Author:
Vaadin Ltd
  • Method Details

    • isClearButtonVisible

      default boolean isClearButtonVisible()
      Gets the visibility of the button which clears the field, which is false by default.
      Returns:
      true if the button is visible, false otherwise
    • setClearButtonVisible

      default void setClearButtonVisible(boolean clearButtonVisible)
      Sets the visibility of the button which clears the field.
      Parameters:
      clearButtonVisible - true to show the clear button, false to hide it
    • bindClearButtonVisible

      default SignalBinding<Boolean> bindClearButtonVisible(Signal<Boolean> signal)
      Binds a given signal to the visibility of the clear button.

      The clear button visibility is set immediately with the current signal value when the binding is created, and is kept synchronized with any subsequent signal value changes while the element is in attached state. When the element is in detached state, signal value changes have no effect.

      While a signal is bound, any attempt to set the visibility manually through setClearButtonVisible(boolean) throws a BindingActiveException.

      Attempting to bind a new signal while one is already bound throws a BindingActiveException.

      Signal's value null is treated as false.

      Parameters:
      signal - the signal to bind the clear button visibility to, not null
      Returns:
      a SignalBinding that can be used to register onChange callbacks
      Since:
      25.1
      See Also: