public class PasswordField extends GeneratedVaadinPasswordField<PasswordField,String> implements HasSize, HasValidation, HasValueChangeMode, HasPrefixAndSuffix, InputNotifier, KeyNotifier, CompositionNotifier, HasAutocomplete, HasAutocapitalize, HasAutocorrect
vaadin-password-field element.GeneratedVaadinTextField.ChangeEvent<R extends GeneratedVaadinTextField<R,?>>, 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<?>>AUTOCOMPLETE_ATTRIBUTEAUTOCAPITALIZE_ATTRIBUTEAUTOCORRECT_ATTRIBUTE| Constructor and Description |
|---|
PasswordField()
Constructs an empty
PasswordField. |
PasswordField(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<PasswordField,String>> listener)
Constructs an empty
PasswordField with a value change listener. |
PasswordField(String label)
Constructs an empty
PasswordField with the given label. |
PasswordField(String label,
HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<PasswordField,String>> listener)
Constructs an empty
PasswordField with a value change listener
and a label. |
PasswordField(String label,
String placeholder)
Constructs an empty
PasswordField with the given label and
placeholder text. |
PasswordField(String label,
String initialValue,
HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<PasswordField,String>> listener)
Constructs a
PasswordField with a value change listener, a label
and an initial value. |
| 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()
Description copied from corresponding location in WebComponent:
|
int |
getMinLength()
Minimum number of characters (in Unicode code points) that the user can
enter.
|
String |
getPattern()
A regular expression that the value is checked against.
|
String |
getPlaceholder()
A hint to the user of what can be entered in the component.
|
String |
getTitle()
Message to show to the user when validation fails.
|
String |
getValue()
Returns the current value of the password field.
|
ValueChangeMode |
getValueChangeMode()
Gets current value change mode of the component.
|
boolean |
isAutofocus()
Description copied from corresponding location in WebComponent:
|
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.
|
boolean |
isRevealButtonVisible()
Set to
false to hide the eye icon which toggles the password
visibility. |
void |
setAutofocus(boolean autofocus)
Description copied from corresponding location in WebComponent:
|
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 |
setPattern(String pattern)
Description copied from corresponding location in WebComponent:
|
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 |
setRevealButtonVisible(boolean revealButtonVisible)
Set to
false to hide the eye icon which toggles the password
visibility. |
void |
setTitle(String title)
Description copied from corresponding location in WebComponent:
|
void |
setValue(String value)
Sets the value of this password field.
|
void |
setValueChangeMode(ValueChangeMode valueChangeMode)
Sets new value change mode for the component.
|
isPasswordVisibleBoolean, isRevealButtonHiddenBoolean, setRevealButtonHiddenaddChangeListener, addInvalidChangeListener, addToPrefix, addToSuffix, checkValidity, getAutocapitalizeString, getAutocompleteString, getAutocorrectString, getErrorMessageString, getLabelString, getListString, getMaxlengthDouble, getMinlengthDouble, getNameString, getPatternString, getPlaceholderString, getTitleString, isAutofocusBoolean, isDisabledBoolean, isInvalidBoolean, isPreventInvalidInputBoolean, isReadonlyBoolean, isRequiredBoolean, remove, removeAll, setAutocapitalize, setAutocomplete, setAutocorrect, setDisabled, setList, setMaxlength, setMinlength, setName, setReadonly, validatehasValidValue, 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, getWidth, setHeight, setSizeFull, setSizeUndefined, setWidthgetPrefixComponent, getSuffixComponent, setPrefixComponent, setSuffixComponentaddInputListeneraddKeyDownListener, addKeyDownListener, addKeyPressListener, addKeyPressListener, addKeyUpListener, addKeyUpListeneraddCompositionEndListener, addCompositionStartListener, addCompositionUpdateListenergetAutocomplete, setAutocompletegetAutocapitalize, setAutocapitalizeisAutocorrect, setAutocorrectgetElementaddClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameblur, focus, getTabIndex, setTabIndexaddBlurListeneraddFocusListenerisEnabled, setEnabledisReadOnly, isRequiredIndicatorVisible, setReadOnlyclear, getOptionalValueaddAttachListeneraddDetachListenerpublic PasswordField()
PasswordField.public PasswordField(String label)
PasswordField with the given label.label - the text to set as the labelpublic PasswordField(String label, String placeholder)
PasswordField with the given label and
placeholder text.label - the text to set as the labelplaceholder - the placeholder text to setpublic PasswordField(HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<PasswordField,String>> listener)
PasswordField with a value change listener.listener - the value change listenerAbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public PasswordField(String label, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<PasswordField,String>> listener)
PasswordField with a value change listener
and a label.label - the text to set as the labellistener - the value change listenersetLabel(String),
AbstractField.addValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener)public PasswordField(String label, String initialValue, HasValue.ValueChangeListener<? super AbstractField.ComponentValueChangeEvent<PasswordField,String>> listener)
PasswordField with a value change listener, a label
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 String getErrorMessage()
HasValidationgetErrorMessage in interface HasValidationpublic void setErrorMessage(String errorMessage)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
Error to show when the input value is invalid.
setErrorMessage in interface HasValidationsetErrorMessage in class GeneratedVaadinTextField<PasswordField,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)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
This property is set to true when the control value is invalid.
setInvalid in interface HasValidationsetInvalid in class GeneratedVaadinTextField<PasswordField,String>invalid - the boolean value to setpublic void setLabel(String label)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
String used for the label element.
setLabel in class GeneratedVaadinTextField<PasswordField,String>label - the String value to setpublic String getLabel()
label property from the webcomponentpublic void setPlaceholder(String placeholder)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
A hint to the user of what can be entered in the control.
setPlaceholder in class GeneratedVaadinTextField<PasswordField,String>placeholder - the String value to setpublic String getPlaceholder()
placeholder property from the webcomponentpublic void setAutofocus(boolean autofocus)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
Specify that this control should have input focus when the page loads.
setAutofocus in class GeneratedVaadinTextField<PasswordField,String>autofocus - the boolean value to setpublic boolean isAutofocus()
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 webcomponentpublic void setMaxLength(int maxLength)
maxLength - the maximum lengthpublic int getMaxLength()
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 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)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
Specifies that the user must fill in a value.
setRequired in class GeneratedVaadinTextField<PasswordField,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)
GeneratedVaadinTextFieldDescription 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 GeneratedVaadinTextField<PasswordField,String>preventInvalidInput - the boolean value to setpublic void setPattern(String pattern)
GeneratedVaadinTextFieldDescription 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.
setPattern in class GeneratedVaadinTextField<PasswordField,String>pattern - the String value to setpublic String getPattern()
pattern property from the webcomponentpublic String getTitle()
title property from the webcomponentpublic void setTitle(String title)
GeneratedVaadinTextFieldDescription copied from corresponding location in WebComponent:
Message to show to the user when validation fails.
setTitle in class GeneratedVaadinTextField<PasswordField,String>title - the String value to setpublic boolean isRevealButtonVisible()
false to hide the eye icon which toggles the password
visibility.true if the button is visible, false
otherwisepublic void setRevealButtonVisible(boolean revealButtonVisible)
false to hide the eye icon which toggles the password
visibility.revealButtonVisible - true to set the button visible,
false otherwisepublic 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<PasswordField,String>,String>getEmptyValue in class AbstractField<PasswordField,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 password field, as long as no new converter is defined.
setValue in interface HasValue<AbstractField.ComponentValueChangeEvent<PasswordField,String>,String>setValue in class AbstractField<PasswordField,String>value - the new value, not nullpublic String getValue()
getValue in interface HasValue<AbstractField.ComponentValueChangeEvent<PasswordField,String>,String>getValue in class AbstractField<PasswordField,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<PasswordField,String>,String>setRequiredIndicatorVisible in interface HasValueAndElement<AbstractField.ComponentValueChangeEvent<PasswordField,String>,String>requiredIndicatorVisible - true to make the required indicator visible,
false if notCopyright © 2019. All rights reserved.