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.ClientValidatedEventNested 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_ATTRIBUTEFields inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
AUTOCOMPLETE_ATTRIBUTEFields inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
AUTOCORRECT_ATTRIBUTEFields inherited from interface com.vaadin.flow.data.value.HasValueChangeMode
DEFAULT_CHANGE_TIMEOUT -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToInput(Component... components) Adds the given components as children of this component at the slot 'input'.protected voidaddToPrefix(Component... components) Adds the given components as children of this component at the slot 'prefix'.protected voidaddToSuffix(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.intReturns the currently set timeout, for how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.booleanSpecify that this control should have input focus when the page loads.booleanSpecifies if the field value gets automatically selected when the field gains focus.booleanDetermines whether the field is marked as input required.voidsetAutofocus(boolean autofocus) Sets the whether the component should automatically receive focus when the page loads.voidsetAutoselect(boolean autoselect) Set totrueto always have the field value automatically selected when the field gains focus,falseotherwise.voidsetPlaceholder(String placeholder) Sets the placeholder text that should be displayed in the input element, when the user has not entered a valuevoidsetRequired(boolean required) Specifies that the user must fill in a value.voidThe text usually displayed in a tooltip popup when the mouse is over the field.voidsetValueChangeMode(ValueChangeMode valueChangeMode) Sets new value change mode for the component.voidsetValueChangeTimeout(int valueChangeTimeout) Sets how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEqualsMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.CompositionNotifier
addCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.textfield.HasAutocapitalize
getAutocapitalize, setAutocapitalizeMethods inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
getAutocomplete, setAutocompleteMethods inherited from interface com.vaadin.flow.component.textfield.HasAutocorrect
isAutocorrect, setAutocorrectMethods inherited from interface com.vaadin.flow.component.shared.HasClearButton
isClearButtonVisible, setClearButtonVisibleMethods inherited from interface com.vaadin.flow.component.shared.HasClientValidation
addClientValidatedEventListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.shared.HasPrefix
getPrefixComponent, setPrefixComponentMethods 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, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasSuffix
getSuffixComponent, setSuffixComponentMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListener, getDefaultValidatorMethods inherited from interface com.vaadin.flow.component.HasValue
clear, getOptionalValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setReadOnly, setRequiredIndicatorVisibleMethods inherited from interface com.vaadin.flow.component.InputNotifier
addInputListenerMethods 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:
getValueChangeModein interfaceHasValueChangeMode- Returns:
- current value change mode of the component, or
nullif the value is not synchronized
-
setValueChangeMode
Description copied from interface:HasValueChangeModeSets new value change mode for the component.- Specified by:
setValueChangeModein interfaceHasValueChangeMode- Parameters:
valueChangeMode- new value change mode, ornullto disable the value synchronization
-
setValueChangeTimeout
public void setValueChangeTimeout(int valueChangeTimeout) Description copied from interface:HasValueChangeModeSets how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.Implementations should use
ValueChangeMode.applyChangeTimeout(ValueChangeMode, int, DomListenerRegistration).- Specified by:
setValueChangeTimeoutin interfaceHasValueChangeMode- Parameters:
valueChangeTimeout- the timeout in milliseconds of how oftenHasValue.ValueChangeEvents are triggered.
-
getValueChangeTimeout
public int getValueChangeTimeout()Description copied from interface:HasValueChangeModeReturns the currently set timeout, for how oftenHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set toValueChangeMode.LAZY, orValueChangeMode.TIMEOUT.- Specified by:
getValueChangeTimeoutin interfaceHasValueChangeMode- Returns:
- the timeout in milliseconds of how often
HasValue.ValueChangeEvents 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
placeholderproperty 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-truecomponent should automatically receive focus
-
isAutofocus
public boolean isAutofocus()Specify that this control should have input focus when the page loads.- Returns:
- the
autofocusproperty from the webcomponent
-
getTitle
The text usually displayed in a tooltip popup when the mouse is over the field.- Returns:
- the
titleproperty 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:
trueif autoselect is active,falseotherwise
-
setAutoselect
public void setAutoselect(boolean autoselect) Set totrueto always have the field value automatically selected when the field gains focus,falseotherwise.- Parameters:
autoselect-trueto set auto select on,falseotherwise
-
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:
trueif the input is required,falseotherwise
-
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:
-