Class Select<T>
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.AbstractField<C,T>
-
- com.vaadin.flow.component.AbstractSinglePropertyField<R,T>
-
- com.vaadin.flow.component.select.generated.GeneratedVaadinSelect<Select<T>,T>
-
- com.vaadin.flow.component.select.Select<T>
-
- Type Parameters:
T- the type of the items for the select
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<Select<T>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<Select<T>>,com.vaadin.flow.component.FocusNotifier<Select<T>>,com.vaadin.flow.component.HasComponents,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<Select<T>,T>,T>,com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>,T>,HasTooltip,com.vaadin.flow.data.binder.HasItemComponents<T>,com.vaadin.flow.data.provider.HasDataView<T,Void,SelectDataView<T>>,com.vaadin.flow.data.provider.HasListDataView<T,SelectListDataView<T>>,com.vaadin.flow.data.selection.SingleSelect<Select<T>,T>,Serializable
@JsModule("./selectConnector.js") public class Select<T> extends GeneratedVaadinSelect<Select<T>,T> implements com.vaadin.flow.data.binder.HasItemComponents<T>, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasValidation, com.vaadin.flow.data.selection.SingleSelect<Select<T>,T>, com.vaadin.flow.data.provider.HasListDataView<T,SelectListDataView<T>>, com.vaadin.flow.data.provider.HasDataView<T,Void,SelectDataView<T>>, com.vaadin.flow.component.HasHelper, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasTheme, HasTooltipSelect allows users to choose a single value from a list of options presented in an overlay. The dropdown can be opened with a click, up/down arrow keys, or by typing the initial character for one of the options.- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.select.generated.GeneratedVaadinSelect
GeneratedVaadinSelect.InvalidChangeEvent<R extends GeneratedVaadinSelect<R,?>>, GeneratedVaadinSelect.OpenedChangeEvent<R extends GeneratedVaadinSelect<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 extends Object>
-
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.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<?>>
-
-
Field Summary
Fields Modifier and Type Field Description static StringLABEL_ATTRIBUTE
-
Constructor Summary
Constructors Constructor Description Select()Constructs a select.Select(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>> listener)Constructs a select with the initial value change listener.Select(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>> listener)Constructs a select with the initial label text and value change listener.Select(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>> listener, T... items)Constructs a select with the initial label text and value change listener.Select(T... items)Deprecated.as of 23.1.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(com.vaadin.flow.component.Component... components)voidaddComponentAsFirst(com.vaadin.flow.component.Component component)voidaddComponentAtIndex(int index, com.vaadin.flow.component.Component component)voidaddComponents(T afterItem, com.vaadin.flow.component.Component... components)voidaddThemeVariants(SelectVariant... variants)Adds theme variants to the component.voidaddToPrefix(com.vaadin.flow.component.Component... components)Adds the given components as children of this component at the slot 'prefix'.Stream<com.vaadin.flow.component.Component>getChildren()com.vaadin.flow.data.provider.DataProvider<T,?>getDataProvider()Gets the data provider.StringgetEmptySelectionCaption()StringgetErrorMessage()Gets the error message to show to the user on invalid selectionSelectDataView<T>getGenericDataView()Gets the generic data view for theSelect.com.vaadin.flow.function.SerializablePredicate<T>getItemEnabledProvider()Returns the item enabled predicate.com.vaadin.flow.component.ItemLabelGenerator<T>getItemLabelGenerator()Gets the item label generator.ComponentRenderer<? extends com.vaadin.flow.component.Component,T>getItemRenderer()Returns the item component renderer.StringgetLabel()Gets the string for the label element.SelectListDataView<T>getListDataView()Gets the list data view for theSelect.StringgetPlaceholder()Gets the placeholder hint set for the user.protected booleanhasValidValue()booleanisAutofocus()Gets whether this select has been set to autofocus when the page loads.booleanisEmptySelectionAllowed()Returns whether the user is allowed to select nothing.booleanisInvalid()Gets whether the select is currently in invalid state.booleanisRequiredIndicatorVisible()NOTE: The required indicator will not be visible, if thesetLabel(String)property is not set for the select.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent)voidonEnabledStateChanged(boolean enabled)voidprependComponents(T beforeItem, com.vaadin.flow.component.Component... components)voidremove(com.vaadin.flow.component.Component... components)Removes the given child components from this component.voidremoveAll()Removes all child components that are not items.voidremoveThemeVariants(SelectVariant... variants)Removes theme variants from the component.voidsetAutofocus(boolean autofocus)Sets the select to have focus when the page loads.voidsetDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)Deprecated.use instead one of thesetItemsmethods which provide access to eitherSelectListDataVieworSelectDataViewvoidsetEmptySelectionAllowed(boolean emptySelectionAllowed)Sets whether the user is allowed to select nothing.voidsetEmptySelectionCaption(String emptySelectionCaption)Sets the empty selection caption whensetEmptySelectionAllowed(boolean)has been enabled.voidsetErrorMessage(String errorMessage)Sets the error message to show to the user on invalid selection.voidsetInvalid(boolean invalid)Sets the select to show as invalid state and display error message.voidsetItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider)Sets the item enabled predicate for this select.voidsetItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)Sets the item label generator.SelectDataView<T>setItems(com.vaadin.flow.data.provider.DataProvider<T,Void> dataProvider)SelectDataView<T>setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider)SelectListDataView<T>setItems(com.vaadin.flow.data.provider.ListDataProvider<T> dataProvider)voidsetItems(Stream<T> streamOfItems)Deprecated.Because the stream is collected to a list anyway, useHasListDataView.setItems(Collection)instead.voidsetLabel(String label)Sets the string for the label element.voidsetPlaceholder(String placeholder)Sets the placeholder hint for the user.voidsetRenderer(ComponentRenderer<? extends com.vaadin.flow.component.Component,T> renderer)Sets the item renderer for this select group.voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible)NOTE: The required indicator will not be visible, if thesetLabel(String)property is not set for the select.voidsetTextRenderer(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)Convenience setter for creating aTextRendererfrom the given function that converts the item to a string.protected booleanvalueEquals(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.select.generated.GeneratedVaadinSelect
addInvalidChangeListener, addOpenedChangeListener, getErrorMessageString, getLabelString, getNameString, getPlaceholderString, isAutofocusBoolean, isDisabledBoolean, isInvalidBoolean, isOpenedBoolean, isReadonlyBoolean, isRequiredBoolean, setDisabled, setName, setOpened, setReadonly, setRequired, validate
-
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, setValue
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, 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.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
-
Methods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperText
-
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.HasTooltip
getTooltip, setTooltipText
-
-
-
-
Field Detail
-
LABEL_ATTRIBUTE
public static final String LABEL_ATTRIBUTE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Select
public Select()
Constructs a select.
-
Select
@Deprecated @SafeVarargs public Select(T... items)
Deprecated.as of 23.1. Please useHasListDataView.setItems(Object[])instead.Constructs a select with the given items.- Parameters:
items- the items for the select- See Also:
HasListDataView.setItems(Object...)
-
Select
public Select(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>> listener)
Constructs a select with the initial value change listener.- Parameters:
listener- the value change listener to add- See Also:
AbstractField.addValueChangeListener(ValueChangeListener)
-
Select
public Select(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>> listener)
Constructs a select with the initial label text and value change listener.- Parameters:
label- the label describing the selectlistener- the value change listener to add- See Also:
setLabel(String),AbstractField.addValueChangeListener(ValueChangeListener)
-
Select
@SafeVarargs public Select(String label, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>> listener, T... items)
Constructs a select with the initial label text and value change listener.- Parameters:
label- the label describing the selectlistener- the value change listener to additems- the items to be shown in the list of the select- See Also:
setLabel(String),HasListDataView.setItems(Object...),AbstractField.addValueChangeListener(ValueChangeListener)
-
-
Method Detail
-
getItemRenderer
public ComponentRenderer<? extends com.vaadin.flow.component.Component,T> getItemRenderer()
Returns the item component renderer.- Returns:
- the item renderer or
nullif none set - See Also:
setRenderer(ComponentRenderer)
-
setRenderer
public void setRenderer(ComponentRenderer<? extends com.vaadin.flow.component.Component,T> renderer)
Sets the item renderer for this select group. The renderer is applied to each item to create a component which represents the item option in the select's drop down.Default is
nullwhich means that the item'sObject.toString()method is used and set as the text content of the vaadin item element.- Parameters:
renderer- the item renderer, ornullto clear
-
setTextRenderer
public void setTextRenderer(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)
Convenience setter for creating aTextRendererfrom the given function that converts the item to a string.NOTE: even though this accepts an
ItemLabelGenerator, this is not the same assetItemLabelGenerator(ItemLabelGenerator)which does a different thing.- Parameters:
itemLabelGenerator- the function that creates the text content from the item, notnull
-
setEmptySelectionAllowed
public void setEmptySelectionAllowed(boolean emptySelectionAllowed)
Sets whether the user is allowed to select nothing. When settruea special empty item is shown to the user.Default is
false. The empty selection item can be customized withsetEmptySelectionCaption(String).- Parameters:
emptySelectionAllowed-trueto allow not selecting anything,falseto require selection- See Also:
setEmptySelectionCaption(String)
-
isEmptySelectionAllowed
public boolean isEmptySelectionAllowed()
Returns whether the user is allowed to select nothing.- Returns:
trueif empty selection is allowed,falseotherwise
-
setEmptySelectionCaption
public void setEmptySelectionCaption(String emptySelectionCaption)
Sets the empty selection caption whensetEmptySelectionAllowed(boolean)has been enabled. The caption is shown for the empty selection item in the drop down.When the empty selection item is selected, the select shows the value provided by
setItemLabelGenerator(ItemLabelGenerator)for thenullitem, or the string set withsetPlaceholder(String)or an empty string if not placeholder is set.Default is an empty string "", which will show the place holder when selected.
- Parameters:
emptySelectionCaption- the empty selection caption to set, notnull- See Also:
setEmptySelectionAllowed(boolean)
-
getEmptySelectionCaption
public String getEmptySelectionCaption()
-
getItemEnabledProvider
public com.vaadin.flow.function.SerializablePredicate<T> getItemEnabledProvider()
Returns the item enabled predicate.- Returns:
- the item enabled predicate or
nullif not set - See Also:
setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T>)
-
setItemEnabledProvider
public void setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T> itemEnabledProvider)
Sets the item enabled predicate for this select. 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.By default is
nulland all the items are enabled.- Parameters:
itemEnabledProvider- the item enable predicate ornullto clear
-
getItemLabelGenerator
public com.vaadin.flow.component.ItemLabelGenerator<T> getItemLabelGenerator()
Gets the item label generator. It generates the text that is shown in the input part for the item when it has been selected.Default is
null.- Returns:
- the item label generator,
nullif not set
-
setItemLabelGenerator
public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator)
Sets the item label generator. It generates the text that is shown in the input part for the item when it has been selected.Default is
nulland the text content generated for the item withsetRenderer(ComponentRenderer)is used instead.- Parameters:
itemLabelGenerator- the item label generator to set, ornullto clear
-
getPlaceholder
public String getPlaceholder()
Gets the placeholder hint set for the user.- Returns:
- the placeholder or
nullif none set
-
setPlaceholder
public void setPlaceholder(String placeholder)
Sets the placeholder hint for the user.The placeholder will be displayed in the case that there is no item selected, or the selected item has an empty string label, or the selected item has no label and it's DOM content is empty.
Default value is
null.- Overrides:
setPlaceholderin classGeneratedVaadinSelect<Select<T>,T>- Parameters:
placeholder- the placeholder to set, ornullto remove
-
setLabel
public void setLabel(String label)
Sets the string for the label element.NOTE: the label must be set for the required indicator to be visible.
- Specified by:
setLabelin interfacecom.vaadin.flow.component.HasLabel- Overrides:
setLabelin classGeneratedVaadinSelect<Select<T>,T>- Parameters:
label- string ornullto clear it
-
getLabel
public String getLabel()
Gets the string for the label element.- Specified by:
getLabelin interfacecom.vaadin.flow.component.HasLabel- Returns:
- the label string, or
nullif not set
-
setAutofocus
public void setAutofocus(boolean autofocus)
Sets the select to have focus when the page loads.Default is
false.- Overrides:
setAutofocusin classGeneratedVaadinSelect<Select<T>,T>- Parameters:
autofocus- the autofocus to set
-
isAutofocus
public boolean isAutofocus()
Gets whether this select has been set to autofocus when the page loads.- Returns:
trueif set to autofocus,falseif not
-
setItems
@Deprecated public void setItems(Stream<T> streamOfItems)
Deprecated.Because the stream is collected to a list anyway, useHasListDataView.setItems(Collection)instead.
-
setDataProvider
@Deprecated public void setDataProvider(com.vaadin.flow.data.provider.DataProvider<T,?> dataProvider)
Deprecated.use instead one of thesetItemsmethods which provide access to eitherSelectListDataVieworSelectDataView
-
getDataProvider
public com.vaadin.flow.data.provider.DataProvider<T,?> getDataProvider()
Gets the data provider.- Returns:
- the data provider, not
null
-
setItems
public SelectDataView<T> setItems(com.vaadin.flow.data.provider.DataProvider<T,Void> dataProvider)
- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void,SelectDataView<T>>
-
setItems
public SelectDataView<T> setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider)
- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void,SelectDataView<T>>
-
setItems
public SelectListDataView<T> setItems(com.vaadin.flow.data.provider.ListDataProvider<T> dataProvider)
- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasListDataView<T,SelectListDataView<T>>
-
getGenericDataView
public SelectDataView<T> getGenericDataView()
Gets the generic data view for theSelect. 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<T,Void,SelectDataView<T>>- Returns:
- the generic DataView instance implementing
Select
-
getListDataView
public SelectListDataView<T> getListDataView()
Gets the list data view for theSelect. This data view should only be used when the items are in-memory and set with:HasListDataView.setItems(Collection)HasListDataView.setItems(Object[])setItems(ListDataProvider)
- Specified by:
getListDataViewin interfacecom.vaadin.flow.data.provider.HasListDataView<T,SelectListDataView<T>>- Returns:
- the list data view that provides access to the data bound to the
Select
-
onEnabledStateChanged
public void onEnabledStateChanged(boolean enabled)
- Overrides:
onEnabledStateChangedin classcom.vaadin.flow.component.Component
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
NOTE: The required indicator will not be visible, if thesetLabel(String)property is not set for the select.- Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>,T>- Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>,T>
-
isRequiredIndicatorVisible
public boolean isRequiredIndicatorVisible()
NOTE: The required indicator will not be visible, if thesetLabel(String)property is not set for the select.- Specified by:
isRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>,T>- Specified by:
isRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<Select<T>,T>,T>
-
setErrorMessage
public void setErrorMessage(String errorMessage)
Sets the error message to show to the user on invalid selection.- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Overrides:
setErrorMessagein classGeneratedVaadinSelect<Select<T>,T>- Parameters:
errorMessage- the error message ornullto clear it
-
getErrorMessage
public String getErrorMessage()
Gets the error message to show to the user on invalid selection- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Returns:
- the error message or
nullif not set
-
setInvalid
public void setInvalid(boolean invalid)
Sets the select to show as invalid state and display error message.- Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation- Overrides:
setInvalidin classGeneratedVaadinSelect<Select<T>,T>- Parameters:
invalid-truefor invalid,falsefor valid
-
isInvalid
public boolean isInvalid()
Gets whether the select is currently in invalid state.- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation- Returns:
truefor invalid,falsefor valid
-
add
public void add(com.vaadin.flow.component.Component... components)
NOTE: If you add a component with the
slotattribute set, it will be placed in the light-dom of thevaadin-selectinstead of the drop down, similar toaddToPrefix(Component...)- Specified by:
addin interfacecom.vaadin.flow.component.HasComponents
-
addComponents
public void addComponents(T afterItem, com.vaadin.flow.component.Component... components)
- Specified by:
addComponentsin interfacecom.vaadin.flow.data.binder.HasItemComponents<T>
-
prependComponents
public void prependComponents(T beforeItem, com.vaadin.flow.component.Component... components)
- Specified by:
prependComponentsin interfacecom.vaadin.flow.data.binder.HasItemComponents<T>
-
addComponentAtIndex
public void addComponentAtIndex(int index, com.vaadin.flow.component.Component component)NOTE: If you add a component with the
slotattribute set, it will be placed in the light-dom of thevaadin-selectinstead of the drop down, similar toaddToPrefix(Component...)- Specified by:
addComponentAtIndexin interfacecom.vaadin.flow.component.HasComponents
-
addComponentAsFirst
public void addComponentAsFirst(com.vaadin.flow.component.Component component)
NOTE: If you add a component with the
slotattribute set, it will be placed in the light-dom of thevaadin-selectinstead of the drop down, similar toaddToPrefix(Component...)- Specified by:
addComponentAsFirstin interfacecom.vaadin.flow.component.HasComponents
-
addToPrefix
public void addToPrefix(com.vaadin.flow.component.Component... components)
Description copied from class:GeneratedVaadinSelectAdds the given components as children of this component at the slot 'prefix'.- Overrides:
addToPrefixin classGeneratedVaadinSelect<Select<T>,T>- Parameters:
components- The components to add.- See Also:
- MDN page about slots, Spec website about slots
-
getChildren
public Stream<com.vaadin.flow.component.Component> getChildren()
- Overrides:
getChildrenin classcom.vaadin.flow.component.Component
-
remove
public void remove(com.vaadin.flow.component.Component... components)
Removes the given child components from this component.NOTE: any component with the
slotattribute will be attempted to removed from the light dom of the vaadin-select, instead of inside the options drop down.- Specified by:
removein interfacecom.vaadin.flow.component.HasComponents- Overrides:
removein classGeneratedVaadinSelect<Select<T>,T>- Parameters:
components- the components to remove- Throws:
IllegalArgumentException- if any of the components is not a child of this component
-
removeAll
public void removeAll()
Removes all child components that are not items. To remove all items, reset the data provider or useHasListDataView.setItems(Object[]).NOTE: this will remove all non-items from the drop down and any slotted components from vaadin-select's light dom.
- Specified by:
removeAllin interfacecom.vaadin.flow.component.HasComponents- Overrides:
removeAllin classGeneratedVaadinSelect<Select<T>,T>- See Also:
HasComponents.removeAll()
-
addThemeVariants
public void addThemeVariants(SelectVariant... variants)
Adds theme variants to the component.- Parameters:
variants- theme variants to add
-
removeThemeVariants
public void removeThemeVariants(SelectVariant... variants)
Removes theme variants from the component.- Parameters:
variants- theme variants to remove
-
hasValidValue
protected boolean hasValidValue()
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
- Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
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 whenAbstractField.setValue(Object)orAbstractField.setModelValue(Object, boolean)is called. Subclasses can override this method to define an alternative comparison method instead ofObject.equals(Object).
-
-