Class ComboBoxLight<T>
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<ComboBoxLight<T>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<ComboBoxLight<T>>,com.vaadin.flow.component.FocusNotifier<ComboBoxLight<T>>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ComboBoxLight<T>,,T>, T> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ComboBoxLight<T>,,T>, T> com.vaadin.flow.data.binder.HasDataProvider<T>,com.vaadin.flow.data.binder.HasItems<T>,Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.vaadin.addons.componentfactory.AbstractComboBox
AbstractComboBox.CustomValueSetEvent<R extends AbstractComboBox<R,?>>, AbstractComboBox.FilterChangeEvent<R extends AbstractComboBox<R, ?>>, AbstractComboBox.InvalidChangeEvent<R extends AbstractComboBox<R, ?>>, AbstractComboBox.OpenedChangeEvent<R extends AbstractComboBox<R, ?>>, AbstractComboBox.SelectedItemChangeEvent<R extends AbstractComboBox<R, ?>> 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.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>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 -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddCustomValueSetListener(com.vaadin.flow.component.ComponentEventListener<AbstractComboBox.CustomValueSetEvent<ComboBoxLight<T>>> listener) Adds a listener forcustom-value-setevents fired by the webcomponent.protected com.vaadin.flow.data.provider.CompositeDataGenerator<T> Accesses the data generator managed by this controllercom.vaadin.flow.data.provider.DataProvider<T, ?> com.vaadin.flow.component.ItemLabelGenerator<T> protected com.vaadin.flow.data.provider.KeyMapper<T> Returns the used key mapper.getLabel()booleanbooleanbooleanGets whether dropdown will open automatically or not.booleanbooleanbooleanisOpened()protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) voidsetAllowCustomValue(boolean allowCustomValue) Description copied from corresponding location in WebComponent:voidsetAutofocus(boolean autofocus) voidsetAutoOpen(boolean autoOpen) Enables or disables the dropdown opening automatically.voidsetClearButtonVisible(boolean clearButtonVisible) voidsetDataProvider(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) voidsetDisableBackendAutoselect(boolean disableBackendAutoslect) Sets whether to disable the backend dataprovider autoselect feature.voidsetDisableResetAfterChange(boolean disableResetAfterChange) Sets whether the reset behavior after a change should be disabled when using backend dataprovider.voidsetErrorMessage(String errorMessage) Description copied from corresponding location in WebComponent:voidsetInvalid(boolean invalid) Description copied from corresponding location in WebComponent:voidsetItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) voidDescription copied from corresponding location in WebComponent:voidsetOpened(boolean opened) Description copied from corresponding location in WebComponent:voidsetPattern(String pattern) Description copied from corresponding location in WebComponent:voidsetPlaceholder(String placeholder) Description copied from corresponding location in WebComponent:voidsetPreventInvalidInput(boolean preventInvalidInput) Description copied from corresponding location in WebComponent:voidsetRenderer(com.vaadin.flow.data.renderer.Renderer<T> renderer) Sets the Renderer responsible to render the individual items in the list of possible choices of the ComboBox.voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) Methods inherited from class org.vaadin.addons.componentfactory.AbstractComboBox
addFilterChangeListener, addInvalidChangeListener, addOpenedChangeListener, addSelectedItemChangeListener, addToPrefix, cancel, checkValidity, clearCache, close, getErrorMessageString, getFilteredItemsJsonArray, getFilterString, getItemIdPathString, getItemLabelPathString, getItemsJsonArray, getItemValuePathString, getLabelString, getNameString, getPageSizeDouble, getPatternString, getPlaceholderString, getSelectedItemJsonObject, getSizeDouble, isAllowCustomValueBoolean, isAutofocusBoolean, isDisabledBoolean, isInvalidBoolean, isLoadingBoolean, isOpenedBoolean, isPreventInvalidInputBoolean, isReadonlyBoolean, isRequiredBoolean, open, remove, removeAll, setDisabled, setFilter, setFilteredItems, setItemIdPath, setItemLabelPath, setItems, setItemValuePath, setLoading, setName, setPageSize, setReadonly, setRequired, setSelectedItem, setSize, validateMethods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods 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, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.data.binder.HasDataProvider
setItemsMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.data.binder.HasItems
setItems, setItemsMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly
-
Constructor Details
-
ComboBoxLight
public ComboBoxLight()
-
-
Method Details
-
setItemLabelGenerator
public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) -
getItemLabelGenerator
-
setAutoOpen
public void setAutoOpen(boolean autoOpen) Enables or disables the dropdown opening automatically. Iffalsethe dropdown is only opened when clicking the toggle button or pressing Up or Down arrow keys.- Parameters:
autoOpen-falseto prevent the dropdown from opening automatically
-
isAutoOpen
public boolean isAutoOpen()Gets whether dropdown will open automatically or not.- Returns:
- @{code true} if enabled,
falseotherwise
-
setAutofocus
public void setAutofocus(boolean autofocus) - Overrides:
setAutofocusin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
autofocus- the boolean value to set
-
isAutofocus
public boolean isAutofocus() -
setPreventInvalidInput
public void setPreventInvalidInput(boolean preventInvalidInput) Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
Set to true to prevent the user from entering invalid input.
- Overrides:
setPreventInvalidInputin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
preventInvalidInput- the boolean value to set
-
setLabel
Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
The label for this element.
- Overrides:
setLabelin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
label- the String value to set
-
getLabel
-
setErrorMessage
Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
The error message to display when the input is invalid.
- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Overrides:
setErrorMessagein classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
errorMessage- the String value to set
-
getErrorMessage
- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation
-
setInvalid
public void setInvalid(boolean invalid) Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
Set to true if the value is invalid.
- Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation- Overrides:
setInvalidin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
invalid- the boolean value to set
-
isInvalid
public boolean isInvalid()- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ComboBoxLight<T>,T>, T> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ComboBoxLight<T>,T>, T>
-
setClearButtonVisible
public void setClearButtonVisible(boolean clearButtonVisible) -
isClearButtonVisible
public boolean isClearButtonVisible() -
setOpened
public void setOpened(boolean opened) Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
True if the dropdown is open, false otherwise.
- Overrides:
setOpenedin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
opened- the boolean value to set
-
isOpened
public boolean isOpened() -
setPlaceholder
Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
A placeholder string in addition to the label.
- Overrides:
setPlaceholderin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
placeholder- the String value to set
-
getPlaceholder
-
setPattern
Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
A pattern to validate the
inputwith.- Overrides:
setPatternin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
pattern- the String value to set
-
getPattern
-
setDataProvider
- Specified by:
setDataProviderin interfacecom.vaadin.flow.data.binder.HasDataProvider<T>
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
getDataProvider
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
setAllowCustomValue
public void setAllowCustomValue(boolean allowCustomValue) Description copied from class:AbstractComboBoxDescription copied from corresponding location in WebComponent:
If
true, the user can input a value that is not present in the items list.valueproperty will be set to the input value in this case. Also, whenvalueis set programmatically, the input value will be set to reflect that value.- Overrides:
setAllowCustomValuein classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
allowCustomValue- the boolean value to set
-
isAllowCustomValue
public boolean isAllowCustomValue() -
addCustomValueSetListener
public com.vaadin.flow.shared.Registration addCustomValueSetListener(com.vaadin.flow.component.ComponentEventListener<AbstractComboBox.CustomValueSetEvent<ComboBoxLight<T>>> listener) Description copied from class:AbstractComboBoxAdds a listener forcustom-value-setevents fired by the webcomponent.- Overrides:
addCustomValueSetListenerin classAbstractComboBox<ComboBoxLight<T>,T> - Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
setRenderer
Sets the Renderer responsible to render the individual items in the list of possible choices of the ComboBox. It doesn't affect how the selected item is rendered - that can be configured by usingsetItemLabelGenerator(ItemLabelGenerator).- Parameters:
renderer- a renderer for the items in the selection list of the ComboBox, notnullNote that filtering of the ComboBox is not affected by the renderer that is set here. Filtering is done on the original values and can be affected by
setItemLabelGenerator(ItemLabelGenerator).
-
setDisableBackendAutoselect
public void setDisableBackendAutoselect(boolean disableBackendAutoslect) Sets whether to disable the backend dataprovider autoselect feature. When disabled, the autoselect functionality will not be triggered.- Parameters:
disableBackendAutoslect-trueto disable backend autoselect,falseto enable it.
-
setDisableResetAfterChange
public void setDisableResetAfterChange(boolean disableResetAfterChange) Sets whether the reset behavior after a change should be disabled when using backend dataprovider. When set totrue, the component will not reset its state after a value change. When set tofalse, the component will reset its state after a value change.- Parameters:
disableResetAfterChange-trueto disable reset after change,falseto enable it.
-
getDataGenerator
Accesses the data generator managed by this controller -
getKeyMapper
Returns the used key mapper. Please note, that any changes to this instance will affect the combo box.- Returns:
- key mapper
-