Class GeneratedVaadinSelect<R extends GeneratedVaadinSelect<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.select.generated.GeneratedVaadinSelect<R,T>
-
- All Implemented Interfaces:
AttachNotifier,BlurNotifier<R>,DetachNotifier,Focusable<R>,FocusNotifier<R>,HasElement,HasEnabled,HasStyle,HasValue<AbstractField.ComponentValueChangeEvent<R,T>,T>,HasValueAndElement<AbstractField.ComponentValueChangeEvent<R,T>,T>,Serializable
- Direct Known Subclasses:
Select
@Deprecated @Tag("vaadin-select") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.6.2") @NpmPackage(value="@vaadin/select",version="23.6.2") @NpmPackage(value="@vaadin/vaadin-select",version="23.6.2") @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/select/src/vaadin-select.js") @JsModule("@vaadin/polymer-legacy-adapter/template-renderer.js") public abstract class GeneratedVaadinSelect<R extends GeneratedVaadinSelect<R,T>,T> extends AbstractSinglePropertyField<R,T> implements HasStyle, Focusable<R>
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
<vaadin-select>is a Web Component for selecting values from a list of items. The content of the the select can be populated in two ways: imperatively by using renderer callback function and declaratively by using Polymer's Templates.Rendering
By default, the select uses the content provided by using the renderer callback function.
The renderer function provides
root,selectarguments. Generate DOM content, append it to therootelement and control the state of the host element by accessingselect.<vaadin-select id="select"></vaadin-select>
const select = document.querySelector('#select');select.renderer = function(root, select) const listBox = document.createElement('vaadin-list-box'); // append 3 <vaadin-item> elements ['Jose', 'Manolo', 'Pedro'].forEach(function(name) { const item = document.createElement('vaadin-item'); item.textContent = name; listBox.appendChild(item); }); </p> <p> // update the content root.appendChild(listBox);;}Renderer is called on initialization of new select and on its opening. 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.Polymer Templates
Alternatively, the content can be provided with Polymer's Template. Select finds the first child template and uses that in case renderer callback function is not provided. You can also set a custom template using the
templateproperty.<vaadin-select> <template> <vaadin-list-box> <vaadin-item label="foo">Foo</vaadin-item> <vaadin-item>Bar</vaadin-item> <vaadin-item>Baz</vaadin-item> </vaadin-list-box> </template> </vaadin-select>Hint: By setting the
labelproperty of inner vaadin-items you will be able to change the visual representation of the selected value in the input part.Styling
The following shadow DOM parts are available for styling:
Part name Description toggle-buttonThe toggle button The following state attributes are available for styling:
Attribute Description Part name openedSet when the select is open :host invalidSet when the element is invalid :host focusedSet when the element is focused :host focus-ringSet when the element is keyboard focused :host readonlySet when the select is read only :host <vaadin-select>element sets these custom CSS properties:Property name Description Theme for element --vaadin-select-text-field-widthWidth of the select text field vaadin-select-overlaySee ThemableMixin – how to apply styles for shadow parts
In addition to
<vaadin-select>itself, the following internal components are themable:<vaadin-select-text-field><vaadin-select-overlay>
Note: the
themeattribute value set on<vaadin-select>is propagated to the internal themable components listed above.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGeneratedVaadinSelect.InvalidChangeEvent<R extends GeneratedVaadinSelect<R,?>>Deprecated.since v23.3, generated classes will be removed in v24.static classGeneratedVaadinSelect.OpenedChangeEvent<R extends GeneratedVaadinSelect<R,?>>Deprecated.since v23.3, generated classes will be removed in v24.-
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
BlurNotifier.BlurEvent<C extends Component>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
FocusNotifier.FocusEvent<C extends Component>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
-
-
Constructor Summary
Constructors Constructor Description GeneratedVaadinSelect()Deprecated.since v23.3, generated classes will be removed in v24.GeneratedVaadinSelect(T initialValue, T defaultValue, boolean acceptNullValues)Deprecated.since v23.3, generated classes will be removed in v24.GeneratedVaadinSelect(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableBiFunction<R,P,T> presentationToModel, SerializableBiFunction<R,T,P> modelToPresentation)Deprecated.since v23.3, generated classes will be removed in v24.GeneratedVaadinSelect(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableBiFunction<R,P,T> presentationToModel, SerializableBiFunction<R,T,P> modelToPresentation, boolean isInitialValueOptional)Deprecated.since v23.3, generated classes will be removed in v24.GeneratedVaadinSelect(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableFunction<P,T> presentationToModel, SerializableFunction<T,P> modelToPresentation)Deprecated.since v23.3, generated classes will be removed in v24.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected RegistrationaddInvalidChangeListener(ComponentEventListener<GeneratedVaadinSelect.InvalidChangeEvent<R>> listener)Deprecated.since v23.3, generated classes will be removed in v24.protected RegistrationaddOpenedChangeListener(ComponentEventListener<GeneratedVaadinSelect.OpenedChangeEvent<R>> listener)Deprecated.since v23.3, generated classes will be removed in v24.protected voidaddToPrefix(Component... components)Deprecated.since v23.3, generated classes will be removed in v24.protected StringgetErrorMessageString()Deprecated.since v23.3, generated classes will be removed in v24.protected StringgetLabelString()Deprecated.since v23.3, generated classes will be removed in v24.protected StringgetNameString()Deprecated.since v23.3, generated classes will be removed in v24.protected StringgetPlaceholderString()Deprecated.since v23.3, generated classes will be removed in v24.protected booleanisAutofocusBoolean()Deprecated.since v23.3, generated classes will be removed in v24.protected booleanisDisabledBoolean()Deprecated.since v23.3, generated classes will be removed in v24.protected booleanisInvalidBoolean()Deprecated.since v23.3, generated classes will be removed in v24.protected booleanisOpenedBoolean()Deprecated.since v23.3, generated classes will be removed in v24.protected booleanisReadonlyBoolean()Deprecated.since v23.3, generated classes will be removed in v24.protected booleanisRequiredBoolean()Deprecated.since v23.3, generated classes will be removed in v24.protected voidremove(Component... components)Deprecated.since v23.3, generated classes will be removed in v24.protected voidremoveAll()Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetAutofocus(boolean autofocus)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetDisabled(boolean disabled)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetErrorMessage(String errorMessage)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetInvalid(boolean invalid)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetLabel(String label)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetName(String name)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetOpened(boolean opened)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetPlaceholder(String placeholder)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetReadonly(boolean readonly)Deprecated.since v23.3, generated classes will be removed in v24.protected voidsetRequired(boolean required)Deprecated.since v23.3, generated classes will be removed in v24.protected voidvalidate()Deprecated.since v23.3, generated classes will be removed in v24.-
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, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, 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.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
-
Methods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListener
-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
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.HasValue
clear, getOptionalValue
-
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
-
-
-
-
Constructor Detail
-
GeneratedVaadinSelect
@Deprecated public GeneratedVaadinSelect(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableFunction<P,T> presentationToModel, SerializableFunction<T,P> modelToPresentation)
Deprecated.since v23.3, generated classes will be removed in v24.Constructs a new GeneratedVaadinSelect 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
-
GeneratedVaadinSelect
@Deprecated public GeneratedVaadinSelect(T initialValue, T defaultValue, boolean acceptNullValues)
Deprecated.since v23.3, generated classes will be removed in v24.Constructs a new GeneratedVaadinSelect 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
-
GeneratedVaadinSelect
@Deprecated public GeneratedVaadinSelect(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableBiFunction<R,P,T> presentationToModel, SerializableBiFunction<R,T,P> modelToPresentation)
Deprecated.since v23.3, generated classes will be removed in v24.Constructs a new GeneratedVaadinSelect 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
-
GeneratedVaadinSelect
@Deprecated public GeneratedVaadinSelect(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableBiFunction<R,P,T> presentationToModel, SerializableBiFunction<R,T,P> modelToPresentation, boolean isInitialValueOptional)
Deprecated.since v23.3, generated classes will be removed in v24.Constructs a new GeneratedVaadinSelect component with the given arguments.If
isInitialValueOptionalistruethen 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.- 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
-
GeneratedVaadinSelect
@Deprecated public GeneratedVaadinSelect()
Deprecated.since v23.3, generated classes will be removed in v24.Default constructor.
-
-
Method Detail
-
isAutofocusBoolean
@Deprecated protected boolean isAutofocusBoolean()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
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
@Deprecated protected void setAutofocus(boolean autofocus)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
- Parameters:
autofocus- the boolean value to set
-
isDisabledBoolean
@Deprecated protected boolean isDisabledBoolean()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
If true, the user cannot interact with 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
disabledproperty from the webcomponent
-
setDisabled
@Deprecated protected void setDisabled(boolean disabled)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
If true, the user cannot interact with this element.
- Parameters:
disabled- the boolean value to set
-
isOpenedBoolean
@Deprecated @Synchronize(property="opened", value="opened-changed") protected boolean isOpenedBoolean()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
Set when the select is open
This property is synchronized automatically from client side when a 'opened-changed' event happens.
- Returns:
- the
openedproperty from the webcomponent
-
setOpened
@Deprecated protected void setOpened(boolean opened)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
Set when the select is open
- Parameters:
opened- the boolean value to set
-
getErrorMessageString
@Deprecated protected String getErrorMessageString()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
The error message to display when the select value 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
@Deprecated protected void setErrorMessage(String errorMessage)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
The error message to display when the select value is invalid
- Parameters:
errorMessage- the String value to set
-
getLabelString
@Deprecated protected String getLabelString()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
String used for the label 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
@Deprecated protected void setLabel(String label)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
String used for the label element.
- Parameters:
label- the String value to set
-
isRequiredBoolean
@Deprecated protected boolean isRequiredBoolean()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
The current required state of the select. True if 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
@Deprecated protected void setRequired(boolean required)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
The current required state of the select. True if required.
- Parameters:
required- the boolean value to set
-
isInvalidBoolean
@Deprecated protected boolean isInvalidBoolean()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
Set to true if the value 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
invalidproperty from the webcomponent
-
setInvalid
@Deprecated protected void setInvalid(boolean invalid)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
Set to true if the value is invalid.
- Parameters:
invalid- the boolean value to set
-
getNameString
@Deprecated protected String getNameString()
Deprecated.since v23.3, generated classes will be removed in v24.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
@Deprecated protected void setName(String name)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
The name of this element.
- Parameters:
name- the String value to set
-
getPlaceholderString
@Deprecated protected String getPlaceholderString()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
A hint to the user of what can be entered in the control. 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.
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
@Deprecated protected void setPlaceholder(String placeholder)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
A hint to the user of what can be entered in the control. 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.
- Parameters:
placeholder- the String value to set
-
isReadonlyBoolean
@Deprecated protected boolean isReadonlyBoolean()
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
When present, it specifies that the element is read-only.
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
@Deprecated protected void setReadonly(boolean readonly)
Deprecated.since v23.3, generated classes will be removed in v24.Description copied from corresponding location in WebComponent:
When present, it specifies that the element is read-only.
- Parameters:
readonly- the boolean value to set
-
validate
@Deprecated @NotSupported protected void validate()
Deprecated.since v23.3, generated classes will be removed in v24.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.
-
addOpenedChangeListener
@Deprecated protected Registration addOpenedChangeListener(ComponentEventListener<GeneratedVaadinSelect.OpenedChangeEvent<R>> listener)
Deprecated.since v23.3, generated classes will be removed in v24.Adds a listener foropened-changedevents fired by the webcomponent.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
addInvalidChangeListener
@Deprecated protected Registration addInvalidChangeListener(ComponentEventListener<GeneratedVaadinSelect.InvalidChangeEvent<R>> listener)
Deprecated.since v23.3, generated classes will be removed in v24.Adds a listener forinvalid-changedevents fired by the webcomponent.- Parameters:
listener- the listener- Returns:
- a
Registrationfor removing the event listener
-
addToPrefix
@Deprecated protected void addToPrefix(Component... components)
Deprecated.since v23.3, generated classes will be removed in v24.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
@Deprecated protected void remove(Component... components)
Deprecated.since v23.3, generated classes will be removed in v24.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
@Deprecated protected void removeAll()
Deprecated.since v23.3, generated classes will be removed in v24.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.
-
-