gui.dialog
Class PasswordContentPane

java.lang.Object
  extended by gui.dialog.DialogContentPane
      extended by gui.dialog.PasswordContentPane
All Implemented Interfaces:
IMiscPasswordReader, DialogContentPane.IWizardSuitable, IDialogOptions, JAPHelpContext.IHelpContext

public class PasswordContentPane
extends DialogContentPane
implements IMiscPasswordReader, DialogContentPane.IWizardSuitable


Nested Class Summary
private  class PasswordContentPane.CapsLockAdapter
          Shows a warning when the caps lock key is pressed while entering passwords.
private  class PasswordContentPane.SetFocusComponentAdapter
           
 
Nested classes/interfaces inherited from class gui.dialog.DialogContentPane
DialogContentPane.CheckError, DialogContentPane.IWizardSuitable, DialogContentPane.IWizardSuitableNoWizardButtons, DialogContentPane.Layout
 
Field Summary
private static int FIELD_LENGTH
           
private  javax.swing.JPasswordField m_currentPopup
           
private  javax.swing.JLabel m_lblNew1
           
private  javax.swing.JLabel m_lblNew2
           
private  javax.swing.JLabel m_lblOld
           
private  int m_minLength
           
private  char[] m_oldPasswd
           
private  char[] m_passwd
           
private  javax.swing.JPopupMenu m_popup
           
private  javax.swing.JPasswordField m_textConfirmPasswd
           
private  javax.swing.JPasswordField m_textNewPasswd
           
private  javax.swing.JPasswordField m_textOldPasswd
           
private  int m_type
           
private static java.lang.String MSG_CAPS_LOCK_PRESSED
           
private static java.lang.String MSG_CONFIRM_LBL
           
static java.lang.String MSG_ENTER_LBL
           
private static java.lang.String MSG_ENTER_NEW_LBL
           
private static java.lang.String MSG_ENTER_OLD_LBL
           
static java.lang.String MSG_ENTER_PASSWORD_TITLE
           
private static java.lang.String MSG_INSERT_FROM_CLIP
           
private static java.lang.String MSG_PASSWORDS_DONT_MATCH
           
private static java.lang.String MSG_TOO_SHORT
           
private static java.lang.String MSG_WRONG_PASSWORD
           
static int NO_MINIMUM_LENGTH
           
static int PASSWORD_CHANGE
          Replace an old password by a new one.
static int PASSWORD_ENTER
          Enter a single password
static int PASSWORD_NEW
          Enter a new password and a confirmation.
 
Fields inherited from class gui.dialog.DialogContentPane
BUTTON_OPERATION_WIZARD, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_EMPTY, DEFAULT_BUTTON_HELP, DEFAULT_BUTTON_KEEP, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_OK, DEFAULT_BUTTON_YES, MSG_CANCEL, MSG_FINISH, MSG_NEXT, MSG_NO, MSG_OK, MSG_OPERATION_FAILED, MSG_PREVIOUS, MSG_SEE_FULL_MESSAGE, MSG_YES, ON_CANCEL_DISPOSE_DIALOG, ON_CANCEL_HIDE_DIALOG, ON_CANCEL_SHOW_NEXT_CONTENT, ON_CANCEL_SHOW_PREVIOUS_CONTENT, ON_CLICK_DISPOSE_DIALOG, ON_CLICK_DO_NOTHING, ON_CLICK_HIDE_DIALOG, ON_CLICK_SHOW_NEXT_CONTENT, ON_CLICK_SHOW_PREVIOUS_CONTENT, ON_NO_DISPOSE_DIALOG, ON_NO_HIDE_DIALOG, ON_NO_SHOW_NEXT_CONTENT, ON_NO_SHOW_PREVIOUS_CONTENT, ON_YESOK_DISPOSE_DIALOG, ON_YESOK_HIDE_DIALOG, ON_YESOK_SHOW_NEXT_CONTENT, ON_YESOK_SHOW_PREVIOUS_CONTENT
 
Fields inherited from interface gui.dialog.IDialogOptions
MESSAGE_TYPE_ERROR, MESSAGE_TYPE_INFORMATION, MESSAGE_TYPE_PLAIN, MESSAGE_TYPE_QUESTION, MESSAGE_TYPE_WARNING, OPTION_TYPE_CANCEL, OPTION_TYPE_DEFAULT, OPTION_TYPE_EMPTY, OPTION_TYPE_OK_CANCEL, OPTION_TYPE_YES_NO, OPTION_TYPE_YES_NO_CANCEL, RETURN_VALUE_CANCEL, RETURN_VALUE_CLOSED, RETURN_VALUE_NO, RETURN_VALUE_OK, RETURN_VALUE_UNINITIALIZED, RETURN_VALUE_YES
 
Constructor Summary
PasswordContentPane(JAPDialog a_parentDialog, DialogContentPane a_previousContentPane, int a_type, java.lang.String a_strMessage)
           
PasswordContentPane(JAPDialog a_parentDialog, DialogContentPane a_previousContentPane, int a_type, java.lang.String a_strMessage, int a_minLength)
           
PasswordContentPane(JAPDialog a_parentDialog, int a_type, java.lang.String a_strMessage)
           
PasswordContentPane(JAPDialog a_parentDialog, int a_type, java.lang.String a_strMessage, int a_minLength)
           
 
Method Summary
 DialogContentPane.CheckError[] checkYesOK()
          Saves the user input.
 char[] getComparedPassword()
          Implement this method for the types PASSWORD_ENTER or PASSWORD_CHANGE.
 java.lang.String getNewPasswordLabel()
           
 char[] getOldPassword()
          Needed if an old password is changed.
 java.lang.String getOldPasswordLabel()
           
 char[] getPassword()
          Returns the password that the user has entered.
 boolean isAutomaticFocusSettingEnabled()
          Returns false in order to set the focus on the first available password field.
 java.lang.String readPassword(java.lang.Object a_message)
          Updates the content pane and shows the dialog.
 
Methods inherited from class gui.dialog.DialogContentPane
addComponentListener, addDialogComponentListener, addDialogWindowListener, checkCancel, checkNo, checkUpdate, clearStatusMessage, clearStatusMessage, closeDialog, dispose, getButtonCancel, getButtonHelp, getButtonNo, getButtonValue, getButtonYesOK, getContentPane, getDefaultButton, getDefaultButtonOperation, getDialog, getHelpContext, getHelpExtractionDisplayContext, getMessageIcon, getNextContentPane, getPreviousContentPane, getText, getValue, hasNextContentPane, hasPreviousContentPane, hasValidValue, hasWizardLayout, isActive, isDialogVisible, isDisposed, isMoveBackAllowed, isMoveForwardAllowed, isSkippedAsNextContentPane, isSkippedAsPreviousContentPane, isVisible, moveToNextContentPane, moveToPreviousContentPane, printErrorStatusMessage, printErrorStatusMessage, printErrorStatusMessage, printStatusMessage, printStatusMessage, removeComponentListener, removeDialogComponentListener, removeDialogWindowListener, setButtonValue, setContentPane, setDefaultButton, setDefaultButtonOperation, setMouseListener, setText, showDialog, updateDialog, updateDialogOptimalSized, updateDialogOptimalSized, validateDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASSWORD_NEW

public static final int PASSWORD_NEW
Enter a new password and a confirmation.

See Also:
Constant Field Values

PASSWORD_ENTER

public static final int PASSWORD_ENTER
Enter a single password

See Also:
Constant Field Values

PASSWORD_CHANGE

public static final int PASSWORD_CHANGE
Replace an old password by a new one. Enter the old password, the new password and a confirmation.

See Also:
Constant Field Values

NO_MINIMUM_LENGTH

public static final int NO_MINIMUM_LENGTH
See Also:
Constant Field Values

MSG_ENTER_LBL

public static final java.lang.String MSG_ENTER_LBL

FIELD_LENGTH

private static final int FIELD_LENGTH
See Also:
Constant Field Values

MSG_TOO_SHORT

private static final java.lang.String MSG_TOO_SHORT

MSG_CAPS_LOCK_PRESSED

private static final java.lang.String MSG_CAPS_LOCK_PRESSED

MSG_WRONG_PASSWORD

private static final java.lang.String MSG_WRONG_PASSWORD

MSG_ENTER_PASSWORD_TITLE

public static final java.lang.String MSG_ENTER_PASSWORD_TITLE

MSG_CONFIRM_LBL

private static final java.lang.String MSG_CONFIRM_LBL

MSG_ENTER_OLD_LBL

private static final java.lang.String MSG_ENTER_OLD_LBL

MSG_ENTER_NEW_LBL

private static final java.lang.String MSG_ENTER_NEW_LBL

MSG_PASSWORDS_DONT_MATCH

private static final java.lang.String MSG_PASSWORDS_DONT_MATCH

MSG_INSERT_FROM_CLIP

private static final java.lang.String MSG_INSERT_FROM_CLIP

m_textOldPasswd

private javax.swing.JPasswordField m_textOldPasswd

m_textNewPasswd

private javax.swing.JPasswordField m_textNewPasswd

m_textConfirmPasswd

private javax.swing.JPasswordField m_textConfirmPasswd

m_passwd

private char[] m_passwd

m_oldPasswd

private char[] m_oldPasswd

m_type

private int m_type

m_minLength

private int m_minLength

m_lblNew1

private javax.swing.JLabel m_lblNew1

m_lblNew2

private javax.swing.JLabel m_lblNew2

m_lblOld

private javax.swing.JLabel m_lblOld

m_popup

private javax.swing.JPopupMenu m_popup

m_currentPopup

private javax.swing.JPasswordField m_currentPopup
Constructor Detail

PasswordContentPane

public PasswordContentPane(JAPDialog a_parentDialog,
                           int a_type,
                           java.lang.String a_strMessage,
                           int a_minLength)

PasswordContentPane

public PasswordContentPane(JAPDialog a_parentDialog,
                           int a_type,
                           java.lang.String a_strMessage)

PasswordContentPane

public PasswordContentPane(JAPDialog a_parentDialog,
                           DialogContentPane a_previousContentPane,
                           int a_type,
                           java.lang.String a_strMessage)

PasswordContentPane

public PasswordContentPane(JAPDialog a_parentDialog,
                           DialogContentPane a_previousContentPane,
                           int a_type,
                           java.lang.String a_strMessage,
                           int a_minLength)
Method Detail

readPassword

public java.lang.String readPassword(java.lang.Object a_message)
Updates the content pane and shows the dialog. You will have to define the size of the dialog before, for example by a pack() operation. getButtonValue() will return RETURN_VALUE_CLOSED, RETURN_VALUE_CANCEL or RETURN_VALUE_OK after this call.

Specified by:
readPassword in interface IMiscPasswordReader
Parameters:
a_message - a message (optional); if given, a_message.toString() will be shown to the user
Returns:
the password entered by the user or null if the user canceled

getPassword

public char[] getPassword()
Returns the password that the user has entered.

Returns:
null if getButtonValue() is not OK; otherwise, the password that the user has entered

isAutomaticFocusSettingEnabled

public boolean isAutomaticFocusSettingEnabled()
Returns false in order to set the focus on the first available password field.

Overrides:
isAutomaticFocusSettingEnabled in class DialogContentPane
Returns:
false

getNewPasswordLabel

public java.lang.String getNewPasswordLabel()

getOldPasswordLabel

public java.lang.String getOldPasswordLabel()

getOldPassword

public char[] getOldPassword()
Needed if an old password is changed. This method returns the old password.

Returns:
null if uninitialised; otherwise, the old password

getComparedPassword

public char[] getComparedPassword()
Implement this method for the types PASSWORD_ENTER or PASSWORD_CHANGE. It returns the password that the entered password is compared with. The dialog will only continue if th user enters the right password or if he closes the dialog.

Returns:
the password that the entered password is compared with; if it returns null, no comparation is done and the dialog continues whatever the user entered

checkYesOK

public DialogContentPane.CheckError[] checkYesOK()
Saves the user input.

Overrides:
checkYesOK in class DialogContentPane
Returns:
CheckError[]