public class CheckboxGroup<T> extends GeneratedVaadinCheckboxGroup<CheckboxGroup<T>,Set<T>> implements com.vaadin.flow.data.binder.HasItemsAndComponents<T>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.data.selection.MultiSelect<CheckboxGroup<T>,T>, com.vaadin.flow.data.binder.HasDataProvider<T>, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.data.binder.HasValidator<Set<T>>, HasClientValidation
vaadin-checkbox-group element.
CheckBoxGroup is a multiselection component where items are displayed as check boxes.
GeneratedVaadinCheckboxGroup.InvalidChangeEvent<R extends GeneratedVaadinCheckboxGroup<R,?>>com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V>com.vaadin.flow.data.binder.HasItemsAndComponents.ItemComponent<T>com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>HasClientValidation.ClientValidatedEvent| Constructor and Description |
|---|
CheckboxGroup() |
| Modifier and Type | Method and Description |
|---|---|
com.vaadin.flow.shared.Registration |
addSelectionListener(com.vaadin.flow.data.selection.MultiSelectionListener<CheckboxGroup<T>,T> listener) |
com.vaadin.flow.shared.Registration |
addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<Set<T>> listener) |
com.vaadin.flow.data.provider.DataProvider<T,?> |
getDataProvider()
Gets the data provider.
|
String |
getErrorMessage()
Gets the current error message from the checkbox group.
|
com.vaadin.flow.function.SerializablePredicate<T> |
getItemEnabledProvider()
Returns the item enabled predicate.
|
com.vaadin.flow.component.ItemLabelGenerator<T> |
getItemLabelGenerator()
Gets the item label generator that is used to produce the strings shown
in the checkbox group for each item.
|
String |
getLabel()
Gets the label of the checkbox group.
|
Set<T> |
getSelectedItems() |
protected boolean |
hasValidValue() |
protected boolean |
isEnforcedFieldValidationEnabled() |
boolean |
isInvalid() |
boolean |
isReadOnly() |
boolean |
isRequired()
Determines whether the checkbox group is marked as input required.
|
protected void |
onAttach(com.vaadin.flow.component.AttachEvent attachEvent) |
void |
onEnabledStateChanged(boolean enabled) |
void |
setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider) |
void |
setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
|
void |
setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
|
void |
setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider)
Sets the item enabled predicate for this checkbox 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 checkbox group for each item.
|
void |
setLabel(String label)
Sets the label for the checkbox group.
|
void |
setReadOnly(boolean readOnly) |
void |
setRequired(boolean required)
Description copied from corresponding location in WebComponent:
|
void |
setValue(Set<T> value)
Sets the value of this component.
|
void |
updateSelection(Set<T> addedItems,
Set<T> removedItems) |
protected void |
validate()
Description copied from corresponding location in WebComponent:
|
protected boolean |
valueEquals(Set<T> value1,
Set<T> value2) |
addInvalidChangeListener, addThemeVariants, getErrorMessageString, getLabelString, isDisabledBoolean, isInvalidBoolean, isRequiredBoolean, removeThemeVariants, setDisabledgetSynchronizationRegistration, setPresentationValue, setSynchronizedEventaddValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValueaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddComponents, getItemPosition, prependComponentsadd, add, addComponentAsFirst, addComponentAtIndex, remove, removeAllgetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFulldeselect, deselect, deselectAll, getEmptyValue, getValue, isSelected, select, selectisRequiredIndicatorVisible, setRequiredIndicatorVisibleaddValueChangeListener, clear, getOptionalValue, isEmptygetHelperComponent, getHelperText, setHelperComponent, setHelperTextaddClientValidatedEventListeneraddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameprotected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
onAttach in class com.vaadin.flow.component.Componentpublic void setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
setDataProvider in interface com.vaadin.flow.data.binder.HasDataProvider<T>public void updateSelection(Set<T> addedItems, Set<T> removedItems)
updateSelection in interface com.vaadin.flow.data.selection.MultiSelect<CheckboxGroup<T>,T>public void setValue(Set<T> value)
The component doesn't accept null values. The value of a checkbox
group without any selected items is an empty set. You can use the
HasValue.clear() method to set the empty value.
setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CheckboxGroup<T>,Set<T>>,Set<T>>setValue in interface com.vaadin.flow.data.selection.MultiSelect<CheckboxGroup<T>,T>setValue in class com.vaadin.flow.component.AbstractField<CheckboxGroup<T>,Set<T>>value - the new value to set, not nullNullPointerException - if value is nullpublic Set<T> getSelectedItems()
getSelectedItems in interface com.vaadin.flow.data.selection.MultiSelect<CheckboxGroup<T>,T>public com.vaadin.flow.shared.Registration addSelectionListener(com.vaadin.flow.data.selection.MultiSelectionListener<CheckboxGroup<T>,T> listener)
addSelectionListener in interface com.vaadin.flow.data.selection.MultiSelect<CheckboxGroup<T>,T>public com.vaadin.flow.data.provider.DataProvider<T,?> getDataProvider()
nullpublic void onEnabledStateChanged(boolean enabled)
onEnabledStateChanged in class com.vaadin.flow.component.Componentpublic void setReadOnly(boolean readOnly)
setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CheckboxGroup<T>,Set<T>>,Set<T>>setReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CheckboxGroup<T>,Set<T>>,Set<T>>public boolean isReadOnly()
isReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CheckboxGroup<T>,Set<T>>,Set<T>>isReadOnly in interface com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<CheckboxGroup<T>,Set<T>>,Set<T>>public com.vaadin.flow.function.SerializablePredicate<T> getItemEnabledProvider()
setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T>)public void setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider)
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).itemEnabledProvider - the item enable predicate, not nullpublic void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)
String.valueOf(Object) is used.itemLabelGenerator - the item label provider to use, not nullpublic com.vaadin.flow.component.ItemLabelGenerator<T> getItemLabelGenerator()
public void setLabel(String label)
setLabel in interface com.vaadin.flow.component.HasLabelsetLabel in class GeneratedVaadinCheckboxGroup<CheckboxGroup<T>,Set<T>>label - value for the label property in the checkbox grouppublic String getLabel()
getLabel in interface com.vaadin.flow.component.HasLabellabel property of the checkbox grouppublic void setErrorMessage(String errorMessage)
GeneratedVaadinCheckboxGroupDescription copied from corresponding location in WebComponent:
Error to show when the input value is invalid.
setErrorMessage in interface com.vaadin.flow.component.HasValidationsetErrorMessage in class GeneratedVaadinCheckboxGroup<CheckboxGroup<T>,Set<T>>errorMessage - the String value to setpublic String getErrorMessage()
getErrorMessage in interface com.vaadin.flow.component.HasValidationpublic void setRequired(boolean required)
GeneratedVaadinCheckboxGroupDescription copied from corresponding location in WebComponent:
Specifies that the user must fill in a value.
setRequired in class GeneratedVaadinCheckboxGroup<CheckboxGroup<T>,Set<T>>required - the boolean value to setpublic boolean isRequired()
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
true if the input is required, false otherwisepublic boolean isInvalid()
isInvalid in interface com.vaadin.flow.component.HasValidationpublic void setInvalid(boolean invalid)
GeneratedVaadinCheckboxGroupDescription copied from corresponding location in WebComponent:
This property is set to true when the control value is invalid.
setInvalid in interface com.vaadin.flow.component.HasValidationsetInvalid in class GeneratedVaadinCheckboxGroup<CheckboxGroup<T>,Set<T>>invalid - the boolean value to setprotected boolean valueEquals(Set<T> value1, Set<T> value2)
valueEquals in class com.vaadin.flow.component.AbstractField<CheckboxGroup<T>,Set<T>>protected boolean hasValidValue()
hasValidValue in class com.vaadin.flow.component.AbstractSinglePropertyField<CheckboxGroup<T>,Set<T>>protected void validate()
GeneratedVaadinCheckboxGroupDescription copied from corresponding location in WebComponent:
Returns true if value is valid. <iron-form> uses this to
check the validity or all its elements.
This function is not supported by Flow because it returns a
boolean. Functions with return types different than void are
not supported at this moment.
validate in class GeneratedVaadinCheckboxGroup<CheckboxGroup<T>,Set<T>>public com.vaadin.flow.shared.Registration addValidationStatusChangeListener(com.vaadin.flow.data.binder.ValidationStatusChangeListener<Set<T>> listener)
protected boolean isEnforcedFieldValidationEnabled()
Copyright © 2026. All rights reserved.