@Tag(value="vaadin-list-box") @NpmPackage(value="@vaadin/vaadin-list-box", version="20.0.0") @JsModule(value="@vaadin/vaadin-list-box/src/vaadin-list-box.js") public abstract class ListBoxBase<C extends ListBoxBase<C,ITEM,VALUE>,ITEM,VALUE> extends AbstractSinglePropertyField<C,VALUE> implements HasItemComponents<ITEM>, HasSize, HasListDataView<ITEM,ListBoxListDataView<ITEM>>, HasDataView<ITEM,Void,ListBoxDataView<ITEM>>
ListBox
and MultiSelectListBox
.AbstractField.ComponentValueChangeEvent<C extends Component,V>
HasItemComponents.ItemComponent<T>
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
Modifier and Type | Method and Description |
---|---|
DataProvider<ITEM,?> |
getDataProvider()
Deprecated.
use
getListDataView() or
getGenericDataView() instead |
ListBoxDataView<ITEM> |
getGenericDataView()
Gets the generic data view for the ListBox.
|
SerializablePredicate<ITEM> |
getItemEnabledProvider()
Returns the item enabled predicate.
|
protected Object |
getItemId(ITEM item) |
ComponentRenderer<? extends Component,ITEM> |
getItemRenderer()
Returns the item component renderer.
|
ListBoxListDataView<ITEM> |
getListDataView()
Gets the list data view for the ListBox.
|
protected void |
onAttach(AttachEvent attachEvent)
Called when the component is attached to a UI.
|
protected void |
onDetach(DetachEvent detachEvent)
Called when the component is detached from a UI.
|
void |
onEnabledStateChanged(boolean enabled)
Handle component enable state when the enabled state changes.
|
void |
setDataProvider(DataProvider<ITEM,?> dataProvider)
Deprecated.
use instead one of the
setItems methods which provide
access to either ListBoxListDataView or
ListBoxDataView |
void |
setItemEnabledProvider(SerializablePredicate<ITEM> itemEnabledProvider)
Sets the item enabled predicate for this ListBox.
|
ListBoxDataView<ITEM> |
setItems(DataProvider<ITEM,Void> dataProvider)
Set a generic data provider for the ListBox to use and returns the base
ListBoxDataView that provides API to get information on the
items. |
ListBoxDataView<ITEM> |
setItems(InMemoryDataProvider<ITEM> inMemoryDataProvider)
Sets an in-memory data provider for the ListBox to use
|
ListBoxListDataView<ITEM> |
setItems(ListDataProvider<ITEM> listDataProvider)
Sets a ListDataProvider for the ListBox to use and returns a
ListDataView that provides information and allows operations on
the items. |
void |
setItems(Stream<ITEM> streamOfItems)
Deprecated.
Because the stream is collected to a list anyway, use
HasListDataView.setItems(Collection) instead. |
void |
setRenderer(ComponentRenderer<? extends Component,ITEM> itemRenderer)
Sets the item renderer for this ListBox.
|
void |
setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
Not supported!
|
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addComponents, getItemPosition, prependComponents
add, add, addComponentAsFirst, addComponentAtIndex, remove, removeAll
isEnabled, setEnabled
getElement
getCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
setItems, setItems
isReadOnly, isRequiredIndicatorVisible, setReadOnly
clear, getOptionalValue
addAttachListener
addDetachListener
@Deprecated public void setDataProvider(DataProvider<ITEM,?> dataProvider)
setItems
methods which provide
access to either ListBoxListDataView
or
ListBoxDataView
protected void onAttach(AttachEvent attachEvent)
Component
The default implementation does nothing.
This method is invoked before the AttachEvent
is fired for the
component.
protected void onDetach(DetachEvent detachEvent)
Component
The default implementation does nothing.
This method is invoked before the DetachEvent
is fired for the
component.
@Deprecated public DataProvider<ITEM,?> getDataProvider()
getListDataView()
or
getGenericDataView()
insteadnull
public ComponentRenderer<? extends Component,ITEM> getItemRenderer()
setRenderer(com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component, ITEM>)
public void setRenderer(ComponentRenderer<? extends Component,ITEM> itemRenderer)
itemRenderer
- the item renderer, not null
public void setItemEnabledProvider(SerializablePredicate<ITEM> 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 null
public SerializablePredicate<ITEM> getItemEnabledProvider()
setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<ITEM>)
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
Not supported by the client-side web-component, see issue in GitHub.
setRequiredIndicatorVisible
in interface HasValue<AbstractField.ComponentValueChangeEvent<C extends ListBoxBase<C,ITEM,VALUE>,VALUE>,VALUE>
setRequiredIndicatorVisible
in interface HasValueAndElement<AbstractField.ComponentValueChangeEvent<C extends ListBoxBase<C,ITEM,VALUE>,VALUE>,VALUE>
requiredIndicatorVisible
- true
to make the required indicator visible,
false
if notUnsupportedOperationException
public void onEnabledStateChanged(boolean enabled)
Component
By default this sets or removes the 'disabled' attribute from the element. This can be overridden to have custom handling.
onEnabledStateChanged
in class Component
enabled
- the new enabled state of the componentpublic ListBoxDataView<ITEM> setItems(DataProvider<ITEM,Void> dataProvider)
ListBoxDataView
that provides API to get information on the
items.
This method should be used only when the data provider type is not either
ListDataProvider
or BackEndDataProvider
.
setItems
in interface HasDataView<ITEM,Void,ListBoxDataView<ITEM>>
dataProvider
- DataProvider instance to use, not null
public ListBoxDataView<ITEM> setItems(InMemoryDataProvider<ITEM> inMemoryDataProvider)
Note! Using a ListDataProvider
instead of a
InMemoryDataProvider
is recommended to get access to
ListBoxListDataView
API by using
HasListDataView.setItems(ListDataProvider)
.
setItems
in interface HasDataView<ITEM,Void,ListBoxDataView<ITEM>>
inMemoryDataProvider
- InMemoryDataProvider to use, not null
public ListBoxListDataView<ITEM> setItems(ListDataProvider<ITEM> listDataProvider)
ListDataView
that provides information and allows operations on
the items.setItems
in interface HasListDataView<ITEM,ListBoxListDataView<ITEM>>
listDataProvider
- ListDataProvider providing items to the ListBox.@Deprecated public void setItems(Stream<ITEM> streamOfItems)
HasListDataView.setItems(Collection)
instead.public ListBoxListDataView<ITEM> getListDataView()
getListDataView
in interface HasListDataView<ITEM,ListBoxListDataView<ITEM>>
public ListBoxDataView<ITEM> getGenericDataView()
getListDataView()
is not applicable for the underlying
data provider.getGenericDataView
in interface HasDataView<ITEM,Void,ListBoxDataView<ITEM>>
ListBoxDataView
Copyright © 2021. All rights reserved.