com.isti.util.propertyeditor
Class LoginInformation

java.lang.Object
  extended by com.isti.util.propertyeditor.LoginInformation
All Implemented Interfaces:
PropertyEditorInformation
Direct Known Subclasses:
QWServerLoginInformation

public class LoginInformation
extends java.lang.Object
implements PropertyEditorInformation

Class LoginInformation manages login information. GUI programs that want a login-information dialog should execute "setPropertyEditor(new LoginPropertyEditor())".


Constructor Summary
LoginInformation()
          Creates emtpy login information.
LoginInformation(java.lang.String loginInfoStr)
          Creates login information.
LoginInformation(java.lang.String usernameText, java.lang.String passwordText)
          Creates login information.
LoginInformation(java.lang.String usernameText, java.lang.String passwordText, boolean isEncryptedFlag)
          Creates login information.
 
Method Summary
 void clearEncryptedPassword()
          Clears the encrypted password.
 void clearLoginInfoText()
          Clears the cached value for the string representation of the object.
 void copyLoginInfoResources(LoginInformation srcInfoObj)
          Copies resources from the given login-information object into this object.
protected  java.lang.String createEncryptedPassword()
          Creates the encrypted password.
 boolean equals(LoginInformation loginInformationObj)
          Indicates whether some other login information object is "equal to" this one.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 java.lang.String getEncryptedPasswordText()
          Gets the encrypted password.
 java.lang.String getLoginInfoText()
          Returns a string representation of the object.
 java.lang.String getPasswordText()
          Gets the password text.
 java.beans.PropertyEditor getPropertyEditor()
          Gets the property editor for the information.
 java.lang.String getUsernameText()
          Gets the username text.
protected static java.lang.String insertQuoteChars(java.lang.String dataStr)
          Returns a string with a backslash quote character ('\') inserted in front of each occurance of a "special" character in the given source string.
 boolean isEncrypted()
          Determines if the password is encrypted.
 boolean isValueStringQuoted()
          Determines if the value string is already quoted.
 boolean loginAttemptFailed(java.lang.String messageStr)
          Called to indicate that a login attempt has failed.
static void setLoginDialogMsgStrs(java.lang.String loginDialogMsgStr, java.lang.String failMsgPrefixStr, java.lang.String failMsgSuffixStr)
          Modifies the message strings to be shown in the login dialog.
protected  void setPasswordText(java.lang.String pwdStr, boolean isEncFlg)
          Enters the password text.
 void setPropertyEditor(java.beans.PropertyEditor propertyEditorObj)
          Sets the property editor for the information.
 boolean showLoginDialog()
          Displays the login dialog.
 boolean showLoginDialog(java.lang.String panelPromptStr)
          Displays the login dialog.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoginInformation

public LoginInformation()
Creates emtpy login information.


LoginInformation

public LoginInformation(java.lang.String loginInfoStr)
Creates login information.

Parameters:
loginInfoStr - the text the represents the login information.

LoginInformation

public LoginInformation(java.lang.String usernameText,
                        java.lang.String passwordText)
Creates login information.

Parameters:
usernameText - the user name text.
passwordText - the password text (not encrypted).

LoginInformation

public LoginInformation(java.lang.String usernameText,
                        java.lang.String passwordText,
                        boolean isEncryptedFlag)
Creates login information.

Parameters:
usernameText - the user name text.
passwordText - the password text.
isEncryptedFlag - true if the password text is encrypted.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

equals

public boolean equals(LoginInformation loginInformationObj)
Indicates whether some other login information object is "equal to" this one.

Parameters:
loginInformationObj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

clearEncryptedPassword

public void clearEncryptedPassword()
Clears the encrypted password. This will force the password to be regenerated the next time 'getEncryptedPasswordText()' is called.


getEncryptedPasswordText

public java.lang.String getEncryptedPasswordText()
Gets the encrypted password.

Returns:
the encrypted password.

setPasswordText

protected void setPasswordText(java.lang.String pwdStr,
                               boolean isEncFlg)
Enters the password text.

Parameters:
pwdStr - password text to enter.
isEncFlg - true if encrypted, false if not.

getPasswordText

public java.lang.String getPasswordText()
Gets the password text.

Returns:
the password text.

getUsernameText

public java.lang.String getUsernameText()
Gets the username text.

Returns:
the username text.

isEncrypted

public boolean isEncrypted()
Determines if the password is encrypted.

Returns:
true if the password is encrypted, false otherwise.

isValueStringQuoted

public boolean isValueStringQuoted()
Determines if the value string is already quoted.

Specified by:
isValueStringQuoted in interface PropertyEditorInformation
Returns:
true if the value string is already quoted, false otherwise.
See Also:
insertQuoteChars

setPropertyEditor

public void setPropertyEditor(java.beans.PropertyEditor propertyEditorObj)
Sets the property editor for the information.

Specified by:
setPropertyEditor in interface PropertyEditorInformation
Parameters:
propertyEditorObj - the property editor for the information.

copyLoginInfoResources

public void copyLoginInfoResources(LoginInformation srcInfoObj)
Copies resources from the given login-information object into this object.

Parameters:
infoObj - the 'LoginInformation' object from which resources should be copied.

getPropertyEditor

public java.beans.PropertyEditor getPropertyEditor()
Gets the property editor for the information.

Specified by:
getPropertyEditor in interface PropertyEditorInformation
Returns:
the property editor for the information.

showLoginDialog

public boolean showLoginDialog()
Displays the login dialog.

Returns:
true if the user closed the dialog by selected the "OK" button; false if not.

showLoginDialog

public boolean showLoginDialog(java.lang.String panelPromptStr)
Displays the login dialog.

Parameters:
panelPromptStr - the "prompt" text to be shown on the panel, or null for none.
Returns:
true if the user closed the dialog by selected the "OK" button; false if not.

loginAttemptFailed

public boolean loginAttemptFailed(java.lang.String messageStr)
Called to indicate that a login attempt has failed. If a 'LoginPropertyEditor' object was entered via the 'setPropertyEditor()' method then the login dialog will be shown.

Parameters:
messageStr - the error-message text to use.
Returns:
true if the login dialog was shown and the user closed the dialog by selected the "OK" button; false if not.

clearLoginInfoText

public void clearLoginInfoText()
Clears the cached value for the string representation of the object. This will force the representation to be regenerated the next time 'getLoginInfoText()' is called.


getLoginInfoText

public java.lang.String getLoginInfoText()
Returns a string representation of the object.

Returns:
a string representation of the object.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

createEncryptedPassword

protected java.lang.String createEncryptedPassword()
Creates the encrypted password.

Returns:
the encrypted password.

insertQuoteChars

protected static java.lang.String insertQuoteChars(java.lang.String dataStr)
Returns a string with a backslash quote character ('\') inserted in front of each occurance of a "special" character in the given source string. If they are included in the string of "special" characters, the ASCII characters tab, newline, and carriage return are written as \t, \n, and \r, respectively.

Parameters:
dataStr - the data source string.
Returns:
a new string with its "special" characters quoted, or the original string if no matching "special" characters were found.

setLoginDialogMsgStrs

public static void setLoginDialogMsgStrs(java.lang.String loginDialogMsgStr,
                                         java.lang.String failMsgPrefixStr,
                                         java.lang.String failMsgSuffixStr)
Modifies the message strings to be shown in the login dialog. If used, this method should be called before any instances of login-information objects are created.

Parameters:
loginDialogMsgStr - text always shown in login dialog.
failMsgPrefixStr - text shown in failed-login dialog before error message.
failMsgSuffixStr - text shown in failed-login dialog after error message.