Class RadioButtonGroup<T>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<RadioButtonGroup<T>,T>
com.vaadin.flow.component.AbstractSinglePropertyField<RadioButtonGroup<T>,T>
com.vaadin.flow.component.radiobutton.RadioButtonGroup<T>
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.HasValidation, com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>, com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>, com.vaadin.flow.component.shared.HasThemeVariant<RadioGroupVariant>, com.vaadin.flow.component.shared.HasTooltip, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>, com.vaadin.flow.data.binder.HasValidator<T>, com.vaadin.flow.data.provider.HasDataView<T,Void,RadioButtonGroupDataView<T>>, com.vaadin.flow.data.provider.HasListDataView<T,RadioButtonGroupListDataView<T>>, com.vaadin.flow.data.selection.SingleSelect<RadioButtonGroup<T>,T>, Serializable

@Tag("vaadin-radio-group") @NpmPackage(value="@vaadin/radio-group", version="25.0.0-beta1") @JsModule("@vaadin/radio-group/src/vaadin-radio-group.js") public class RadioButtonGroup<T> extends com.vaadin.flow.component.AbstractSinglePropertyField<RadioButtonGroup<T>,T> implements com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.data.provider.HasDataView<T,Void,RadioButtonGroupDataView<T>>, com.vaadin.flow.data.provider.HasListDataView<T,RadioButtonGroupListDataView<T>>, com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>, com.vaadin.flow.component.shared.HasThemeVariant<RadioGroupVariant>, com.vaadin.flow.component.shared.HasValidationProperties, com.vaadin.flow.data.binder.HasValidator<T>, com.vaadin.flow.data.selection.SingleSelect<RadioButtonGroup<T>,T>
Radio Button Group allows the user to select exactly one value from a list of related but mutually exclusive options.

Validation

Radio Button Group comes with a built-in validation mechanism that verifies that a radio button is selected when required is enabled. Validation is triggered whenever the user selects a radio button or the value is updated programmatically. In practice, however, the required error can only occur if the value is cleared programmatically. This is because radio buttons, by design, don't allow users to clear a selection through UI interaction. If the required error occurs, the component is marked as invalid and an error message is displayed below the group.

The required error message can be configured using either RadioButtonGroup.RadioButtonGroupI18n.setRequiredErrorMessage(String) or HasValidationProperties.setErrorMessage(String).

For more advanced validation that requires custom rules, you can use Binder. Please note that Binder provides its own API for the required validation, see asRequired().

However, if Binder doesn't fit your needs and you want to implement fully custom validation logic, you can disable the built-in validation by setting setManualValidation(boolean) to true. This will allow you to control the invalid state and the error message manually using HasValidationProperties.setInvalid(boolean) and HasValidationProperties.setErrorMessage(String) API.

Author:
Vaadin Ltd.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The internationalization properties for RadioButtonGroup.

    Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField

    com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue

    com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    RadioButtonGroup(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>> listener)
    Constructs a radio button group with a value change listener.
    Creates an empty radio button group with the defined label.
    RadioButtonGroup(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>> listener)
    Constructs a radio button group with the defined label and a value change listener.
    RadioButtonGroup(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>> listener, T... items)
    Constructs a radio button group with the defined label, a value change listener and populated with the items in the array.
    Creates a radio button group with the defined label and populated with the items in the collection.
    RadioButtonGroup(String label, T... items)
    Creates a radio button group with the defined label and populated with the items in the array.
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    com.vaadin.flow.data.provider.DataProvider<T,?>
    Gets the data provider used by this RadioButtonGroup.
    com.vaadin.flow.data.binder.Validator<T>
     
    Gets the generic data view for the RadioButtonGroup.
    Gets the internationalization object previously set for this component.
    com.vaadin.flow.function.SerializablePredicate<T>
    Returns the item enabled predicate.
    com.vaadin.flow.component.ItemLabelGenerator<T>
    Gets the item label generator that is used to produce the strings shown in the radio button group for each item.
    com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T>
    Returns the item component renderer.
    String used for the label element.
    Gets the list data view for the RadioButtonGroup.
    com.vaadin.flow.component.shared.SelectionPreservationMode
    Gets the selection preservation mode.
    protected boolean
     
    boolean
     
    boolean
    boolean
    Gets whether the user is required to select a radio button.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    protected void
    onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
     
    void
    onEnabledStateChanged(boolean enabled)
     
    void
    setAriaLabel(String ariaLabel)
     
    void
     
    void
    setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
    Sets a generic data provider for the RadioButtonGroup to use.
    void
    Sets the internationalization object for this component.
    void
    setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider)
    Sets the item enabled predicate for this radio button group.
    void
    setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)
    Sets the item label generator that is used to produce the strings shown in the radio button group for each item.
    setItems(com.vaadin.flow.data.provider.DataProvider<T,Void> dataProvider)
     
    setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider)
     
    setItems(com.vaadin.flow.data.provider.ListDataProvider<T> dataProvider)
     
    void
    Sets the label for the field.
    void
    setManualValidation(boolean enabled)
     
    void
    setReadOnly(boolean readOnly)
     
    void
    setRenderer(com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T> renderer)
    Sets the item renderer for this radio button group.
    void
    setRequired(boolean required)
    void
    setRequiredIndicatorVisible(boolean required)
    Sets whether the user is required to select a radio button.
    void
    setSelectionPreservationMode(com.vaadin.flow.component.shared.SelectionPreservationMode selectionPreservationMode)
    Sets the selection preservation mode.
    void
    setValue(T value)
     
    protected void
    Validates the current value against the constraints and sets the invalid property and the errorMessage property based on the result.
    protected boolean
    valueEquals(T value1, T value2)
    Compares two value instances to each other to determine whether they are equal.

    Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField

    getSynchronizationRegistration, setPresentationValue, setSynchronizedEvent

    Methods inherited from class com.vaadin.flow.component.AbstractField

    addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

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

    addAttachListener

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

    addDetachListener

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

    getElement

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

    isEnabled, setEnabled

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

    getHelperComponent, getHelperText, setHelperComponent, setHelperText

    Methods inherited from interface com.vaadin.flow.data.provider.HasListDataView

    setItems, setItems

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

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

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

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

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

    addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

    Methods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant

    addThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants

    Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip

    getTooltip, setTooltipMarkdown, setTooltipText

    Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties

    getErrorMessage, isInvalid, setErrorMessage, setInvalid

    Methods inherited from interface com.vaadin.flow.data.binder.HasValidator

    addValidationStatusChangeListener

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

    addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty
  • Constructor Details

    • RadioButtonGroup

      public RadioButtonGroup()
      Default constructor. Creates an empty radio button group.
    • RadioButtonGroup

      public RadioButtonGroup(String label)
      Creates an empty radio button group with the defined label.
      Parameters:
      label - the label describing the radio button group
      See Also:
    • RadioButtonGroup

      public RadioButtonGroup(String label, Collection<T> items)
      Creates a radio button group with the defined label and populated with the items in the collection.
      Parameters:
      label - the label describing the radio button group
      items - the items to be shown in the list of the radio button group
      See Also:
    • RadioButtonGroup

      @SafeVarargs public RadioButtonGroup(String label, T... items)
      Creates a radio button group with the defined label and populated with the items in the array.
      Parameters:
      label - the label describing the radio button group
      items - the items to be shown in the list of the radio button group
      See Also:
    • RadioButtonGroup

      public RadioButtonGroup(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>> listener)
      Constructs a radio button group with a value change listener.
      Parameters:
      listener - the value change listener to add
      See Also:
      • AbstractField.addValueChangeListener(ValueChangeListener)
    • RadioButtonGroup

      public RadioButtonGroup(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>> listener)
      Constructs a radio button group with the defined label and a value change listener.
      Parameters:
      label - the label describing the radio button group
      listener - the value change listener to add
      See Also:
    • RadioButtonGroup

      @SafeVarargs public RadioButtonGroup(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>> listener, T... items)
      Constructs a radio button group with the defined label, a value change listener and populated with the items in the array.
      Parameters:
      label - the label describing the radio button group
      listener - the value change listener to add
      items - the items to be shown in the list of the radio button group
      See Also:
      • setLabel(String)
      • AbstractField.addValueChangeListener(ValueChangeListener)
      • HasListDataView.setItems(Object...)
  • Method Details

    • setItems

      public RadioButtonGroupDataView<T> setItems(com.vaadin.flow.data.provider.DataProvider<T,Void> dataProvider)
      Specified by:
      setItems in interface com.vaadin.flow.data.provider.HasDataView<T,Void,RadioButtonGroupDataView<T>>
    • setItems

      public RadioButtonGroupDataView<T> setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider)
      Specified by:
      setItems in interface com.vaadin.flow.data.provider.HasDataView<T,Void,RadioButtonGroupDataView<T>>
    • setItems

      public RadioButtonGroupListDataView<T> setItems(com.vaadin.flow.data.provider.ListDataProvider<T> dataProvider)
      Specified by:
      setItems in interface com.vaadin.flow.data.provider.HasListDataView<T,RadioButtonGroupListDataView<T>>
    • getListDataView

      public RadioButtonGroupListDataView<T> getListDataView()
      Gets the list data view for the RadioButtonGroup. This data view should only be used when the items are in-memory and set with: If the items are not in-memory an exception is thrown.
      Specified by:
      getListDataView in interface com.vaadin.flow.data.provider.HasListDataView<T,RadioButtonGroupListDataView<T>>
      Returns:
      the list data view that provides access to the data bound to the RadioButtonGroup
    • getGenericDataView

      public RadioButtonGroupDataView<T> getGenericDataView()
      Gets the generic data view for the RadioButtonGroup. This data view should only be used when getListDataView() is not applicable for the underlying data provider.
      Specified by:
      getGenericDataView in interface com.vaadin.flow.data.provider.HasDataView<T,Void,RadioButtonGroupDataView<T>>
      Returns:
      the generic DataView instance implementing RadioButtonGroupDataView
    • hasValidValue

      protected boolean hasValidValue()
      Overrides:
      hasValidValue in class com.vaadin.flow.component.AbstractSinglePropertyField<RadioButtonGroup<T>,T>
    • setDataProvider

      public void setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
      Sets a generic data provider for the RadioButtonGroup to use.

      Use this method when none of the setItems methods are applicable, e.g. when having a data provider with filter that cannot be transformed to DataProvider<T, Void>.

      Parameters:
      dataProvider - DataProvider instance to use, not null
    • setItemLabelGenerator

      public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)
      Sets the item label generator that is used to produce the strings shown in the radio button group for each item. By default, String.valueOf(Object) is used.

      Setting an item label generator removes any previously set item renderer.

      Parameters:
      itemLabelGenerator - the item label provider to use, not null
    • getItemLabelGenerator

      public com.vaadin.flow.component.ItemLabelGenerator<T> getItemLabelGenerator()
      Gets the item label generator that is used to produce the strings shown in the radio button group for each item.
      Returns:
      the item label generator used, not null
    • setValue

      public void setValue(T value)
      Specified by:
      setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
      Overrides:
      setValue in class com.vaadin.flow.component.AbstractField<RadioButtonGroup<T>,T>
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • getDataProvider

      public com.vaadin.flow.data.provider.DataProvider<T,?> getDataProvider()
      Gets the data provider used by this RadioButtonGroup.

      To get information and control over the items in the RadioButtonGroup, use either getListDataView() or getGenericDataView() instead.

      Returns:
      the data provider used by this RadioButtonGroup
    • getItemEnabledProvider

      public com.vaadin.flow.function.SerializablePredicate<T> getItemEnabledProvider()
      Returns the item enabled predicate.
      Returns:
      the item enabled predicate
      See Also:
    • setItemEnabledProvider

      public void setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider)
      Sets the item enabled predicate for this radio button group. The predicate is applied to each item to determine whether the item should be enabled (true) or disabled (false). Disabled items are displayed as grayed out and the user cannot select them. The default predicate always returns true (all the items are enabled).
      Parameters:
      itemEnabledProvider - the item enable predicate, not null
    • getItemRenderer

      public com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T> getItemRenderer()
      Returns the item component renderer.
      Returns:
      the item renderer
      See Also:
    • setRenderer

      public void setRenderer(com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T> renderer)
      Sets the item renderer for this radio button group. The renderer is applied to each item to create a component which represents the item.

      Note: Component acts as a label to the button and clicks on it trigger the radio button. Hence interactive components like DatePicker or ComboBox cannot be used.

      Parameters:
      renderer - the item renderer, not null
    • onEnabledStateChanged

      public void onEnabledStateChanged(boolean enabled)
      Overrides:
      onEnabledStateChanged in class com.vaadin.flow.component.Component
    • setReadOnly

      public void setReadOnly(boolean readOnly)
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
      Specified by:
      setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
    • isReadOnly

      public boolean isReadOnly()
      Specified by:
      isReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
      Specified by:
      isReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
    • setRequiredIndicatorVisible

      public void setRequiredIndicatorVisible(boolean required)
      Sets whether the user is required to select a radio button. When required, an indicator appears next to the label and the field invalidates if the selection is cleared programmatically.

      NOTE: The required indicator is only visible when the field has a label, see setLabel(String).

      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
      Specified by:
      setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
      Parameters:
      required - true to make the field required, false otherwise
      See Also:
    • isRequiredIndicatorVisible

      public boolean isRequiredIndicatorVisible()
      Gets whether the user is required to select a radio button.
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
      Specified by:
      isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
      Returns:
      true if the field is required, false otherwise
      See Also:
    • isRequired

      public boolean isRequired()
      Returns:
      true if the field is required, false otherwise
    • setRequired

      public void setRequired(boolean required)
      Parameters:
      required - true to make the field required, false otherwise
    • setLabel

      public void setLabel(String label)
      Sets the label for the field.
      Specified by:
      setLabel in interface com.vaadin.flow.component.HasLabel
      Parameters:
      label - value for the label property in the webcomponent
    • getLabel

      public String getLabel()
      String used for the label element.
      Specified by:
      getLabel in interface com.vaadin.flow.component.HasLabel
      Returns:
      the label property from the webcomponent
    • setSelectionPreservationMode

      public void setSelectionPreservationMode(com.vaadin.flow.component.shared.SelectionPreservationMode selectionPreservationMode)
      Sets the selection preservation mode. Determines what happens with the selection when DataProvider.refreshAll() is called. The selection is discarded in any case when a new data provider is set. The default is SelectionPreservationMode.DISCARD.
      Parameters:
      selectionPreservationMode - the selection preservation mode to switch to, not null
      See Also:
      • SelectionPreservationMode
    • getSelectionPreservationMode

      public com.vaadin.flow.component.shared.SelectionPreservationMode getSelectionPreservationMode()
      Gets the selection preservation mode.
      Returns:
      the selection preservation mode
      See Also:
    • setAriaLabel

      public void setAriaLabel(String ariaLabel)
      Specified by:
      setAriaLabel in interface com.vaadin.flow.component.HasAriaLabel
    • getAriaLabel

      public Optional<String> getAriaLabel()
      Specified by:
      getAriaLabel in interface com.vaadin.flow.component.HasAriaLabel
    • setAriaLabelledBy

      public void setAriaLabelledBy(String labelledBy)
      Specified by:
      setAriaLabelledBy in interface com.vaadin.flow.component.HasAriaLabel
    • getAriaLabelledBy

      public Optional<String> getAriaLabelledBy()
      Specified by:
      getAriaLabelledBy in interface com.vaadin.flow.component.HasAriaLabel
    • valueEquals

      protected boolean valueEquals(T value1, T value2)
      Compares two value instances to each other to determine whether they are equal. Equality is used to determine whether to update internal state and fire an event when setValue(Object) or AbstractField.setModelValue(Object, boolean) is called. Subclasses can override this method to define an alternative comparison method instead of Object.equals(Object).
      Overrides:
      valueEquals in class com.vaadin.flow.component.AbstractField<RadioButtonGroup<T>,T>
      Parameters:
      value1 - the first instance
      value2 - the second instance
      Returns:
      true if the instances are equal; otherwise false
    • setManualValidation

      public void setManualValidation(boolean enabled)
      Specified by:
      setManualValidation in interface com.vaadin.flow.component.HasValidation
    • getDefaultValidator

      public com.vaadin.flow.data.binder.Validator<T> getDefaultValidator()
      Specified by:
      getDefaultValidator in interface com.vaadin.flow.data.binder.HasValidator<T>
    • validate

      protected void validate()
      Validates the current value against the constraints and sets the invalid property and the errorMessage property based on the result. If a custom error message is provided with HasValidationProperties.setErrorMessage(String), it is used. Otherwise, the error message defined in the i18n object is used.

      The method does nothing if the manual validation mode is enabled.

    • getI18n

      Gets the internationalization object previously set for this component.

      NOTE: Updating the instance that is returned from this method will not update the component if not set again using setI18n(RadioButtonGroupI18n)

      Returns:
      the i18n object or null if no i18n object has been set
    • setI18n

      public void setI18n(RadioButtonGroup.RadioButtonGroupI18n i18n)
      Sets the internationalization object for this component.
      Parameters:
      i18n - the i18n object, not null