public class TextArea extends GeneratedVaadinTextArea<TextArea,String> implements HasSize, HasValidation, HasValueChangeMode, HasPrefixAndSuffix, InputNotifier, KeyNotifier, CompositionNotifier, HasAutocomplete, HasAutocapitalize, HasAutocorrect
vaadin-text-area element.GeneratedVaadinTextArea.ChangeEvent<R extends GeneratedVaadinTextArea<R,?>>, GeneratedVaadinTextArea.InvalidChangeEvent<R extends GeneratedVaadinTextArea<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<?>>DEFAULT_CHANGE_TIMEOUTAUTOCOMPLETE_ATTRIBUTEAUTOCAPITALIZE_ATTRIBUTEAUTOCORRECT_ATTRIBUTE| Constructor and Description |
|---|
TextArea()
Constructs an empty
TextArea. |
TextArea(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<TextArea,String>> listener)
Constructs an empty
TextArea with a value change listener. |
TextArea(String label)
Constructs an empty
TextArea with the given label. |
TextArea(String label,
HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<TextArea,String>> listener)
Constructs an empty
TextArea with a label and a value change
listener. |
TextArea(String label,
String placeholder)
Constructs an empty
TextArea with the given label and placeholder
text. |
TextArea(String label,
String initialValue,
HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<TextArea,String>> listener)
Constructs an empty
TextArea with a label, a value change
listener and an initial value. |
TextArea(String label,
String initialValue,
String placeholder)
Constructs a
TextArea with the given label, an initial value and
placeholder text. |
| Modifier and Type | Method and Description |
|---|---|
String |
getEmptyValue()
Returns the value that represents an empty value.
|
String |
getErrorMessage()
Gets current error message from the component.
|
String |
getLabel()
String used for the label element.
|
int |
getMaxLength()
Maximum number of characters (in Unicode code points) that the user can
enter.
|
int |
getMinLength()
Minimum number of characters (in Unicode code points) that the user can
enter.
|
String |
getPlaceholder()
A hint to the user of what can be entered in the component.
|
String |
getValue()
Returns the current value of the text area.
|
ValueChangeMode |
getValueChangeMode()
Gets current value change mode of the component.
|
int |
getValueChangeTimeout()
Returns the currently set timeout, for how often
HasValue.ValueChangeEvents are triggered when the ValueChangeMode is set
to ValueChangeMode.LAZY, or ValueChangeMode.TIMEOUT. |
boolean |
isAutofocus()
Specify that this control should have input focus when the page loads.
|
boolean |
isAutoselect()
Specifies if the field value gets automatically selected when
the field gains focus.
|
boolean |
isClearButtonVisible()
Gets the visibility state of the button which clears the text
area.
|
boolean |
isInvalid()
Returns
true if component input is invalid, false
otherwise. |
boolean |
isPreventInvalidInput()
When set to
true, user is prevented from typing a value that
conflicts with the given pattern. |
boolean |
isRequired()
Specifies that the user must fill in a value.
|
void |
setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:
|
void |
setAutoselect(boolean autoselect)
Set to
true to always have the field value automatically
selected when the field gains focus, false otherwise. |
void |
setClearButtonVisible(boolean clearButtonVisible)
Set to
false to hide the clear button which clears the text
area. |
void |
setErrorMessage(String errorMessage)
Description copied from corresponding location in WebComponent:
|
void |
setInvalid(boolean invalid)
Description copied from corresponding location in WebComponent:
|
void |
setLabel(String label)
Description copied from corresponding location in WebComponent:
|
void |
setMaxLength(int maxLength)
Maximum number of characters (in Unicode code points) that the user can
enter.
|
void |
setMinLength(int minLength)
Minimum number of characters (in Unicode code points) that the user can
enter.
|
void |
setPlaceholder(String placeholder)
Description copied from corresponding location in WebComponent:
|
void |
setPreventInvalidInput(boolean preventInvalidInput)
Description copied from corresponding location in WebComponent:
|
void |
setRequired(boolean required)
Description copied from corresponding location in WebComponent:
|
void |
setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
Sets the required indicator visible or not.
|
void |
setValue(String value)
Sets the value of this text area.
|
void |
setValueChangeMode(ValueChangeMode valueChangeMode)
Sets new value change mode for the component.
|
void |
setValueChangeTimeout(int valueChangeTimeout)
Sets how often
HasValue.ValueChangeEvents are triggered when the
ValueChangeMode is set to ValueChangeMode.LAZY, or
ValueChangeMode.TIMEOUT. |
protected void |
validate()
Performs server-side validation of the current value.
|
addChangeListener, addInvalidChangeListener, addThemeVariants, addToPrefix, addToSuffix, addToTextarea, checkValidity, getAutocapitalizeString, getAutocompleteString, getAutocorrectString, getErrorMessageString, getLabelString, getMaxlengthDouble, getMinlengthDouble, getNameString, getPlaceholderString, isAutofocusBoolean, isAutoselectBoolean, isClearButtonVisibleBoolean, isDisabledBoolean, isInvalidBoolean, isPreventInvalidInputBoolean, isReadonlyBoolean, isRequiredBoolean, remove, removeAll, removeThemeVariants, setAutocapitalize, setAutocomplete, setAutocorrect, setDisabled, setMaxlength, setMinlength, setName, setReadonlygetSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventaddValueChangeListener, isEmpty, setModelValue, valueEqualsaddListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFullgetPrefixComponent, getSuffixComponent, setPrefixComponent, setSuffixComponentaddInputListeneraddKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListeneraddCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenergetAutocomplete, setAutocompletegetAutocapitalize, setAutocapitalizeisAutocorrect, setAutocorrectgetElementaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameaddFocusShortcut, blur, focus, getTabIndex, setTabIndexaddBlurListeneraddFocusListenerisEnabled, setEnabledaddThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameisReadOnly, isRequiredIndicatorVisible, setReadOnlyclear, getOptionalValueaddAttachListeneraddDetachListenerpublic TextArea()
TextArea.public TextArea(String label)
TextArea with the given label.label - the text to set as the labelpublic TextArea(String label, String placeholder)
TextArea with the given label and placeholder
text.label - the text to set as the labelplaceholder - the placeholder text to setpublic TextArea(String label, String initialValue, String placeholder)
TextArea with the given label, an initial value and
placeholder text.label - the text to set as the labelinitialValue - the initial valueplaceholder - the placeholder text to setAbstractField.setValue(Object),
setPlaceholder(String)public TextArea(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<TextArea,String>> listener)
TextArea with a value change listener.listener - the value change listenerAbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public TextArea(String label, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<TextArea,String>> listener)
TextArea with a label and a value change
listener.label - the text to set as the labellistener - the value change listenersetLabel(String),
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public TextArea(String label, String initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<TextArea,String>> listener)
TextArea with a label, a value change
listener and an initial value.label - the text to set as the labelinitialValue - the initial valuelistener - the value change listenersetLabel(String),
AbstractField.setValue(Object),
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public ValueChangeMode getValueChangeMode()
The default value is ValueChangeMode.ON_CHANGE.
getValueChangeMode in interface HasValueChangeModenull if
the value is not synchronizedpublic void setValueChangeMode(ValueChangeMode valueChangeMode)
HasValueChangeModesetValueChangeMode in interface HasValueChangeModevalueChangeMode - new value change mode, or null to disable the value
synchronizationpublic void setValueChangeTimeout(int valueChangeTimeout)
HasValueChangeModeHasValue.ValueChangeEvents are triggered when the
ValueChangeMode is set to ValueChangeMode.LAZY, or
ValueChangeMode.TIMEOUT.
Implementations should use
ValueChangeMode.applyChangeTimeout(ValueChangeMode, int, DomListenerRegistration).
setValueChangeTimeout in interface HasValueChangeModevalueChangeTimeout - the timeout in milliseconds of how often
HasValue.ValueChangeEvents are triggered.public int getValueChangeTimeout()
HasValueChangeModeHasValue.ValueChangeEvents are triggered when the ValueChangeMode is set
to ValueChangeMode.LAZY, or ValueChangeMode.TIMEOUT.getValueChangeTimeout in interface HasValueChangeModeHasValue.ValueChangeEvents are triggered.public String getErrorMessage()
HasValidationgetErrorMessage in interface HasValidationpublic void setErrorMessage(String errorMessage)
GeneratedVaadinTextAreaDescription copied from corresponding location in WebComponent:
Error to show when the input value is invalid.
setErrorMessage in interface HasValidationsetErrorMessage in class GeneratedVaadinTextArea<TextArea,String>errorMessage - the String value to setpublic boolean isInvalid()
HasValidationtrue if component input is invalid, false
otherwise.isInvalid in interface HasValidationpublic void setInvalid(boolean invalid)
GeneratedVaadinTextAreaDescription copied from corresponding location in WebComponent:
This property is set to true when the control value is invalid.
setInvalid in interface HasValidationsetInvalid in class GeneratedVaadinTextArea<TextArea,String>invalid - the boolean value to setpublic void setLabel(String label)
GeneratedVaadinTextAreaDescription copied from corresponding location in WebComponent:
String used for the label element.
setLabel in class GeneratedVaadinTextArea<TextArea,String>label - the String value to setpublic String getLabel()
label property from the webcomponentpublic void setPlaceholder(String placeholder)
GeneratedVaadinTextAreaDescription copied from corresponding location in WebComponent:
A hint to the user of what can be entered in the control.
setPlaceholder in class GeneratedVaadinTextArea<TextArea,String>placeholder - the String value to setpublic String getPlaceholder()
placeholder property from the webcomponentpublic boolean isAutoselect()
true if autoselect is active, false
otherwisepublic void setAutoselect(boolean autoselect)
true to always have the field value automatically
selected when the field gains focus, false otherwise.setAutoselect in class GeneratedVaadinTextArea<TextArea,String>autoselect - true to set auto select on,
false otherwisepublic boolean isClearButtonVisible()
true if the button is visible, false
otherwisepublic void setClearButtonVisible(boolean clearButtonVisible)
false to hide the clear button which clears the text
area.setClearButtonVisible in class GeneratedVaadinTextArea<TextArea,String>clearButtonVisible - true to set the button visible,
false otherwisepublic void setAutofocus(boolean autofocus)
GeneratedVaadinTextAreaDescription copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
setAutofocus in class GeneratedVaadinTextArea<TextArea,String>autofocus - the boolean value to setpublic boolean isAutofocus()
autofocus property from the webcomponentpublic void setMaxLength(int maxLength)
maxLength - the maximum lengthpublic int getMaxLength()
maxlength property from the webcomponentpublic void setMinLength(int minLength)
minLength - the minimum lengthpublic int getMinLength()
minlength property from the webcomponentpublic boolean isRequired()
required property from the webcomponentpublic void setRequired(boolean required)
GeneratedVaadinTextAreaDescription copied from corresponding location in WebComponent:
Specifies that the user must fill in a value.
setRequired in class GeneratedVaadinTextArea<TextArea,String>required - the boolean value to setpublic boolean isPreventInvalidInput()
true, user is prevented from typing a value that
conflicts with the given pattern.preventInvalidInput property from the webcomponentpublic void setPreventInvalidInput(boolean preventInvalidInput)
GeneratedVaadinTextAreaDescription copied from corresponding location in WebComponent:
When set to true, user is prevented from typing a value that conflicts
with the given pattern.
setPreventInvalidInput in class GeneratedVaadinTextArea<TextArea,String>preventInvalidInput - the boolean value to setpublic String getEmptyValue()
HasValue
By default HasValue is expected to support null as empty
values. Specific implementations might not support this.
getEmptyValue in interface HasValue<AbstractField.ComponentValueChangeEvent<TextArea,String>,String>getEmptyValue in class AbstractField<TextArea,String>public void setValue(String value)
getValue(), fires a value change event. Throws
NullPointerException, if the value is null.
Note: Binder will take care of the null conversion when
integrates with text area, as long as no new converter is defined.
setValue in interface HasValue<AbstractField.ComponentValueChangeEvent<TextArea,String>,String>setValue in class AbstractField<TextArea,String>value - the new value, not nullpublic String getValue()
getValue in interface HasValue<AbstractField.ComponentValueChangeEvent<TextArea,String>,String>getValue in class AbstractField<TextArea,String>public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible)
HasValueIf set visible, it is visually indicated in the user interface.
The method is intended to be used with Binder which does
server-side validation. In case HTML element has its own (client-side)
validation it should be disabled when
setRequiredIndicatorVisible(true) is called and re-enabled
back on setRequiredIndicatorVisible(false). It's
responsibility of each component implementation to follow the contract so
that the method call doesn't do anything else than show/hide the
"required" indication. Usually components provide their own
setRequired method which should be called in case the
client-side validation is required.
setRequiredIndicatorVisible in interface HasValue<AbstractField.ComponentValueChangeEvent<TextArea,String>,String>setRequiredIndicatorVisible in interface HasValueAndElement<AbstractField.ComponentValueChangeEvent<TextArea,String>,String>requiredIndicatorVisible - true to make the required indicator visible,
false if notprotected void validate()
validate in class GeneratedVaadinTextArea<TextArea,String>Copyright © 2020. All rights reserved.