Package com.vaadin.flow.component.login
Class AbstractLogin
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.login.AbstractLogin
-
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,Serializable
- Direct Known Subclasses:
LoginForm,LoginOverlay
public abstract class AbstractLogin extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasEnabledAbstract component for the<vaadin-login-overlay>and<vaadin-login-form>components. OnAbstractLogin.LoginEventcomponent becomes disabled. Disabled component stops to process login events, however theAbstractLogin.ForgotPasswordEventevent is processed anyway. To enable use theHasEnabled.setEnabled(boolean)method. Setting errorsetError(boolean)true makes component automatically enabled for the next login attempt.- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractLogin.ForgotPasswordEvent`forgot-password` is fired when the user clicks Forgot password buttonstatic classAbstractLogin.LoginEvent`login` is fired when the user either clicks Submit button or presses an Enter key.
-
Constructor Summary
Constructors Constructor Description AbstractLogin()Initializes a new AbstractLogin with a default localization.AbstractLogin(LoginI18n i18n)Initializes a new AbstractLogin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.vaadin.flow.shared.RegistrationaddForgotPasswordListener(com.vaadin.flow.component.ComponentEventListener<AbstractLogin.ForgotPasswordEvent> listener)Adds `forgotPassword` event listener.com.vaadin.flow.shared.RegistrationaddLoginListener(com.vaadin.flow.component.ComponentEventListener<AbstractLogin.LoginEvent> listener)Adds `login` event listenerStringgetAction()Returns the action defined for a login form.booleanisError()Returns whether the error message is displayed or notbooleanisForgotPasswordButtonVisible()Returns whether the forgot password button is visible or notvoidonEnabledStateChanged(boolean enabled)voidsetAction(String action)Sets the path where to send the form-data when a form is submitted.voidsetError(boolean error)Sets whether to show or hide the error message.voidsetForgotPasswordButtonVisible(boolean forgotPasswordButtonVisible)Sets whether to show or hide the forgot password button.voidsetI18n(LoginI18n i18n)Sets the internationalized messages to be used by this instance.-
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, scrollIntoView, set, setElement, setId, setVisible
-
-
-
-
Constructor Detail
-
AbstractLogin
public AbstractLogin()
Initializes a new AbstractLogin with a default localization.
-
AbstractLogin
public AbstractLogin(LoginI18n i18n)
Initializes a new AbstractLogin.- Parameters:
i18n- internationalized messages to be used by this instance.
-
-
Method Detail
-
setAction
public void setAction(String action)
Sets the path where to send the form-data when a form is submitted. Once action is defined aAbstractLogin.LoginEventis not fired anymore.- See Also:
getAction()
-
getAction
@Synchronize(property="action", value="action-changed") public String getAction()Returns the action defined for a login form.- Returns:
- the value of action property
-
setError
public void setError(boolean error)
Sets whether to show or hide the error message. The message can be set viasetI18n(LoginI18n)Calling this method withtruewill also enable the component.- Parameters:
error-trueto show the error message and enable component for next login attempt,falseto hide an error- See Also:
isError()
-
isError
@Synchronize(property="error", value="error-changed") public boolean isError()Returns whether the error message is displayed or not- Returns:
- the value of error property
-
setForgotPasswordButtonVisible
public void setForgotPasswordButtonVisible(boolean forgotPasswordButtonVisible)
Sets whether to show or hide the forgot password button. The button is visible by default- Parameters:
forgotPasswordButtonVisible- whether to display or hide the button- See Also:
isForgotPasswordButtonVisible()
-
isForgotPasswordButtonVisible
public boolean isForgotPasswordButtonVisible()
Returns whether the forgot password button is visible or not- Returns:
trueif the forgot password button is visiblefalseotherwise
-
setI18n
public void setI18n(LoginI18n i18n)
Sets the internationalized messages to be used by this instance.- Parameters:
i18n- the internationalized messages- See Also:
LoginI18n.createDefault()
-
addLoginListener
public com.vaadin.flow.shared.Registration addLoginListener(com.vaadin.flow.component.ComponentEventListener<AbstractLogin.LoginEvent> listener)
Adds `login` event listener
-
addForgotPasswordListener
public com.vaadin.flow.shared.Registration addForgotPasswordListener(com.vaadin.flow.component.ComponentEventListener<AbstractLogin.ForgotPasswordEvent> listener)
Adds `forgotPassword` event listener. Event continues being process even if the component is notHasEnabled.isEnabled().
-
onEnabledStateChanged
public void onEnabledStateChanged(boolean enabled)
- Overrides:
onEnabledStateChangedin classcom.vaadin.flow.component.Component
-
-