Class TextFieldBase<TComponent extends TextFieldBase<TComponent,TValue>,TValue>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<TComponent,TValue>
com.vaadin.flow.component.textfield.TextFieldBase<TComponent,TValue>
- Type Parameters:
TComponent
- Type of the component that extends from this classTValue
- Type of the value of the extending component
- All Implemented Interfaces:
AttachNotifier
,BlurNotifier<TComponent>
,CompositionNotifier
,DetachNotifier
,Focusable<TComponent>
,FocusNotifier<TComponent>
,HasElement
,HasEnabled
,HasHelper
,HasLabel
,HasSize
,HasStyle
,HasValidation
,HasValue<AbstractField.ComponentValueChangeEvent<TComponent,
,TValue>, TValue> HasValueAndElement<AbstractField.ComponentValueChangeEvent<TComponent,
,TValue>, TValue> InputNotifier
,KeyNotifier
,HasClearButton
,HasClientValidation
,HasPrefix
,HasSuffix
,HasTooltip
,HasValidationProperties
,HasAutocapitalize
,HasAutocomplete
,HasAutocorrect
,HasPrefixAndSuffix
,HasValidator<TValue>
,HasValueChangeMode
,Serializable
- Direct Known Subclasses:
AbstractNumberField
,BigDecimalField
,EmailField
,PasswordField
,TextArea
,TextField
public abstract class TextFieldBase<TComponent extends TextFieldBase<TComponent,TValue>,TValue>
extends AbstractSinglePropertyField<TComponent,TValue>
implements CompositionNotifier, Focusable<TComponent>, HasAutocapitalize, HasAutocomplete, HasAutocorrect, HasClearButton, HasClientValidation, HasHelper, HasLabel, HasPrefixAndSuffix, HasSize, HasStyle, HasTooltip, HasValidationProperties, HasValidator<TValue>, HasValueChangeMode, InputNotifier, KeyNotifier
Internal class that provides base functionality for input field components,
such as
TextField
. Not intended to be used publicly.- See Also:
-
Nested Class Summary
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.shared.HasClientValidation
HasClientValidation.ClientValidatedEvent
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
-
Field Summary
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocapitalize
AUTOCAPITALIZE_ATTRIBUTE
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
AUTOCOMPLETE_ATTRIBUTE
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
AUTOCORRECT_ATTRIBUTE
Fields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUT
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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'.The placeholder text that should be displayed in the input element, when the user has not entered a valuegetTitle()
The text usually displayed in a tooltip popup when the mouse is over the field.Gets current value change mode of the component.int
Returns the currently set timeout, for how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.boolean
Specify that this control should have input focus when the page loads.boolean
Specifies if the field value gets automatically selected when the field gains focus.boolean
Determines whether the field is marked as input required.void
setAutofocus
(boolean autofocus) Sets the whether the component should automatically receive focus when the page loads.void
setAutoselect
(boolean autoselect) Set totrue
to always have the field value automatically selected when the field gains focus,false
otherwise.void
setPlaceholder
(String placeholder) Sets the placeholder text that should be displayed in the input element, when the user has not entered a valuevoid
setRequired
(boolean required) Specifies that the user must fill in a value.void
The text usually displayed in a tooltip popup when the mouse is over the field.void
setValueChangeMode
(ValueChangeMode valueChangeMode) Sets new value change mode for the component.void
setValueChangeTimeout
(int valueChangeTimeout) Sets how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.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, removeFromParent, scrollIntoView, 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.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListener
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.textfield.HasAutocapitalize
getAutocapitalize, setAutocapitalize
Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
getAutocomplete, setAutocomplete
Methods inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
isAutocorrect, setAutocorrect
Methods inherited from interface com.vaadin.flow.component.shared.HasClearButton
isClearButtonVisible, setClearButtonVisible
Methods inherited from interface com.vaadin.flow.component.shared.HasClientValidation
addClientValidatedEventListener
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.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperText
Methods inherited from interface com.vaadin.flow.component.shared.HasPrefix
getPrefixComponent, setPrefixComponent
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
Methods inherited from interface com.vaadin.flow.component.shared.HasSuffix
getSuffixComponent, setSuffixComponent
Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalid
Methods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListener, getDefaultValidator
Methods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValue
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisible
Methods inherited from interface com.vaadin.flow.component.InputNotifier
addInputListener
Methods inherited from interface com.vaadin.flow.component.KeyNotifier
addKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListener
-
Method Details
-
getValueChangeMode
Gets current value change mode of the component.The default value is
ValueChangeMode.ON_CHANGE
.- Specified by:
getValueChangeMode
in interfaceHasValueChangeMode
- Returns:
- current value change mode of the component, or
null
if the value is not synchronized
-
setValueChangeMode
Description copied from interface:HasValueChangeMode
Sets new value change mode for the component.- Specified by:
setValueChangeMode
in interfaceHasValueChangeMode
- Parameters:
valueChangeMode
- new value change mode, ornull
to disable the value synchronization
-
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout) Description copied from interface:HasValueChangeMode
Sets how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.Implementations should use
ValueChangeMode.applyChangeTimeout(ValueChangeMode, int, DomListenerRegistration)
.- Specified by:
setValueChangeTimeout
in interfaceHasValueChangeMode
- Parameters:
valueChangeTimeout
- the timeout in milliseconds of how oftenHasValue.ValueChangeEvent
s are triggered.
-
getValueChangeTimeout
public int getValueChangeTimeout()Description copied from interface:HasValueChangeMode
Returns the currently set timeout, for how oftenHasValue.ValueChangeEvent
s are triggered when the ValueChangeMode is set toValueChangeMode.LAZY
, orValueChangeMode.TIMEOUT
.- Specified by:
getValueChangeTimeout
in interfaceHasValueChangeMode
- Returns:
- the timeout in milliseconds of how often
HasValue.ValueChangeEvent
s are triggered.
-
setPlaceholder
Sets the placeholder text that should be displayed in the input element, when the user has not entered a value- Parameters:
placeholder
- the placeholder text
-
getPlaceholder
The placeholder text that should be displayed in the input element, when the user has not entered a value- Returns:
- the
placeholder
property from the web component
-
setAutofocus
public void setAutofocus(boolean autofocus) Sets the whether the component should automatically receive focus when the page loads. Defaults tofalse
.- Parameters:
autofocus
-true
component should automatically receive focus
-
isAutofocus
public boolean isAutofocus()Specify that this control should have input focus when the page loads.- Returns:
- the
autofocus
property from the webcomponent
-
getTitle
The text usually displayed in a tooltip popup when the mouse is over the field.- Returns:
- the
title
property from the webcomponent
-
setTitle
The text usually displayed in a tooltip popup when the mouse is over the field.- Parameters:
title
- the String value to set
-
isAutoselect
public boolean isAutoselect()Specifies if the field value gets automatically selected when the field gains focus.- Returns:
true
if autoselect is active,false
otherwise
-
setAutoselect
public void setAutoselect(boolean autoselect) Set totrue
to always have the field value automatically selected when the field gains focus,false
otherwise.- Parameters:
autoselect
-true
to set auto select on,false
otherwise
-
setRequired
public void setRequired(boolean required) Specifies that the user must fill in a value.- Parameters:
required
- the boolean value to set
-
isRequired
public boolean isRequired()Determines whether the field is marked as input required.- Returns:
true
if the input is required,false
otherwise
-
addToPrefix
Adds the given components as children of this component at the slot 'prefix'.- Parameters:
components
- The components to add.- See Also:
-
addToInput
Adds the given components as children of this component at the slot 'input'.- Parameters:
components
- The components to add.- See Also:
-
addToSuffix
Adds the given components as children of this component at the slot 'suffix'.- Parameters:
components
- The components to add.- See Also:
-