@Tag(value="vaadin-text-field") @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="22.0.21") @NpmPackage(value="@vaadin/text-field",version="22.0.21") @NpmPackage(value="@vaadin/vaadin-text-field",version="22.0.21") @JsModule(value="@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule(value="@vaadin/text-field/src/vaadin-text-field.js") public abstract class GeneratedVaadinTextField<R extends GeneratedVaadinTextField<R,T>,T> extends AbstractSinglePropertyField<R,T> implements HasStyle, Focusable<R>, HasTheme
Description copied from corresponding location in WebComponent:
<vaadin-text-field>
is a Web Component for text field control in
forms.
<vaadin-text-field label="First Name"> </vaadin-text-field>
These are child elements of a <vaadin-text-field>
that are displayed
inline with the input, before or after. In order for an element to be
considered as a prefix, it must have the slot attribute set to prefix
(and similarly for suffix
).
<vaadin-text-field label="Email address"> <div slot="prefix">Sent to:</div> <div slot="suffix">@vaadin.com</div> </vaadin-text-area>
The following custom properties are available for styling:
Custom property | Description | Default |
---|---|---|
--vaadin-text-field-default-width |
Set the default width of the input field | 12em |
The following shadow DOM parts are available for styling:
Part name | Description |
---|---|
label |
The label element |
input-field |
The element that wraps prefix, value and suffix |
value |
The text value element inside the input-field element |
error-message |
The error message element |
The following state attributes are available for styling:
Attribute | Description | Part name |
---|---|---|
disabled |
Set to a disabled text field | :host |
has-value |
Set when the element has a value | :host |
has-label |
Set when the element has a label | :host |
invalid |
Set when the element is invalid | :host |
input-prevented |
Temporarily set when invalid input is prevented | :host |
focused |
Set when the element is focused | :host |
focus-ring |
Set when the element is keyboard focused | :host |
readonly |
Set to a readonly text field | :host |
Modifier and Type | Class and Description |
---|---|
static class |
GeneratedVaadinTextField.ChangeEvent<R extends GeneratedVaadinTextField<R,?>> |
static class |
GeneratedVaadinTextField.InvalidChangeEvent<R extends GeneratedVaadinTextField<R,?>> |
AbstractField.ComponentValueChangeEvent<C extends Component,V>
BlurNotifier.BlurEvent<C extends Component>
FocusNotifier.FocusEvent<C extends Component>
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
Constructor and Description |
---|
GeneratedVaadinTextField()
Default constructor.
|
GeneratedVaadinTextField(T initialValue,
T defaultValue,
boolean acceptNullValues)
Constructs a new GeneratedVaadinTextField component with the given
arguments.
|
GeneratedVaadinTextField(T initialValue,
T defaultValue,
boolean acceptNullValues,
boolean isInitialValueOptional)
Constructs a new GeneratedVaadinTextField component with the given
arguments.
|
GeneratedVaadinTextField(T initialValue,
T defaultValue,
Class<P> elementPropertyType,
SerializableBiFunction<R,P,T> presentationToModel,
SerializableBiFunction<R,T,P> modelToPresentation)
Constructs a new GeneratedVaadinTextField component with the given
arguments.
|
GeneratedVaadinTextField(T initialValue,
T defaultValue,
Class<P> elementPropertyType,
SerializableBiFunction<R,P,T> presentationToModel,
SerializableBiFunction<R,T,P> modelToPresentation,
boolean isInitialValueOptional)
Constructs a new GeneratedVaadinTextField component with the given
arguments.
|
GeneratedVaadinTextField(T initialValue,
T defaultValue,
Class<P> elementPropertyType,
SerializableFunction<P,T> presentationToModel,
SerializableFunction<T,P> modelToPresentation)
Constructs a new GeneratedVaadinTextField component with the given
arguments.
|
GeneratedVaadinTextField(T initialValue,
T defaultValue,
Class<P> elementPropertyType,
SerializableFunction<P,T> presentationToModel,
SerializableFunction<T,P> modelToPresentation,
boolean isInitialValueOptional)
Constructs a new GeneratedVaadinTextField component with the given
arguments.
|
Modifier and Type | Method and Description |
---|---|
protected Registration |
addChangeListener(ComponentEventListener<GeneratedVaadinTextField.ChangeEvent<R>> listener)
Adds a listener for
change events fired by the webcomponent. |
protected Registration |
addInvalidChangeListener(ComponentEventListener<GeneratedVaadinTextField.InvalidChangeEvent<R>> listener)
Adds a listener for
invalid-changed events fired by the
webcomponent. |
void |
addThemeVariants(TextFieldVariant... variants)
Adds theme variants to the component.
|
protected void |
addToInput(Component... components)
Adds the given components as children of this component at the slot
'input'.
|
protected void |
addToPrefix(Component... components)
Adds the given components as children of this component at the slot
'prefix'.
|
protected void |
addToSuffix(Component... components)
Adds the given components as children of this component at the slot
'suffix'.
|
protected void |
checkValidity()
Description copied from corresponding location in WebComponent:
|
protected String |
getAutocapitalizeString()
Description copied from corresponding location in WebComponent:
|
protected String |
getAutocompleteString()
Description copied from corresponding location in WebComponent:
|
protected String |
getAutocorrectString()
Description copied from corresponding location in WebComponent:
|
protected String |
getErrorMessageString()
Description copied from corresponding location in WebComponent:
|
protected String |
getLabelString()
Description copied from corresponding location in WebComponent:
|
protected String |
getListString()
Description copied from corresponding location in WebComponent:
|
protected double |
getMaxlengthDouble()
Description copied from corresponding location in WebComponent:
|
protected double |
getMinlengthDouble()
Description copied from corresponding location in WebComponent:
|
protected String |
getNameString()
Description copied from corresponding location in WebComponent:
|
protected String |
getPatternString()
Description copied from corresponding location in WebComponent:
|
protected String |
getPlaceholderString()
Description copied from corresponding location in WebComponent:
|
protected String |
getTitleString()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isAutofocusBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isAutoselectBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isClearButtonVisibleBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isDisabledBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isInvalidBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isPreventInvalidInputBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isReadonlyBoolean()
Description copied from corresponding location in WebComponent:
|
protected boolean |
isRequiredBoolean()
Description copied from corresponding location in WebComponent:
|
protected void |
remove(Component... components)
Removes the given child components from this component.
|
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 the
Element API. |
void |
removeThemeVariants(TextFieldVariant... variants)
Removes theme variants from the component.
|
protected void |
setAutocapitalize(String autocapitalize)
Description copied from corresponding location in WebComponent:
|
protected void |
setAutocomplete(String autocomplete)
Description copied from corresponding location in WebComponent:
|
protected void |
setAutocorrect(String autocorrect)
Description copied from corresponding location in WebComponent:
|
protected void |
setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:
|
protected void |
setAutoselect(boolean autoselect)
Description copied from corresponding location in WebComponent:
|
protected void |
setClearButtonVisible(boolean clearButtonVisible)
Description copied from corresponding location in WebComponent:
|
protected void |
setDisabled(boolean disabled)
Description copied from corresponding location in WebComponent:
|
protected void |
setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
|
protected void |
setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
|
protected void |
setLabel(String label)
Description copied from corresponding location in WebComponent:
|
protected void |
setList(String list)
Description copied from corresponding location in WebComponent:
|
protected void |
setMaxlength(double maxlength)
Description copied from corresponding location in WebComponent:
|
protected void |
setMinlength(double minlength)
Description copied from corresponding location in WebComponent:
|
protected void |
setName(String name)
Description copied from corresponding location in WebComponent:
|
protected void |
setPattern(String pattern)
Description copied from corresponding location in WebComponent:
|
protected void |
setPlaceholder(String placeholder)
Description copied from corresponding location in WebComponent:
|
protected void |
setPreventInvalidInput(boolean preventInvalidInput)
Description copied from corresponding location in WebComponent:
|
protected void |
setReadonly(boolean readonly)
Description copied from corresponding location in WebComponent:
|
protected void |
setRequired(boolean required)
Description copied from corresponding location in WebComponent:
|
protected void |
setTitle(String title)
Description copied from corresponding location in WebComponent:
|
protected void |
validate()
Description copied from corresponding location in WebComponent:
|
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEvent
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
addFocusShortcut, blur, focus, getTabIndex, setTabIndex
addBlurListener
addFocusListener
isEnabled, setEnabled
getElement
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
clear, getOptionalValue
addAttachListener
addDetachListener
public GeneratedVaadinTextField(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableFunction<P,T> presentationToModel, SerializableFunction<T,P> modelToPresentation)
P
- the property typeinitialValue
- 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 valuepublic GeneratedVaadinTextField(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableFunction<P,T> presentationToModel, SerializableFunction<T,P> modelToPresentation, boolean isInitialValueOptional)
If isInitialValueOptional
is true
then 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.
P
- the property typeinitialValue
- 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 valueisInitialValueOptional
- if isInitialValueOptional
is true
then the
initial value is used only if element has no "value"
property value, otherwise element "value"
property is
ignored and the initial value is setpublic GeneratedVaadinTextField(T initialValue, T defaultValue, boolean acceptNullValues)
initialValue
- the initial value to set to the valuedefaultValue
- the default value to use if the value isn't definedacceptNullValues
- whether null
is accepted as a model valuepublic GeneratedVaadinTextField(T initialValue, T defaultValue, boolean acceptNullValues, boolean isInitialValueOptional)
If isInitialValueOptional
is true
then 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.
initialValue
- the initial value to set to the valuedefaultValue
- the default value to use if the value isn't definedacceptNullValues
- whether null
is accepted as a model valueisInitialValueOptional
- if isInitialValueOptional
is true
then the
initial value is used only if element has no "value"
property value, otherwise element "value"
property is
ignored and the initial value is setpublic GeneratedVaadinTextField(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableBiFunction<R,P,T> presentationToModel, SerializableBiFunction<R,T,P> modelToPresentation)
P
- the property typeinitialValue
- 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 valuepublic GeneratedVaadinTextField(T initialValue, T defaultValue, Class<P> elementPropertyType, SerializableBiFunction<R,P,T> presentationToModel, SerializableBiFunction<R,T,P> modelToPresentation, boolean isInitialValueOptional)
If isInitialValueOptional
is true
then 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.
P
- the property typeinitialValue
- 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
- if isInitialValueOptional
is true
then the
initial value is used only if element has no "value"
property value, otherwise element "value"
property is
ignored and the initial value is setpublic GeneratedVaadinTextField()
public void addThemeVariants(TextFieldVariant... variants)
variants
- theme variants to addpublic void removeThemeVariants(TextFieldVariant... variants)
variants
- theme variants to removeprotected boolean isAutofocusBoolean()
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.
autofocus
property from the webcomponentprotected void setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
autofocus
- the boolean value to setprotected boolean isDisabledBoolean()
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.
disabled
property from the webcomponentprotected void setDisabled(boolean disabled)
Description copied from corresponding location in WebComponent:
If true, the user cannot interact with this element.
disabled
- the boolean value to setprotected String getAutocompleteString()
Description copied from corresponding location in WebComponent:
Whether the value of the control can be automatically completed by the browser. List of available options at: https://developer.mozilla.org/en/docs /Web/HTML/Element/input#attr-autocomplete
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
autocomplete
property from the webcomponentprotected void setAutocomplete(String autocomplete)
Description copied from corresponding location in WebComponent:
Whether the value of the control can be automatically completed by the browser. List of available options at: https://developer.mozilla.org/en/docs /Web/HTML/Element/input#attr-autocomplete
autocomplete
- the String value to setprotected String getAutocorrectString()
Description copied from corresponding location in WebComponent:
This is a property supported by Safari that is used to control whether autocorrection should be enabled when the user is entering/editing the text. Possible values are: on: Enable autocorrection. off: Disable autocorrection.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
autocorrect
property from the webcomponentprotected void setAutocorrect(String autocorrect)
Description copied from corresponding location in WebComponent:
This is a property supported by Safari that is used to control whether autocorrection should be enabled when the user is entering/editing the text. Possible values are: on: Enable autocorrection. off: Disable autocorrection.
autocorrect
- the String value to setprotected String getAutocapitalizeString()
Description copied from corresponding location in WebComponent:
This is a property supported by Safari and Chrome that is used to control whether autocapitalization should be enabled when the user is entering/editing the text. Possible values are: characters: Characters capitalization. words: Words capitalization. sentences: Sentences capitalization. none: No capitalization.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
autocapitalize
property from the webcomponentprotected void setAutocapitalize(String autocapitalize)
Description copied from corresponding location in WebComponent:
This is a property supported by Safari and Chrome that is used to control whether autocapitalization should be enabled when the user is entering/editing the text. Possible values are: characters: Characters capitalization. words: Words capitalization. sentences: Sentences capitalization. none: No capitalization.
autocapitalize
- the String value to setprotected boolean isAutoselectBoolean()
Description copied from corresponding location in WebComponent:
Specify that the value should be automatically selected when the field gains focus.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
autoselect
property from the webcomponentprotected void setAutoselect(boolean autoselect)
Description copied from corresponding location in WebComponent:
Specify that the value should be automatically selected when the field gains focus.
autoselect
- the boolean value to setprotected boolean isClearButtonVisibleBoolean()
Description copied from corresponding location in WebComponent:
Set to true to display the clear icon which clears the input.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
clearButtonVisible
property from the webcomponentprotected void setClearButtonVisible(boolean clearButtonVisible)
Description copied from corresponding location in WebComponent:
Set to true to display the clear icon which clears the input.
clearButtonVisible
- the boolean value to setprotected String getErrorMessageString()
Description copied from corresponding location in WebComponent:
Error to show when the input 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.
errorMessage
property from the webcomponentprotected void setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
Error to show when the input value is invalid.
errorMessage
- the String value to setprotected String getLabelString()
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.
label
property from the webcomponentprotected void setLabel(String label)
Description copied from corresponding location in WebComponent:
String used for the label element.
label
- the String value to setprotected double getMaxlengthDouble()
Description copied from corresponding location in WebComponent:
Maximum number of characters (in Unicode code points) that the user can enter.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
maxlength
property from the webcomponentprotected void setMaxlength(double maxlength)
Description copied from corresponding location in WebComponent:
Maximum number of characters (in Unicode code points) that the user can enter.
maxlength
- the double value to setprotected double getMinlengthDouble()
Description copied from corresponding location in WebComponent:
Minimum number of characters (in Unicode code points) that the user can enter.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
minlength
property from the webcomponentprotected void setMinlength(double minlength)
Description copied from corresponding location in WebComponent:
Minimum number of characters (in Unicode code points) that the user can enter.
minlength
- the double value to setprotected String getNameString()
Description copied from corresponding location in WebComponent:
The name of the control, which is submitted with the form data.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
name
property from the webcomponentprotected void setName(String name)
Description copied from corresponding location in WebComponent:
The name of the control, which is submitted with the form data.
name
- the String value to setprotected String getPlaceholderString()
Description copied from corresponding location in WebComponent:
A hint to the user of what can be entered in the control.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
placeholder
property from the webcomponentprotected void setPlaceholder(String placeholder)
Description copied from corresponding location in WebComponent:
A hint to the user of what can be entered in the control.
placeholder
- the String value to setprotected boolean isReadonlyBoolean()
Description copied from corresponding location in WebComponent:
This attribute indicates that the user cannot modify the value of the control.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
readonly
property from the webcomponentprotected void setReadonly(boolean readonly)
Description copied from corresponding location in WebComponent:
This attribute indicates that the user cannot modify the value of the control.
readonly
- the boolean value to setprotected boolean isRequiredBoolean()
Description copied from corresponding location in WebComponent:
Specifies that the user must fill in a value.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
required
property from the webcomponentprotected void setRequired(boolean required)
Description copied from corresponding location in WebComponent:
Specifies that the user must fill in a value.
required
- the boolean value to setprotected boolean isInvalidBoolean()
Description copied from corresponding location in WebComponent:
This property is set to true when the control value is invalid.
invalid
property from the webcomponentprotected void setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
This property is set to true when the control value is invalid.
invalid
- the boolean value to setprotected boolean isPreventInvalidInputBoolean()
Description copied from corresponding location in WebComponent:
When set to true, user is prevented from typing a value that conflicts
with the given pattern
, maxlength
or minlength
properties.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
preventInvalidInput
property from the webcomponentprotected void setPreventInvalidInput(boolean preventInvalidInput)
Description copied from corresponding location in WebComponent:
When set to true, user is prevented from typing a value that conflicts
with the given pattern
, maxlength
or minlength
properties.
preventInvalidInput
- the boolean value to setprotected String getListString()
Description copied from corresponding location in WebComponent:
Identifies a list of pre-defined options to suggest to the user. The value must be the id of a
list
property from the webcomponentprotected void setList(String list)
Description copied from corresponding location in WebComponent:
Identifies a list of pre-defined options to suggest to the user. The value must be the id of a
list
- the String value to setprotected String getPatternString()
Description copied from corresponding location in WebComponent:
A regular expression that the value is checked against. The pattern must match the entire value, not just some subset.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
pattern
property from the webcomponentprotected void setPattern(String pattern)
Description copied from corresponding location in WebComponent:
A regular expression that the value is checked against. The pattern must match the entire value, not just some subset.
pattern
- the String value to setprotected String getTitleString()
Description copied from corresponding location in WebComponent:
Message to show to the user when validation fails.
This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.
title
property from the webcomponentprotected void setTitle(String title)
Description copied from corresponding location in WebComponent:
The text usually displayed in a tooltip popup when the mouse is over the field.
title
- the String value to set@NotSupported protected void checkValidity()
Description copied from corresponding location in WebComponent:
Returns true if the current input value satisfies all constraints (if any)
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.
@NotSupported protected void validate()
Description copied from corresponding location in WebComponent:
Returns true if value
is valid. <iron-form>
uses this to
check the validity or all its elements.
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.
protected Registration addChangeListener(ComponentEventListener<GeneratedVaadinTextField.ChangeEvent<R>> listener)
change
events fired by the webcomponent.listener
- the listenerRegistration
for removing the event listenerprotected Registration addInvalidChangeListener(ComponentEventListener<GeneratedVaadinTextField.InvalidChangeEvent<R>> listener)
invalid-changed
events fired by the
webcomponent.listener
- the listenerRegistration
for removing the event listenerprotected void addToPrefix(Component... components)
components
- The components to add.protected void addToInput(Component... components)
components
- The components to add.protected void addToSuffix(Component... components)
components
- The components to add.protected void remove(Component... components)
components
- The components to remove.IllegalArgumentException
- if any of the components is not a child of this component.protected void removeAll()
Element
API.Copyright © 2022. All rights reserved.