public class LoginPane extends WindowPane implements View
Note: It is imperative that you invoke setLoginListener(com.sptci.echo2.login.LoginListener) prior to initialising this component. Failing to
do so will probably result in a NullPointerException
during initialisation of password and login.
The following properties must be configured for this component:
com.sptci.echo2.login.LoginPane.title - The localised
title displayed in the title bar for this component.com.sptci.echo2.login.LoginPane.userName.label - The
localised label to display adjacent to the text input component for
entering user/login name.com.sptci.echo2.login.LoginPane.userName.tooltip - The
localised tooltip to display for the label.com.sptci.echo2.login.LoginPane.password.label - The
localised label to display adjacent to the password input component
for entering the login password.com.sptci.echo2.login.LoginPane.password.tooltip - The
localised tooltip to display for the label.com.sptci.echo2.login.LoginPane.login.text - The
localised title to display for the button used to trigger the login
process.com.sptci.echo2.login.LoginPane.login.tooltip - The
localised tooltip for the login button.com.sptci.echo2.login.LoginPane.cancel.text - The
localised title to display for the button used to cancel (reset)
the text input components of this component.com.sptci.echo2.login.LoginPane.cancel.tooltip - The
localised tooltip to display for the cancel button.com.sptci.echo2.login.LoginPane.error.title - The
title to display in the error dialogue when login fails.com.sptci.echo2.login.LoginPane.error.message - The
message text to display in the error dialogue when login fails.Note: Ideally the password and login
components should be disabled until the user enters credentials into the
userName component. Echo2 unfortunately does not support any
other listener for a TextComponent (only
triggered by pressing the Enter/Return button which is not intuitive
enough). The code for enabling and disabling the components is left
commented out for future use.
© Copyright 2006 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected Button |
cancel
|
static String |
CANCEL
The name of the control used to cancel/clear the login pane.
|
protected Button |
login
The button used to trigger a login action.
|
static String |
LOGIN
The name of the
login field used to trigger the login process. |
protected PasswordField |
password |
static String |
PASSWORD
The name of the
password field. |
protected Label |
passwordLabel
The component to use to capture password information.
|
protected TextField |
userName |
static String |
USERNAME
The name of the
userName field. |
protected Label |
userNameLabel
The component to use to capture user/account name information.
|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, INPUT_CLOSE, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_CLOSABLE, PROPERTY_CLOSE_ICON, PROPERTY_CLOSE_ICON_INSETS, PROPERTY_DEFAULT_CLOSE_OPERATION, PROPERTY_HEIGHT, PROPERTY_ICON, PROPERTY_ICON_INSETS, PROPERTY_INSETS, PROPERTY_MAXIMUM_HEIGHT, PROPERTY_MAXIMUM_WIDTH, PROPERTY_MINIMUM_HEIGHT, PROPERTY_MINIMUM_WIDTH, PROPERTY_MOVABLE, PROPERTY_POSITION_X, PROPERTY_POSITION_Y, PROPERTY_RESIZABLE, PROPERTY_TITLE, PROPERTY_TITLE_BACKGROUND, PROPERTY_TITLE_BACKGROUND_IMAGE, PROPERTY_TITLE_BAR_INSETS, PROPERTY_TITLE_FONT, PROPERTY_TITLE_FOREGROUND, PROPERTY_TITLE_HEIGHT, PROPERTY_TITLE_INSETS, PROPERTY_WIDTH, Z_INDEX_CHANGED_PROPERTYCHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTYMODAL_CHANGED_PROPERTY| Constructor and Description |
|---|
LoginPane()
Initialise the view using
ViewInitialiser. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createCancel(Component component)
Initialise the component used to cancel (clear information) and add to
the specified container component.
|
protected void |
createLogin(Component component)
Initialise the
login component and add to the specified
container component. |
protected void |
createPassword(Component container)
Initialise the
password field. |
protected void |
createUserName(Component container)
Initialise the
userName field. |
String |
getPassword()
Return the text entered into
password. |
String |
getUserName()
Return the text entered into
userName. |
void |
init()
Life-cycle method invoked when component is added to the component
hierarcy.
|
void |
refresh()
|
protected void |
replaceListener(String name,
String listenerName,
AbstractListener listener)
Add/replace the action listener for the specified component with the
specified instance.
|
void |
setLoginListener(LoginListener loginListener)
|
void |
setUserNameListener(UserNameListener userNameListener)
Set the action listener for the
userName field. |
addWindowPaneListener, fireWindowClosing, getBackgroundImage, getBorder, getCloseIcon, getCloseIconInsets, getDefaultCloseOperation, getHeight, getIcon, getIconInsets, getInsets, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getPositionX, getPositionY, getTitle, getTitleBackground, getTitleBackgroundImage, getTitleBarInsets, getTitleFont, getTitleForeground, getTitleHeight, getTitleInsets, getWidth, getZIndex, isClosable, isModal, isMovable, isResizable, isValidChild, isValidParent, processInput, removeWindowPaneListener, setBackgroundImage, setBorder, setClosable, setCloseIcon, setCloseIconInsets, setDefaultCloseOperation, setHeight, setIcon, setIconInsets, setInsets, setMaximumHeight, setMaximumWidth, setMinimumHeight, setMinimumWidth, setModal, setMovable, setPositionX, setPositionY, setResizable, setTitle, setTitleBackground, setTitleBackgroundImage, setTitleBarInsets, setTitleFont, setTitleForeground, setTitleHeight, setTitleInsets, setWidth, setZIndex, userCloseadd, add, addPropertyChangeListener, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isVisible, remove, remove, removeAll, removePropertyChangeListener, removePropertyChangeListener, setBackground, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setRenderId, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOfpublic static final String USERNAME
userName field.
"userName"public static final String PASSWORD
password field.
"password"public static final String LOGIN
login field used to trigger the login process.
"login"public static final String CANCEL
protected Label userNameLabel
@Constraints(value=NOT_NULL) @ActionListener(value="com.sptci.echo2.login.UserNameListener") protected TextField userName
protected Label passwordLabel
@Constraints(value=NOT_NULL) protected PasswordField password
protected Button login
@ActionListener(value="com.sptci.echo2.login.CancelListener") protected Button cancel
public LoginPane()
ViewInitialiser.public void init()
protected void createUserName(Component container)
userName field. Add the userNameListener
as the action listener for the component.container - The container component to which the userName
component is to be added.protected void createPassword(Component container)
password field. Add the loginListener
as the action listener for the component.container - The parent container to which the field is to be
added.protected void createLogin(Component component)
login component and add to the specified
container component.component - The parent container to which the field is to be
added.protected void createCancel(Component component)
component - The parent container to which the component is to be
added.public String getUserName()
userName.public String getPassword()
password.public void refresh()
public void setUserNameListener(UserNameListener userNameListener)
userName field. Removes the
current listener if any and adds the specified one.userNameListener - The listener to associate.replaceListener(java.lang.String, java.lang.String, com.sptci.echo2.login.AbstractListener)public void setLoginListener(LoginListener loginListener)
password and login
fields. Removes the current listener if any and adds the specified
one.loginListener - The new listener to associate.replaceListener(java.lang.String, java.lang.String, com.sptci.echo2.login.AbstractListener)protected void replaceListener(String name, String listenerName, AbstractListener listener)
name - The name of the component whose listener is to be
replaced or added.listenerName - The name of the listener field that is to be
replaced.listener - The listener to add/replace.