|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jdesktop.swingx.JXPanel
org.jdesktop.swingx.JXImagePanel
org.jdesktop.swingx.JXLoginPanel
public class JXLoginPanel
JXLoginPanel is a JPanel that implements a Login dialog with support for saving passwords supplied for future use in a secure manner. It is intended to work with LoginService and PasswordStore to implement the authentication.
In order to perform the authentication, JXLoginPanel
calls the authenticate
method of the LoginService
. In order to perform the persistence of the password,
JXLoginPanel calls the put method of the
PasswordStore object that is supplied. If
the PasswordStore is null
, then the password
is not saved. Similarly, if a PasswordStore is
supplied and the password is null, then the PasswordStore
will be queried for the password using the get
method.
Nested Class Summary | |
---|---|
static class |
JXLoginPanel.ComboNamePanel
If a UserNameStore is used, then this combo box is presented allowing the user to select a previous login name, or type in a new login name |
static class |
JXLoginPanel.JXLoginDialog
|
static class |
JXLoginPanel.JXLoginFrame
|
protected class |
JXLoginPanel.LoginListenerImpl
Listener class to track state in the LoginService |
static interface |
JXLoginPanel.NameComponent
|
static class |
JXLoginPanel.SaveMode
The JXLoginPanel can attempt to save certain user information such as the username, password, or both to their respective stores. |
static class |
JXLoginPanel.SimpleNamePanel
If a UserNameStore is not used, then this text field is presented allowing the user to simply enter their user name |
static class |
JXLoginPanel.Status
Returns the status of the login process |
Nested classes/interfaces inherited from class org.jdesktop.swingx.JXImagePanel |
---|
JXImagePanel.Style |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
CANCEL_LOGIN_ACTION_COMMAND
Action key for an Action in the ActionMap that cancels the Login procedure |
static String |
LOGIN_ACTION_COMMAND
Action key for an Action in the ActionMap that initiates the Login procedure |
static String |
uiClassID
UI Class ID |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JXLoginPanel()
Create a JXLoginPanel that always accepts the user, never stores
passwords or user ids, and has no target servers. |
|
JXLoginPanel(LoginService service)
Create a JXLoginPanel with the specified LoginService
that does not store user ids or passwords and has no target servers. |
|
JXLoginPanel(LoginService service,
PasswordStore passwordStore,
UserNameStore userStore)
Create a JXLoginPanel with the specified LoginService ,
PasswordStore , and UserNameStore , but without a server
list. |
|
JXLoginPanel(LoginService service,
PasswordStore passwordStore,
UserNameStore userStore,
List<String> servers)
Create a JXLoginPanel with the specified LoginService ,
PasswordStore , UserNameStore , and server list. |
Method Summary | |
---|---|
protected void |
cancelLogin()
Cancels the login procedure. |
protected Action |
createCancelAction()
Create and return an Action for canceling login |
protected Action |
createLoginAction()
Create and return an Action for logging in |
protected Image |
createLoginBanner()
Create and return an image to use for the Banner. |
Image |
getBanner()
Return the image used as the banner |
String |
getBannerText()
Returns text used when creating the banner |
String |
getErrorMessage()
Returns the error message for this login panel |
LoginService |
getLoginService()
Gets the LoginService for this panel. |
String |
getMessage()
Returns the custom message for this login panel |
char[] |
getPassword()
Gets the Password for this panel. |
PasswordStore |
getPasswordStore()
Gets the PasswordStore for this panel. |
JXLoginPanel.SaveMode |
getSaveMode()
|
List<String> |
getServers()
|
JXLoginPanel.Status |
getStatus()
Returns the panel's status |
LoginPanelUI |
getUI()
Returns the look and feel (L&F) object that renders this component. |
String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
String |
getUserName()
Gets the User name for this panel. |
UserNameStore |
getUserNameStore()
Gets the UserNameStore for this panel. |
protected void |
recreateLoginPanel()
Recreates the login panel, and replaces the current one with the new one |
protected void |
savePassword()
TODO |
void |
setBanner(Image img)
Set the image to use for the banner. |
void |
setBannerText(String text)
Set the text to use when creating the banner. |
void |
setComponentOrientation(ComponentOrientation orient)
This method adds functionality to support bidi languages within this component |
void |
setErrorMessage(String errorMessage)
Sets the error message for this login panel |
void |
setLocale(Locale l)
Sets the locale of this component. |
void |
setLoginService(LoginService service)
Sets the LoginService for this panel. |
void |
setMessage(String message)
Sets a custom message for this login panel |
void |
setPassword(char[] password)
Sets the Password for this panel. |
void |
setPasswordStore(PasswordStore store)
Sets the PasswordStore for this panel. |
void |
setSaveMode(JXLoginPanel.SaveMode saveMode)
The save mode indicates whether the "save" password is checked by default. |
void |
setServers(List<String> servers)
Sets the list of servers. |
protected void |
setStatus(JXLoginPanel.Status newStatus)
Change the status |
void |
setUserName(String username)
Sets the User name for this panel. |
void |
setUserNameStore(UserNameStore store)
Sets the user name store for this panel. |
static JXLoginPanel.Status |
showLoginDialog(Component parent,
JXLoginPanel panel)
Shows a login dialog. |
static JXLoginPanel.Status |
showLoginDialog(Component parent,
LoginService svc)
Shows a login dialog. |
static JXLoginPanel.Status |
showLoginDialog(Component parent,
LoginService svc,
PasswordStore ps,
UserNameStore us)
Shows a login dialog. |
static JXLoginPanel.Status |
showLoginDialog(Component parent,
LoginService svc,
PasswordStore ps,
UserNameStore us,
List<String> servers)
Shows a login dialog. |
static JXLoginPanel.JXLoginFrame |
showLoginFrame(JXLoginPanel panel)
|
static JXLoginPanel.JXLoginFrame |
showLoginFrame(LoginService svc)
Shows a login frame. |
static JXLoginPanel.JXLoginFrame |
showLoginFrame(LoginService svc,
PasswordStore ps,
UserNameStore us)
|
static JXLoginPanel.JXLoginFrame |
showLoginFrame(LoginService svc,
PasswordStore ps,
UserNameStore us,
List<String> servers)
|
protected void |
startLogin()
Initiates the login procedure. |
Methods inherited from class org.jdesktop.swingx.JXImagePanel |
---|
getImage, getPreferredSize, getStyle, isEditable, paintComponent, setEditable, setImage, setPreferredSize, setStyle |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String uiClassID
public static final String LOGIN_ACTION_COMMAND
public static final String CANCEL_LOGIN_ACTION_COMMAND
Constructor Detail |
---|
public JXLoginPanel()
JXLoginPanel
that always accepts the user, never stores
passwords or user ids, and has no target servers.
This constructor should NOT be used in a real application. It is provided for compliance to the bean specification and for use with visual editors.
public JXLoginPanel(LoginService service)
JXLoginPanel
with the specified LoginService
that does not store user ids or passwords and has no target servers.
service
- the LoginService
to use for logging inpublic JXLoginPanel(LoginService service, PasswordStore passwordStore, UserNameStore userStore)
JXLoginPanel
with the specified LoginService
,
PasswordStore
, and UserNameStore
, but without a server
list.
If you do not want to store passwords or user ids, those parameters can
be null
. SaveMode
is autoconfigured from passed in store
parameters.
service
- the LoginService
to use for logging inpasswordStore
- the PasswordStore
to use for storing password
informationuserStore
- the UserNameStore
to use for storing user informationpublic JXLoginPanel(LoginService service, PasswordStore passwordStore, UserNameStore userStore, List<String> servers)
JXLoginPanel
with the specified LoginService
,
PasswordStore
, UserNameStore
, and server list.
If you do not want to store passwords or user ids, those parameters can
be null
. SaveMode
is autoconfigured from passed in store
parameters.
Setting the server list to null
will unset all of the servers.
The server list is guaranteed to be non-null
.
service
- the LoginService
to use for logging inpasswordStore
- the PasswordStore
to use for storing password
informationuserStore
- the UserNameStore
to use for storing user informationservers
- a list of servers to authenticate againstMethod Detail |
---|
public LoginPanelUI getUI()
getUI
in class JPanel
public String getUIClassID()
getUIClassID
in class JPanel
uiClassID
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
protected void recreateLoginPanel()
public void setComponentOrientation(ComponentOrientation orient)
setComponentOrientation
in class Component
ComponentOrientation
protected Image createLoginBanner()
protected Action createLoginAction()
protected Action createCancelAction()
public JXLoginPanel.SaveMode getSaveMode()
public void setSaveMode(JXLoginPanel.SaveMode saveMode)
saveMode
- The saveMode to set either SAVE_NONE, SAVE_PASSWORD or SAVE_USERNAMEpublic List<String> getServers()
public void setServers(List<String> servers)
public void setLoginService(LoginService service)
LoginService
for this panel. Setting the login service
to null
will actually set the service to use
NullLoginService
.
service
- the service to set. If service == null
, then a
NullLoginService
is used.public LoginService getLoginService()
public void setPasswordStore(PasswordStore store)
store
- PasswordStorepublic UserNameStore getUserNameStore()
UserNameStore
for this panel.
UserNameStore
public void setUserNameStore(UserNameStore store)
store
- public PasswordStore getPasswordStore()
public void setUserName(String username)
username
- User namepublic String getUserName()
public void setPassword(char[] password)
password
- Passwordpublic char[] getPassword()
public Image getBanner()
public void setBanner(Image img)
img
is null
,
then no image will be displayed.
img
- the image to displaypublic void setBannerText(String text)
text
is null
, then
no text is displayed.
text
- the text to displaypublic String getBannerText()
public String getMessage()
public void setMessage(String message)
public String getErrorMessage()
public void setErrorMessage(String errorMessage)
public JXLoginPanel.Status getStatus()
protected void setStatus(JXLoginPanel.Status newStatus)
public void setLocale(Locale l)
java.awt.Component
setLocale
in class Component
l
- the locale to become this component's localeComponent.getLocale()
protected void startLogin()
protected void cancelLogin()
protected void savePassword()
public static JXLoginPanel.Status showLoginDialog(Component parent, LoginService svc)
public static JXLoginPanel.Status showLoginDialog(Component parent, LoginService svc, PasswordStore ps, UserNameStore us)
public static JXLoginPanel.Status showLoginDialog(Component parent, LoginService svc, PasswordStore ps, UserNameStore us, List<String> servers)
public static JXLoginPanel.Status showLoginDialog(Component parent, JXLoginPanel panel)
public static JXLoginPanel.JXLoginFrame showLoginFrame(LoginService svc)
public static JXLoginPanel.JXLoginFrame showLoginFrame(LoginService svc, PasswordStore ps, UserNameStore us)
public static JXLoginPanel.JXLoginFrame showLoginFrame(LoginService svc, PasswordStore ps, UserNameStore us, List<String> servers)
public static JXLoginPanel.JXLoginFrame showLoginFrame(JXLoginPanel panel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |