public class LoginForm extends AbstractSingleComponentContainer
createContent(com.vaadin.ui.TextField, com.vaadin.ui.PasswordField, com.vaadin.ui.Button)
method to build the layout using the text fields and login button that are
passed to that method. The supplied components are specially treated so that
they work with password managers.
To customize the fields or to replace them with your own implementations, you
can override createUsernameField(), createPasswordField()
and createLoginButton(). These methods are called automatically and
cannot be called by your code. Captions can be reset by overriding
getUsernameCaption(), getPasswordCaption() and
getLoginButtonCaption().
Note that the API of LoginForm changed significantly in Vaadin 7.7.
| Modifier and Type | Class and Description |
|---|---|
static class |
LoginForm.LoginEvent
Event sent when the login form is submitted.
|
static interface |
LoginForm.LoginListener
Listener triggered when a login occurs in a
LoginForm. |
HasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListenerComponent.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.UnitDESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
LoginForm() |
| Modifier and Type | Method and Description |
|---|---|
Registration |
addLoginListener(LoginForm.LoginListener listener)
Adds a
LoginForm.LoginListener. |
void |
attach()
Notifies the connector that it is connected to a VaadinSession (and
therefore also to a UI).
|
protected Component |
createContent(TextField userNameField,
PasswordField passwordField,
Button loginButton)
Create the content for the login form with the supplied user name field,
password field and the login button.
|
protected Button |
createLoginButton()
Customize the login button.
|
protected PasswordField |
createPasswordField()
Customize the password field.
|
protected TextField |
createUsernameField()
Customize the user name field.
|
String |
getLoginButtonCaption()
Gets the caption set with
setLoginButtonCaption(String). |
String |
getPasswordCaption()
Gets the caption set with
setPasswordCaption(String). |
protected LoginFormState |
getState()
Returns the shared state bean with information to be sent from the server
to the client.
|
protected LoginFormState |
getState(boolean markAsDirty)
Returns the shared state for this connector.
|
String |
getUsernameCaption()
Gets the caption set with
setUsernameCaption(String). |
void |
removeLoginListener(LoginForm.LoginListener listener)
Deprecated.
As of 8.0, replaced by
Registration.remove() in the
registration object returned from
addLoginListener(LoginListener). |
void |
setLoginButtonCaption(String loginButtonCaption)
Sets the caption of the login button.
|
void |
setPasswordCaption(String passwordCaption)
Set the caption of the password field.
|
void |
setUsernameCaption(String usernameCaption)
Sets the caption of the user name field.
|
addComponentAttachListener, addComponentDetachListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentCount, getContent, iterator, readDesign, readDesignChildren, removeComponentAttachListener, removeComponentDetachListener, removeFromParent, setContent, setHeight, setWidth, writeDesignaddContextClickListener, addListener, addShortcutListener, addStyleName, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthUndefinedaddAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddListener, addStyleName, addStyleNames, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisibleaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdgetHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthUndefinedforEach, spliteratorprotected TextField createUsernameField()
public String getUsernameCaption()
setUsernameCaption(String). Note that
this method might not match what is shown to the user if
createUsernameField() has been overridden.public void setUsernameCaption(String usernameCaption)
As an alternative to calling this method, the method
createUsernameField() can be overridden.
usernameCaption - the caption to set for the user name fieldprotected PasswordField createPasswordField()
public String getPasswordCaption()
setPasswordCaption(String). Note that
this method might not match what is shown to the user if
createPasswordField() has been overridden.public void setPasswordCaption(String passwordCaption)
As an alternative to calling this method, the method
createPasswordField() can be overridden.
passwordCaption - the caption for the password fieldprotected Button createLoginButton()
public String getLoginButtonCaption()
setLoginButtonCaption(String). Note
that this method might not match what is shown to the user if
createLoginButton() has been overridden.public void setLoginButtonCaption(String loginButtonCaption)
As an alternative to calling this method, the method
createLoginButton() can be overridden.
loginButtonCaption - new captionprotected LoginFormState getState()
AbstractComponentgetState in class AbstractSingleComponentContainerprotected LoginFormState getState(boolean markAsDirty)
AbstractClientConnectorgetState in class AbstractSingleComponentContainermarkAsDirty - true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()public void attach()
ClientConnector
The caller of this method is Connector#setParent(ClientConnector)
if the parent is itself already attached to the session. If not, the
parent will call the ClientConnector.attach() for all its children when it is
attached to the session. This method is always called before the
connector's data is sent to the client-side for the first time.
The attachment logic is implemented in AbstractClientConnector.
attach in interface ClientConnectorattach in interface Componentattach in class AbstractComponentprotected Component createContent(TextField userNameField, PasswordField passwordField, Button loginButton)
createUsernameField(),
createPasswordField() and createLoginButton(). If you
only want to change the default captions, override
getUsernameCaption(), getPasswordCaption() and
getLoginButtonCaption(). You do not have to use the login button
in your layout.userNameField - the user name text fieldpasswordField - the password fieldloginButton - the login buttonpublic Registration addLoginListener(LoginForm.LoginListener listener)
LoginForm.LoginListener.
The listener is called when the user presses the login button.
listener - the listener to add@Deprecated public void removeLoginListener(LoginForm.LoginListener listener)
Registration.remove() in the
registration object returned from
addLoginListener(LoginListener).LoginForm.LoginListener.listener - the listener to removeCopyright © 2018 Vaadin Ltd. All rights reserved.