Class ListBoxBase<C extends ListBoxBase<C,ITEM,VALUE>,ITEM,VALUE>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<C,VALUE>
com.vaadin.flow.component.listbox.ListBoxBase<C,ITEM,VALUE>
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasAriaLabel,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,,VALUE>, VALUE> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C,,VALUE>, VALUE> com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.data.binder.HasItemComponents<ITEM>,com.vaadin.flow.data.provider.HasDataView<ITEM,,Void, ListBoxDataView<ITEM>> com.vaadin.flow.data.provider.HasListDataView<ITEM,,ListBoxListDataView<ITEM>> Serializable
- Direct Known Subclasses:
ListBox,MultiSelectListBox
@Tag("vaadin-list-box")
@NpmPackage(value="@vaadin/list-box",
version="25.0.0-alpha20")
@JsModule("@vaadin/list-box/src/vaadin-list-box.js")
public abstract class ListBoxBase<C extends ListBoxBase<C,ITEM,VALUE>,ITEM,VALUE>
extends com.vaadin.flow.component.AbstractSinglePropertyField<C,VALUE>
implements com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.data.binder.HasItemComponents<ITEM>, com.vaadin.flow.component.HasSize, com.vaadin.flow.data.provider.HasListDataView<ITEM,ListBoxListDataView<ITEM>>, com.vaadin.flow.data.provider.HasDataView<ITEM,Void,ListBoxDataView<ITEM>>, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.shared.HasTooltip
Base class for the
ListBox and MultiSelectListBox.- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
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 extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.data.binder.HasItemComponents
com.vaadin.flow.data.binder.HasItemComponents.ItemComponent<T extends Object>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.data.provider.DataProvider<ITEM,?> Gets the data provider used by this ListBox.Gets the generic data view for the ListBox.com.vaadin.flow.function.SerializablePredicate<ITEM>Returns the item enabled predicate.protected Objectcom.vaadin.flow.component.ItemLabelGenerator<ITEM>Gets the item label generator that is used to produce the strings shown in the ListBox for each item.com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,ITEM> Returns the item component renderer.Gets the list data view for the ListBox.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) voidonEnabledStateChanged(boolean enabled) voidsetDataProvider(com.vaadin.flow.data.provider.DataProvider<ITEM, ?> dataProvider) Sets a generic data provider for the ListBox to use.voidsetItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<ITEM> itemEnabledProvider) Sets the item enabled predicate for this ListBox.voidsetItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<ITEM> itemLabelGenerator) Sets the item label generator that is used to produce the strings shown in the ListBox for each item.Set a generic data provider for the ListBox to use and returns the baseListBoxDataViewthat provides API to get information on the items.Sets an in-memory data provider for the ListBox to useSets a ListDataProvider for the ListBox to use and returns aListDataViewthat provides information and allows operations on the items.voidsetRenderer(com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component, ITEM> itemRenderer) Sets the item renderer for this ListBox.voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) Not supported!Methods 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, 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.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasAriaLabel
getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledByMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods 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.data.binder.HasItemComponents
addComponents, getItemPosition, prependComponentsMethods inherited from interface com.vaadin.flow.data.provider.HasListDataView
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.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly
-
Method Details
-
setDataProvider
Sets a generic data provider for the ListBox to use.Use this method when none of the
setItemsmethods are applicable, e.g. when having a data provider with filter that cannot be transformed toDataProvider<T, Void>.- Parameters:
dataProvider- DataProvider instance to use, notnull
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
getDataProvider
Gets the data provider used by this ListBox.To get information and control over the items in the ListBox, use either
getListDataView()orgetGenericDataView()instead.- Returns:
- the data provider used by this ListBox
-
getItemRenderer
public com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,ITEM> 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, ITEM> itemRenderer) Sets the item renderer for this ListBox. The renderer is applied to each item to create a component which represents the item.- Parameters:
itemRenderer- the item renderer, notnull
-
setItemLabelGenerator
public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<ITEM> itemLabelGenerator) Sets the item label generator that is used to produce the strings shown in the ListBox for each item. By default,String.valueOf(Object)is used.- Parameters:
itemLabelGenerator- the item label provider to use, not null
-
getItemLabelGenerator
Gets the item label generator that is used to produce the strings shown in the ListBox for each item.- Returns:
- the item label generator used, not null
-
setItemEnabledProvider
public void setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<ITEM> itemEnabledProvider) Sets the item enabled predicate for this ListBox. 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, notnull
-
getItemEnabledProvider
Returns the item enabled predicate.- Returns:
- the item enabled predicate
- See Also:
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) Not supported!Not supported by the client-side web-component, see issue in GitHub.
- Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<C extends ListBoxBase<C,ITEM, VALUE>, ITEM> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<C extends ListBoxBase<C,ITEM, VALUE>, ITEM> - Throws:
UnsupportedOperationException
-
onEnabledStateChanged
public void onEnabledStateChanged(boolean enabled) - Overrides:
onEnabledStateChangedin classcom.vaadin.flow.component.Component
-
setItems
public ListBoxDataView<ITEM> setItems(com.vaadin.flow.data.provider.DataProvider<ITEM, Void> dataProvider) Set a generic data provider for the ListBox to use and returns the baseListBoxDataViewthat provides API to get information on the items.This method should be used only when the data provider type is not either
ListDataProviderorBackEndDataProvider. -
setItems
public ListBoxDataView<ITEM> setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<ITEM> inMemoryDataProvider) Sets an in-memory data provider for the ListBox to useNote! Using a
ListDataProviderinstead of aInMemoryDataProvideris recommended to get access toListBoxListDataViewAPI by usingHasListDataView.setItems(ListDataProvider). -
setItems
public ListBoxListDataView<ITEM> setItems(com.vaadin.flow.data.provider.ListDataProvider<ITEM> listDataProvider) Sets a ListDataProvider for the ListBox to use and returns aListDataViewthat provides information and allows operations on the items. -
getListDataView
Gets the list data view for the ListBox. This data view should only be used when the items are in-memory and set with:HasListDataView.setItems(Collection)HasListDataView.setItems(Object[])setItems(ListDataProvider)
-
getGenericDataView
Gets the generic data view for the ListBox. This data view should only be used whengetListDataView()is not applicable for the underlying data provider.- Specified by:
getGenericDataViewin interfacecom.vaadin.flow.data.provider.HasDataView<C extends ListBoxBase<C,ITEM, VALUE>, ITEM, VALUE> - Returns:
- the generic DataView instance implementing
ListBoxDataView
-
getItemId
-