public abstract class AbstractLogin extends Component implements HasEnabled
<vaadin-login-overlay>
and
<vaadin-login-form>
components.
On LoginForm.LoginEvent
component becomes disabled.
Disabled component stops to process login events, however
the LoginForm.ForgotPasswordEvent
event is processed anyway.
To enable use the HasEnabled.setEnabled(boolean)
method.
Setting error setError(boolean)
true makes component automatically enabled for
the next login attempt.Modifier and Type | Class and Description |
---|---|
static class |
AbstractLogin.ForgotPasswordEvent
`forgot-password` is fired when the user clicks Forgot password button
|
static class |
AbstractLogin.LoginEvent
`login` is fired when the user either clicks Submit button or presses an Enter key.
|
Constructor and Description |
---|
AbstractLogin()
Initializes a new AbstractLogin with a default localization.
|
AbstractLogin(LoginI18n i18n)
Initializes a new AbstractLogin.
|
Modifier and Type | Method and Description |
---|---|
Registration |
addForgotPasswordListener(ComponentEventListener<AbstractLogin.ForgotPasswordEvent> listener)
Adds `forgotPassword` event listener.
|
Registration |
addLoginListener(ComponentEventListener<AbstractLogin.LoginEvent> listener)
Adds `login` event listener
|
String |
getAction()
Returns the action defined for a login form.
|
boolean |
isError()
Returns whether the error message is displayed or not
|
boolean |
isForgotPasswordButtonVisible()
Returns whether the forgot password button is visible or not
|
void |
onEnabledStateChanged(boolean enabled)
Handle component enable state when the enabled state changes.
|
void |
setAction(String action)
Sets the path where to send the form-data when a form is submitted.
|
void |
setError(boolean error)
Sets whether to show or hide the error message.
|
void |
setForgotPasswordButtonVisible(boolean forgotPasswordButtonVisible)
Sets whether to show or hide the forgot password button.
|
void |
setI18n(LoginI18n i18n)
Sets the internationalized messages to be used by this instance.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, set, setElement, setId, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isEnabled, setEnabled
getElement
addAttachListener
addDetachListener
public AbstractLogin()
public AbstractLogin(LoginI18n i18n)
i18n
- internationalized messages to be used by this instance.public void setAction(String action)
AbstractLogin.LoginEvent
is not fired anymore.getAction()
@Synchronize(property="action", value="action-changed") public String getAction()
public void setError(boolean error)
setI18n(LoginI18n)
Calling this method with true
will also enable the component.error
- true
to show the error message and enable component for next login attempt,
false
to hide an errorisError()
@Synchronize(property="error", value="error-changed") public boolean isError()
public void setForgotPasswordButtonVisible(boolean forgotPasswordButtonVisible)
forgotPasswordButtonVisible
- whether to display or hide the buttonisForgotPasswordButtonVisible()
public boolean isForgotPasswordButtonVisible()
true
if the forgot password button is visible
false
otherwisepublic void setI18n(LoginI18n i18n)
i18n
- the internationalized messagesLoginI18n.createDefault()
public Registration addLoginListener(ComponentEventListener<AbstractLogin.LoginEvent> listener)
public Registration addForgotPasswordListener(ComponentEventListener<AbstractLogin.ForgotPasswordEvent> listener)
HasEnabled.isEnabled()
.public void onEnabledStateChanged(boolean enabled)
Component
By default this sets or removes the 'disabled' attribute from the element. This can be overridden to have custom handling.
onEnabledStateChanged
in class Component
enabled
- the new enabled state of the componentCopyright © 2020. All rights reserved.