Class GeneratedVaadinComboBox<R extends GeneratedVaadinComboBox<R,T>,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.combobox.GeneratedVaadinComboBox<R,T>
-
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<R>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<R>,com.vaadin.flow.component.FocusNotifier<R>,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<R,T>,T>,com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<R,T>,T>,Serializable
- Direct Known Subclasses:
ComboBox
@Tag("vaadin-combo-box") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.1.3") @NpmPackage(value="@vaadin/combo-box",version="23.1.3") @NpmPackage(value="@vaadin/vaadin-combo-box",version="23.1.3") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/combo-box/src/vaadin-combo-box.js") @JsModule("@vaadin/polymer-legacy-adapter/template-renderer.js") public abstract class GeneratedVaadinComboBox<R extends GeneratedVaadinComboBox<R,T>,T> extends com.vaadin.flow.component.AbstractSinglePropertyField<R,T> implements com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.Focusable<R>Description copied from corresponding location in WebComponent:
<vaadin-combo-box>is a combo box element combining a dropdown list with an input field for filtering the list of items. If you want to replace the default input field with a custom implementation, you should use the<vaadin-combo-box-light>element.Items in the dropdown list must be provided as a list of
Stringvalues. Defining the items is done using theitemsproperty, which can be assigned with data-binding, using an attribute or directly with the JavaScript property.<vaadin-combo-box label="Fruit" items="[[data]]"> </vaadin-combo-box>
combobox.items = ['apple', 'orange', 'banana'];When the selected
valueis changed, avalue-changedevent is triggered.This element can be used within an
iron-form.Item rendering
<vaadin-combo-box>supports using custom renderer callback function for defining the content of<vaadin-combo-box-item>.The renderer function provides
root,comboBox,modelarguments when applicable. Generate DOM content by usingmodelobject properties if needed, append it to therootelement and control the state of the host element by accessingcomboBox. Before generating new content, users are able to check if there is already content inrootfor reusing it.<vaadin-combo-box id="combo-box"></vaadin-combo-box>
const comboBox = document.querySelector('#combo-box');comboBox.items = [ 'label': 'Hydrogen', 'value': 'H']; comboBox.renderer = function(root, comboBox, model) { root.innerHTML = model.index + ': ' + model.item.label + ' ' + '' + model.item.value + ''; };}Renderer is called on the opening of the combo-box and each time the related model is updated. DOM generated during the renderer call can be reused in the next renderer call and will be provided with the
rootargument. On first call it will be empty.Item Template
Alternatively, the content of the
<vaadin-combo-box-item>can be populated by using custom item template provided in the light DOM:<vaadin-combo-box items='[{"label": "Hydrogen", "value": "H"}]'> <template> [[index]]: [[item.label]] <b>[[item.value]</b> </template> </vaadin-combo-box>
The following properties are available for item template bindings:
Property name Type Description indexNumber Index of the item in the itemsarrayitemString or Object The item reference selectedBoolean True when item is selected focusedBoolean True when item is focused Lazy Loading with Function Data Provider
In addition to assigning an array to the items property, you can alternatively provide the
<vaadin-combo-box>data through thedataProviderfunction property. The<vaadin-combo-box>calls this function lazily, only when it needs more data to be displayed.See the
dataProviderin the API reference below for the detailed data provider arguments description, and the “Lazy Loading“ example on “Basics” page in the demos.Note that when using function data providers, the total number of items needs to be set manually. The total number of items can be returned in the second argument of the data provider callback:
javascript comboBox.dataProvider = function(params, callback) var url = 'https://api.example/data' + '?page=' + params.page + // the requested page index '&per_page=' + params.pageSize; // number of items on the page var xhr = new XMLHttpRequest(); xhr.onload = function() { var response = JSON.parse(xhr.responseText); callback( response.employees, // requested page of items response.totalSize // total number of items ); }; xhr.open('GET', url, true); xhr.send();;}Styling
The following custom properties are available for styling:
Custom property Description Default --vaadin-combo-box-overlay-max-heightProperty that determines the max height of overlay 65vhThe following shadow DOM parts are available for styling:
Part name Description text-fieldThe text field toggle-buttonThe toggle button See
<vaadin-overlay>documentation for<vaadin-combo-box-overlay>parts.See
<vaadin-text-field>documentation for the text field parts.The following state attributes are available for styling:
Attribute Description Part name openedSet when the combo box dropdown is open :host disabledSet to a disabled combo box :host readonlySet to a read only combo box :host has-valueSet when the element has a value :host invalidSet when the element is invalid :host focusedSet when the element is focused :host focus-ringSet when the element is keyboard focused :host loadingSet when new items are expected :host In addition to
<vaadin-combo-box>itself, the following internal components are themable:<vaadin-text-field><vaadin-combo-box-overlay><vaadin-combo-box-item>
Note: the
themeattribute value set on<vaadin-combo-box>is propagated to the internal themable components listed above.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGeneratedVaadinComboBox.CustomValueSetEvent<R extends GeneratedVaadinComboBox<R,?>>static classGeneratedVaadinComboBox.FilterChangeEvent<R extends GeneratedVaadinComboBox<R,?>>static classGeneratedVaadinComboBox.InvalidChangeEvent<R extends GeneratedVaadinComboBox<R,?>>static classGeneratedVaadinComboBox.OpenedChangeEvent<R extends GeneratedVaadinComboBox<R,?>>static classGeneratedVaadinComboBox.SelectedItemChangeEvent<R extends GeneratedVaadinComboBox<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.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<?>>
-
-
Constructor Summary
Constructors Constructor Description GeneratedVaadinComboBox()Default constructor.GeneratedVaadinComboBox(T initialValue, T defaultValue, boolean acceptNullValues)Constructs a new GeneratedVaadinComboBox component with the given arguments.GeneratedVaadinComboBox(T initialValue, T defaultValue, Class<P> elementPropertyType, com.vaadin.flow.function.SerializableBiFunction<R,P,T> presentationToModel, com.vaadin.flow.function.SerializableBiFunction<R,T,P> modelToPresentation)Constructs a new GeneratedVaadinComboBox component with the given arguments.GeneratedVaadinComboBox(T initialValue, T defaultValue, Class<P> elementPropertyType, com.vaadin.flow.function.SerializableBiFunction<R,P,T> presentationToModel, com.vaadin.flow.function.SerializableBiFunction<R,T,P> modelToPresentation, boolean isInitialValueOptional)Constructs a new GeneratedVaadinComboBox component with the given arguments.GeneratedVaadinComboBox(T initialValue, T defaultValue, Class<P> elementPropertyType, com.vaadin.flow.function.SerializableFunction<P,T> presentationToModel, com.vaadin.flow.function.SerializableFunction<T,P> modelToPresentation)Constructs a new GeneratedVaadinComboBox component with the given arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.vaadin.flow.shared.RegistrationaddCustomValueSetListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.CustomValueSetEvent<R>> listener)Adds a listener forcustom-value-setevents fired by the webcomponent.protected com.vaadin.flow.shared.RegistrationaddFilterChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.FilterChangeEvent<R>> listener)Adds a listener forfilter-changedevents fired by the webcomponent.protected com.vaadin.flow.shared.RegistrationaddInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.InvalidChangeEvent<R>> listener)Adds a listener forinvalid-changedevents fired by the webcomponent.protected com.vaadin.flow.shared.RegistrationaddOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.OpenedChangeEvent<R>> listener)Adds a listener foropened-changedevents fired by the webcomponent.protected com.vaadin.flow.shared.RegistrationaddSelectedItemChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.SelectedItemChangeEvent<R>> listener)Adds a listener forselected-item-changedevents fired by the webcomponent.protected voidaddToPrefix(com.vaadin.flow.component.Component... components)Adds the given components as children of this component at the slot 'prefix'.protected voidcancel()Description copied from corresponding location in WebComponent:protected voidcheckValidity()Description copied from corresponding location in WebComponent:protected voidclearCache()Description copied from corresponding location in WebComponent:protected voidclose()Description copied from corresponding location in WebComponent:protected StringgetErrorMessageString()Description copied from corresponding location in WebComponent:protected elemental.json.JsonArraygetFilteredItemsJsonArray()Description copied from corresponding location in WebComponent:protected StringgetFilterString()Description copied from corresponding location in WebComponent:protected StringgetItemIdPathString()Description copied from corresponding location in WebComponent:protected StringgetItemLabelPathString()Description copied from corresponding location in WebComponent:protected elemental.json.JsonArraygetItemsJsonArray()Description copied from corresponding location in WebComponent:protected StringgetItemValuePathString()Description copied from corresponding location in WebComponent:protected StringgetLabelString()Description copied from corresponding location in WebComponent:protected StringgetNameString()Description copied from corresponding location in WebComponent:protected doublegetPageSizeDouble()Description copied from corresponding location in WebComponent:protected StringgetPatternString()Description copied from corresponding location in WebComponent:protected StringgetPlaceholderString()Description copied from corresponding location in WebComponent:protected elemental.json.JsonObjectgetSelectedItemJsonObject()Description copied from corresponding location in WebComponent:protected doublegetSizeDouble()Description copied from corresponding location in WebComponent:protected booleanisAllowCustomValueBoolean()Description copied from corresponding location in WebComponent:protected booleanisAutofocusBoolean()This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.protected booleanisDisabledBoolean()Description copied from corresponding location in WebComponent:protected booleanisInvalidBoolean()Description copied from corresponding location in WebComponent:protected booleanisLoadingBoolean()Description copied from corresponding location in WebComponent:protected booleanisOpenedBoolean()Description copied from corresponding location in WebComponent:protected booleanisPreventInvalidInputBoolean()Description copied from corresponding location in WebComponent:protected booleanisReadonlyBoolean()This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.protected booleanisRequiredBoolean()Description copied from corresponding location in WebComponent:protected voidopen()Description copied from corresponding location in WebComponent:protected voidremove(com.vaadin.flow.component.Component... components)Removes the given child components from this component.protected voidremoveAll()Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using theElementAPI.protected voidsetAllowCustomValue(boolean allowCustomValue)Description copied from corresponding location in WebComponent:protected voidsetAutofocus(boolean autofocus)protected voidsetDisabled(boolean disabled)Description copied from corresponding location in WebComponent:protected voidsetErrorMessage(String errorMessage)Description copied from corresponding location in WebComponent:protected voidsetFilter(String filter)Description copied from corresponding location in WebComponent:protected voidsetFilteredItems(elemental.json.JsonArray filteredItems)Description copied from corresponding location in WebComponent:protected voidsetInvalid(boolean invalid)Description copied from corresponding location in WebComponent:protected voidsetItemIdPath(String itemIdPath)Description copied from corresponding location in WebComponent:protected voidsetItemLabelPath(String itemLabelPath)Description copied from corresponding location in WebComponent:protected voidsetItems(elemental.json.JsonArray items)Description copied from corresponding location in WebComponent:protected voidsetItemValuePath(String itemValuePath)Description copied from corresponding location in WebComponent:protected voidsetLabel(String label)Description copied from corresponding location in WebComponent:protected voidsetLoading(boolean loading)Description copied from corresponding location in WebComponent:protected voidsetName(String name)Description copied from corresponding location in WebComponent:protected voidsetOpened(boolean opened)Description copied from corresponding location in WebComponent:protected voidsetPageSize(double pageSize)Description copied from corresponding location in WebComponent:protected voidsetPattern(String pattern)Description copied from corresponding location in WebComponent:protected voidsetPlaceholder(String placeholder)Description copied from corresponding location in WebComponent:protected voidsetPreventInvalidInput(boolean preventInvalidInput)Description copied from corresponding location in WebComponent:protected voidsetReadonly(boolean readonly)protected voidsetRequired(boolean required)Description copied from corresponding location in WebComponent:protected voidsetSelectedItem(elemental.json.JsonObject selectedItem)Description copied from corresponding location in WebComponent:protected voidsetSize(double size)Description copied from corresponding location in WebComponent:protected voidvalidate()Description copied from corresponding location in WebComponent:-
Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
-
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, 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
-
-
-
-
Constructor Detail
-
GeneratedVaadinComboBox
public GeneratedVaadinComboBox(T initialValue, T defaultValue, Class<P> elementPropertyType, com.vaadin.flow.function.SerializableFunction<P,T> presentationToModel, com.vaadin.flow.function.SerializableFunction<T,P> modelToPresentation)
Constructs a new GeneratedVaadinComboBox component with the given arguments.- Type Parameters:
P- the property type- Parameters:
initialValue- the initial value to set to the valuedefaultValue- the default value to use if the value isn't definedelementPropertyType- the type of the element propertypresentationToModel- a function that converts a string value to a model valuemodelToPresentation- a function that converts a model value to a string value
-
GeneratedVaadinComboBox
public GeneratedVaadinComboBox(T initialValue, T defaultValue, boolean acceptNullValues)
Constructs a new GeneratedVaadinComboBox component with the given arguments.- Parameters:
initialValue- the initial value to set to the valuedefaultValue- the default value to use if the value isn't definedacceptNullValues- whethernullis accepted as a model value
-
GeneratedVaadinComboBox
public GeneratedVaadinComboBox(T initialValue, T defaultValue, Class<P> elementPropertyType, com.vaadin.flow.function.SerializableBiFunction<R,P,T> presentationToModel, com.vaadin.flow.function.SerializableBiFunction<R,T,P> modelToPresentation, boolean isInitialValueOptional)
Constructs a new GeneratedVaadinComboBox component with the given arguments.- Type Parameters:
P- the property type- Parameters:
initialValue- the initial value to set to the valuedefaultValue- the default value to use if the value isn't definedelementPropertyType- the type of the element propertypresentationToModel- a function that accepts this component and a property value and returns a model valuemodelToPresentation- a function that accepts this component and a model value and returns a property valueisInitialValueOptional- ifisInitialValueOptionalistruethen the initial value is used only if element has no"value"property value, otherwise element"value"property is ignored and the initial value is set
-
GeneratedVaadinComboBox
public GeneratedVaadinComboBox(T initialValue, T defaultValue, Class<P> elementPropertyType, com.vaadin.flow.function.SerializableBiFunction<R,P,T> presentationToModel, com.vaadin.flow.function.SerializableBiFunction<R,T,P> modelToPresentation)
Constructs a new GeneratedVaadinComboBox component with the given arguments.- Type Parameters:
P- the property type- Parameters:
initialValue- the initial value to set to the valuedefaultValue- the default value to use if the value isn't definedelementPropertyType- the type of the element propertypresentationToModel- a function that accepts this component and a property value and returns a model valuemodelToPresentation- a function that accepts this component and a model value and returns a property value
-
GeneratedVaadinComboBox
public GeneratedVaadinComboBox()
Default constructor.
-
-
Method Detail
-
isAutofocusBoolean
protected boolean isAutofocusBoolean()
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.- Returns:
- the
autofocusproperty from the webcomponent
-
setAutofocus
protected void setAutofocus(boolean autofocus)
- Parameters:
autofocus- the boolean value to set
-
isDisabledBoolean
protected boolean isDisabledBoolean()
Description copied from corresponding location in WebComponent:
Set to true to disable this input.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
disabledproperty from the webcomponent
-
setDisabled
protected void setDisabled(boolean disabled)
Description copied from corresponding location in WebComponent:
Set to true to disable this input.
- Parameters:
disabled- the boolean value to set
-
getPageSizeDouble
protected double getPageSizeDouble()
Description copied from corresponding location in WebComponent:
Number of items fetched at a time from the dataprovider.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
pageSizeproperty from the webcomponent
-
setPageSize
protected void setPageSize(double pageSize)
Description copied from corresponding location in WebComponent:
Number of items fetched at a time from the dataprovider.
- Parameters:
pageSize- the double value to set
-
getSizeDouble
protected double getSizeDouble()
Description copied from corresponding location in WebComponent:
Total number of items.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
sizeproperty from the webcomponent
-
setSize
protected void setSize(double size)
Description copied from corresponding location in WebComponent:
Total number of items.
- Parameters:
size- the double value to set
-
isOpenedBoolean
@Synchronize(property="opened", value="opened-changed") protected boolean isOpenedBoolean()Description copied from corresponding location in WebComponent:
True if the dropdown is open, false otherwise.
This property is synchronized automatically from client side when a 'opened-changed' event happens.
- Returns:
- the
openedproperty from the webcomponent
-
setOpened
protected void setOpened(boolean opened)
Description copied from corresponding location in WebComponent:
True if the dropdown is open, false otherwise.
- Parameters:
opened- the boolean value to set
-
isReadonlyBoolean
protected boolean isReadonlyBoolean()
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.- Returns:
- the
readonlyproperty from the webcomponent
-
setReadonly
protected void setReadonly(boolean readonly)
- Parameters:
readonly- the boolean value to set
-
getItemsJsonArray
protected elemental.json.JsonArray getItemsJsonArray()
Description copied from corresponding location in WebComponent:
A full set of items to filter the visible options from. The items can be of either
StringorObjecttype.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
itemsproperty from the webcomponent
-
setItems
protected void setItems(elemental.json.JsonArray items)
Description copied from corresponding location in WebComponent:
A full set of items to filter the visible options from. The items can be of either
StringorObjecttype.- Parameters:
items- the JsonArray value to set
-
isAllowCustomValueBoolean
protected boolean isAllowCustomValueBoolean()
Description 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.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
allowCustomValueproperty from the webcomponent
-
setAllowCustomValue
protected void setAllowCustomValue(boolean allowCustomValue)
Description 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.- Parameters:
allowCustomValue- the boolean value to set
-
getFilteredItemsJsonArray
protected elemental.json.JsonArray getFilteredItemsJsonArray()
Description copied from corresponding location in WebComponent:
A subset of items, filtered based on the user input. Filtered items can be assigned directly to omit the internal filtering functionality. The items can be of either
StringorObjecttype.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
filteredItemsproperty from the webcomponent
-
setFilteredItems
protected void setFilteredItems(elemental.json.JsonArray filteredItems)
Description copied from corresponding location in WebComponent:
A subset of items, filtered based on the user input. Filtered items can be assigned directly to omit the internal filtering functionality. The items can be of either
StringorObjecttype.- Parameters:
filteredItems- the JsonArray value to set
-
isLoadingBoolean
protected boolean isLoadingBoolean()
Description copied from corresponding location in WebComponent:
When set to
true, "loading" attribute is added to host and the overlay element.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
loadingproperty from the webcomponent
-
setLoading
protected void setLoading(boolean loading)
Description copied from corresponding location in WebComponent:
When set to
true, "loading" attribute is added to host and the overlay element.- Parameters:
loading- the boolean value to set
-
getFilterString
@Synchronize(property="filter", value="filter-changed") protected String getFilterString()Description copied from corresponding location in WebComponent:
Filtering string the user has typed into the input field.
This property is synchronized automatically from client side when a 'filter-changed' event happens.
- Returns:
- the
filterproperty from the webcomponent
-
setFilter
protected void setFilter(String filter)
Description copied from corresponding location in WebComponent:
Filtering string the user has typed into the input field.
- Parameters:
filter- the String value to set
-
getSelectedItemJsonObject
@Synchronize(property="selectedItem", value="selected-item-changed") protected elemental.json.JsonObject getSelectedItemJsonObject()Description copied from corresponding location in WebComponent:
The selected item from the
itemsarray.This property is synchronized automatically from client side when a 'selected-item-changed' event happens.
- Returns:
- the
selectedItemproperty from the webcomponent
-
setSelectedItem
protected void setSelectedItem(elemental.json.JsonObject selectedItem)
Description copied from corresponding location in WebComponent:
The selected item from the
itemsarray.- Parameters:
selectedItem- the JsonObject value to set
-
getItemLabelPathString
protected String getItemLabelPathString()
Description copied from corresponding location in WebComponent:
Path for label of the item. If
itemsis an array of objects, theitemLabelPathis used to fetch the displayed string label for each item.The item label is also used for matching items when processing user input, i.e., for filtering and selecting items.
When using item templates, the property is still needed because it is used for filtering, and for displaying the selected item value in the input box.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
itemLabelPathproperty from the webcomponent
-
setItemLabelPath
protected void setItemLabelPath(String itemLabelPath)
Description copied from corresponding location in WebComponent:
Path for label of the item. If
itemsis an array of objects, theitemLabelPathis used to fetch the displayed string label for each item.The item label is also used for matching items when processing user input, i.e., for filtering and selecting items.
When using item templates, the property is still needed because it is used for filtering, and for displaying the selected item value in the input box.
- Parameters:
itemLabelPath- the String value to set
-
getItemValuePathString
protected String getItemValuePathString()
Description copied from corresponding location in WebComponent:
Path for the value of the item. If
itemsis an array of objects, theitemValuePath:is used to fetch the string value for the selected item.The item value is used in the
valueproperty of the combo box, to provide the form value.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
itemValuePathproperty from the webcomponent
-
setItemValuePath
protected void setItemValuePath(String itemValuePath)
Description copied from corresponding location in WebComponent:
Path for the value of the item. If
itemsis an array of objects, theitemValuePath:is used to fetch the string value for the selected item.The item value is used in the
valueproperty of the combo box, to provide the form value.- Parameters:
itemValuePath- the String value to set
-
getItemIdPathString
protected String getItemIdPathString()
Description copied from corresponding location in WebComponent:
Path for the id of the item. If
itemsis an array of objects, theitemIdPathis used to compare and identify the same item inselectedItemandfilteredItems(items given by thedataProvidercallback).This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
itemIdPathproperty from the webcomponent
-
setItemIdPath
protected void setItemIdPath(String itemIdPath)
Description copied from corresponding location in WebComponent:
Path for the id of the item. If
itemsis an array of objects, theitemIdPathis used to compare and identify the same item inselectedItemandfilteredItems(items given by thedataProvidercallback).- Parameters:
itemIdPath- the String value to set
-
getNameString
protected String getNameString()
Description copied from corresponding location in WebComponent:
The name of this element.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
nameproperty from the webcomponent
-
setName
protected void setName(String name)
Description copied from corresponding location in WebComponent:
The name of this element.
- Parameters:
name- the String value to set
-
isInvalidBoolean
@Synchronize(property="invalid", value="invalid-changed") protected boolean isInvalidBoolean()Description copied from corresponding location in WebComponent:
Set to true if the value is invalid.
This property is synchronized automatically from client side when a 'invalid-changed' event happens.
- Returns:
- the
invalidproperty from the webcomponent
-
setInvalid
protected void setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
Set to true if the value is invalid.
- Parameters:
invalid- the boolean value to set
-
getLabelString
protected String getLabelString()
Description copied from corresponding location in WebComponent:
The label for this element.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
labelproperty from the webcomponent
-
setLabel
protected void setLabel(String label)
Description copied from corresponding location in WebComponent:
The label for this element.
- Parameters:
label- the String value to set
-
isRequiredBoolean
protected boolean isRequiredBoolean()
Description copied from corresponding location in WebComponent:
Set to true to mark the input as required.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
requiredproperty from the webcomponent
-
setRequired
protected void setRequired(boolean required)
Description copied from corresponding location in WebComponent:
Set to true to mark the input as required.
- Parameters:
required- the boolean value to set
-
isPreventInvalidInputBoolean
protected boolean isPreventInvalidInputBoolean()
Description copied from corresponding location in WebComponent:
Set to true to prevent the user from entering invalid input.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
preventInvalidInputproperty from the webcomponent
-
setPreventInvalidInput
protected void setPreventInvalidInput(boolean preventInvalidInput)
Description copied from corresponding location in WebComponent:
Set to true to prevent the user from entering invalid input.
- Parameters:
preventInvalidInput- the boolean value to set
-
getPatternString
protected String getPatternString()
Description copied from corresponding location in WebComponent:
A pattern to validate the
inputwith.This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
patternproperty from the webcomponent
-
setPattern
protected void setPattern(String pattern)
Description copied from corresponding location in WebComponent:
A pattern to validate the
inputwith.- Parameters:
pattern- the String value to set
-
getErrorMessageString
protected String getErrorMessageString()
Description copied from corresponding location in WebComponent:
The error message to display when the input is invalid.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
errorMessageproperty from the webcomponent
-
setErrorMessage
protected void setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
The error message to display when the input is invalid.
- Parameters:
errorMessage- the String value to set
-
getPlaceholderString
protected String getPlaceholderString()
Description copied from corresponding location in WebComponent:
A placeholder string in addition to the label.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
- Returns:
- the
placeholderproperty from the webcomponent
-
setPlaceholder
protected void setPlaceholder(String placeholder)
Description copied from corresponding location in WebComponent:
A placeholder string in addition to the label.
- Parameters:
placeholder- the String value to set
-
clearCache
protected void clearCache()
Description copied from corresponding location in WebComponent:
Clears the cached pages and reloads data from dataprovider when needed.
-
open
protected void open()
Description copied from corresponding location in WebComponent:
Opens the dropdown list.
-
close
protected void close()
Description copied from corresponding location in WebComponent:
Closes the dropdown list.
-
cancel
protected void cancel()
Description copied from corresponding location in WebComponent:
Reverts back to original value.
-
validate
@NotSupported protected void validate()
Description copied from corresponding location in WebComponent:
Returns true if
valueis valid, and sets theinvalidflag appropriately.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.
-
checkValidity
protected void checkValidity()
Description copied from corresponding location in WebComponent:
Returns true if the current input value satisfies all constraints (if any)
You can override the
checkValiditymethod for custom validations.
-
addCustomValueSetListener
protected com.vaadin.flow.shared.Registration addCustomValueSetListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.CustomValueSetEvent<R>> listener)
Adds a listener forcustom-value-setevents fired by the webcomponent.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
addSelectedItemChangeListener
protected com.vaadin.flow.shared.Registration addSelectedItemChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.SelectedItemChangeEvent<R>> listener)
Adds a listener forselected-item-changedevents fired by the webcomponent.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
addOpenedChangeListener
protected com.vaadin.flow.shared.Registration addOpenedChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.OpenedChangeEvent<R>> listener)
Adds a listener foropened-changedevents fired by the webcomponent.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
addFilterChangeListener
protected com.vaadin.flow.shared.Registration addFilterChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.FilterChangeEvent<R>> listener)
Adds a listener forfilter-changedevents fired by the webcomponent.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
addInvalidChangeListener
protected com.vaadin.flow.shared.Registration addInvalidChangeListener(com.vaadin.flow.component.ComponentEventListener<GeneratedVaadinComboBox.InvalidChangeEvent<R>> listener)
Adds a listener forinvalid-changedevents fired by the webcomponent.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
addToPrefix
protected void addToPrefix(com.vaadin.flow.component.Component... components)
Adds the given components as children of this component at the slot 'prefix'.- Parameters:
components- The components to add.- See Also:
- MDN page about slots, Spec website about slots
-
remove
protected void remove(com.vaadin.flow.component.Component... components)
Removes the given child components from this component.- Parameters:
components- The components to remove.- Throws:
IllegalArgumentException- if any of the components is not a child of this component.
-
removeAll
protected void removeAll()
Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using theElementAPI.
-
-