Interface HasValidationProperties

All Superinterfaces:
HasElement, HasValidation, Serializable
All Known Implementing Classes:
AbstractNumberField, BigDecimalField, CheckboxGroup, ComboBox, ComboBoxBase, CustomField, DatePicker, DateTimePicker, EmailField, IntegerField, MultiSelectComboBox, NumberField, PasswordField, RadioButtonGroup, Select, TextArea, TextField, TextFieldBase, TimePicker

public interface HasValidationProperties extends HasElement, HasValidation
Mixin interface for components that provide properties for setting invalid state and error message string to show when invalid.
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Gets the error message to show to the when the component is invalid.
    default boolean
    Gets whether the component is currently in invalid state.
    default void
    setErrorMessage(String errorMessage)
    Sets the error message to show to the user when the component is invalid.
    default void
    setInvalid(boolean invalid)
    Sets the invalid state of the component.

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement
  • Method Details

    • setErrorMessage

      default void setErrorMessage(String errorMessage)
      Sets the error message to show to the user when the component is invalid.
      Specified by:
      setErrorMessage in interface HasValidation
      Parameters:
      errorMessage - the error message or null to clear it
    • getErrorMessage

      default String getErrorMessage()
      Gets the error message to show to the when the component is invalid.
      Specified by:
      getErrorMessage in interface HasValidation
      Returns:
      the error message or null if not set
    • setInvalid

      default void setInvalid(boolean invalid)
      Sets the invalid state of the component.
      Specified by:
      setInvalid in interface HasValidation
      Parameters:
      invalid - true for invalid, false for valid
    • isInvalid

      default boolean isInvalid()
      Gets whether the component is currently in invalid state.
      Specified by:
      isInvalid in interface HasValidation
      Returns:
      true for invalid, false for valid