com.isti.util.gui
Class IstiDialogUtil

java.lang.Object
  extended bycom.isti.util.gui.IstiDialogUtil

public class IstiDialogUtil
extends java.lang.Object

Class IstiDialogUtil provides simplified methods for popup-message-dialog creation.


Field Summary
protected static int DEF_MAX_JLABEL_LEN
          Default maximum length for popup message text.
protected static int DEF_USE_JLABEL_LEN
          Default use-JLabel length for popup message text.
protected static java.lang.String ERROR_STR
           
protected  java.awt.Component parentComponent
           
protected  int popupLengthValue
           
protected  java.lang.Object popupMessageSyncObj
          Thread-synchronization object for popup-message dialogs.
protected  boolean sizeViaNewlinesFlag
           
protected  boolean useJLabelFlag
           
protected  int useJLabelLength
           
 
Constructor Summary
IstiDialogUtil(java.awt.Component parentComp)
          Creates a dialog-utility object.
IstiDialogUtil(java.awt.Component parentComp, boolean useJLabelFlag)
          Creates a dialog-utility object.
IstiDialogUtil(java.awt.Component parentComp, int popupLength)
          Creates a dialog-utility object.
IstiDialogUtil(java.awt.Component parentComp, int popupLength, boolean useJLabelFlag)
          Creates a dialog-utility object.
IstiDialogUtil(java.awt.Component parentComp, int popupLength, boolean useJLabelFlag, int useJLabelLength)
          Creates a dialog-utility object.
 
Method Summary
 java.lang.Object createMsgObj(java.lang.String msgStr)
          Creates a message object using the given string.
 boolean getSizeViaNewlinesFlag()
          Returns a flag indicating whether or not the dialog may be horizontally sized using the newline characters in the message text.
 void popupErrorMessage(LogFile logObj, java.lang.String msgStr)
          Displays an error message in a modal popup window with an "OK" button.
 void popupErrorMessage(LogFile logObj, java.lang.String msgStr, boolean modalFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupErrorMessage(LogFile logObj, java.lang.String msgStr, boolean modalFlag, boolean normalizeFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupErrorMessage(LogFile logObj, java.lang.String msgStr, java.lang.String titleStr)
          Displays an error message in a modal popup window with an "OK" button.
 void popupErrorMessage(LogFile logObj, java.lang.String msgStr, java.lang.String titleStr, boolean modalFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupErrorMessage(LogFile logObj, java.lang.String msgStr, java.lang.String titleStr, boolean modalFlag, boolean normalizeFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupErrorMessage(java.lang.String msgStr)
          Displays an error message in a modal popup window with an "OK" button.
 void popupErrorMessage(java.lang.String msgStr, boolean modalFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupErrorMessage(java.lang.String msgStr, boolean modalFlag, boolean normalizeFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupErrorMessage(java.lang.String msgStr, java.lang.String titleStr)
          Displays an error message in a modal popup window with an "OK" button.
 void popupErrorMessage(java.lang.String msgStr, java.lang.String titleStr, boolean modalFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupErrorMessage(java.lang.String msgStr, java.lang.String titleStr, boolean modalFlag, boolean normalizeFlag)
          Displays an error message in a popup window with an "OK" button.
 void popupInfoMessage(java.lang.String msgStr)
          Displays an informational message in a modal popup window with an "OK" button.
 void popupInfoMessage(java.lang.String msgStr, boolean modalFlag)
          Displays an informational message in a modal popup window with an "OK" button.
 void popupMessage(java.lang.String msgStr, java.lang.String titleStr, int messageType, boolean modalFlag)
          Displays a message in a popup window with an "OK" button.
 void popupMessage(java.lang.String msgStr, java.lang.String titleStr, int messageType, boolean modalFlag, boolean waitFlag)
          Displays a message in a popup window with an "OK" button.
 int popupOKConfirmMessage(java.lang.String msgStr, java.lang.String titleStr, boolean modalFlag)
          Displays a user-confirmation popup dialog window with "OK" and "Cancel" buttons.
 int popupOKConfirmMessage(java.lang.String msgStr, java.lang.String titleStr, int messageType, boolean modalFlag)
          Displays a user-confirmation popup dialog window with "OK" and "Cancel" buttons.
 int popupYesNoConfirmMessage(java.lang.String msgStr, java.lang.String titleStr, boolean modalFlag)
          Displays a user-confirmation popup dialog window with "Yes" and "No" buttons.
 int popupYesNoConfirmMessage(java.lang.String msgStr, java.lang.String titleStr, int messageType, boolean modalFlag)
          Displays a user-confirmation popup dialog window with "Yes" and "No" buttons.
 void setSizeViaNewlinesFlag(boolean flgVal)
          Configures whether or not the dialog may be horizontally sized using the newline characters in the message text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_MAX_JLABEL_LEN

protected static final int DEF_MAX_JLABEL_LEN
Default maximum length for popup message text.

See Also:
Constant Field Values

DEF_USE_JLABEL_LEN

protected static final int DEF_USE_JLABEL_LEN
Default use-JLabel length for popup message text.

See Also:
Constant Field Values

ERROR_STR

protected static final java.lang.String ERROR_STR
See Also:
Constant Field Values

parentComponent

protected final java.awt.Component parentComponent

popupLengthValue

protected final int popupLengthValue

useJLabelFlag

protected final boolean useJLabelFlag

useJLabelLength

protected final int useJLabelLength

sizeViaNewlinesFlag

protected boolean sizeViaNewlinesFlag

popupMessageSyncObj

protected java.lang.Object popupMessageSyncObj
Thread-synchronization object for popup-message dialogs.

Constructor Detail

IstiDialogUtil

public IstiDialogUtil(java.awt.Component parentComp,
                      int popupLength,
                      boolean useJLabelFlag,
                      int useJLabelLength)
Creates a dialog-utility object.

Parameters:
parentComp - the parent component for the generated popups.
popupLength - if 'useJLabelFlag'==false then this defines the preferred-size width (in character columns), or 0 for a default width; if 'useJLabelFlag'==true then this defines the maximum allowed length for the popup text, or 0 for a default maximum length (when the popup text is beyond the maximum length it will be truncated and displayed with a trailing "..." string).
useJLabelFlag - true to use a 'JLabel' object to display message text; false to use a 'MultiLineJLabel' object.
useJLabelLength - if the message text is less than or equal to this value then a 'JLabel' object will always be used.

IstiDialogUtil

public IstiDialogUtil(java.awt.Component parentComp,
                      int popupLength,
                      boolean useJLabelFlag)
Creates a dialog-utility object.

Parameters:
parentComp - the parent component for the generated popups.
popupLength - if 'useJLabelFlag'==false then this defines the preferred-size width (in character columns), or 0 for a default width; if 'useJLabelFlag'==true then this defines the maximum allowed length for the popup text, or 0 for a default maximum length (when the popup text is beyond the maximum length it will be truncated and displayed with a trailing "..." string).
useJLabelFlag - true to use a 'JLabel' object to display message text; false to use a 'MultiLineJLabel' object.

IstiDialogUtil

public IstiDialogUtil(java.awt.Component parentComp,
                      int popupLength)
Creates a dialog-utility object.

Parameters:
parentComp - the parent component for the generated popups.
popupLength - the preferred-size width (in character columns), or 0 for a default width.

IstiDialogUtil

public IstiDialogUtil(java.awt.Component parentComp,
                      boolean useJLabelFlag)
Creates a dialog-utility object.

Parameters:
parentComp - the parent component for the generated popups.
useJLabelFlag - true to use a 'JLabel' object to display message text; false to use a 'MultiLineJLabel' object.

IstiDialogUtil

public IstiDialogUtil(java.awt.Component parentComp)
Creates a dialog-utility object.

Parameters:
parentComp - the parent component for the generated popups.
Method Detail

setSizeViaNewlinesFlag

public void setSizeViaNewlinesFlag(boolean flgVal)
Configures whether or not the dialog may be horizontally sized using the newline characters in the message text.

Parameters:
flgVal - if true then when the message text contains newline characters the width of the dialog will be determined by the width of the longest "line" in the text.

getSizeViaNewlinesFlag

public boolean getSizeViaNewlinesFlag()
Returns a flag indicating whether or not the dialog may be horizontally sized using the newline characters in the message text.

Returns:
true if, when the message text contains newline characters, the width of the dialog will be determined by the width of the longest "line" in the text.

popupMessage

public void popupMessage(java.lang.String msgStr,
                         java.lang.String titleStr,
                         int messageType,
                         boolean modalFlag,
                         boolean waitFlag)
Displays a message in a popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
titleStr - the window title to use.
messageType - message type code.
modalFlag - true for a modal dialog, false for non-modal (allows other windows to run).
waitFlag - true to have this method block until the dialog is dismissed (even if non-modal); false to have this method return immediately (if non-modal).

popupMessage

public void popupMessage(java.lang.String msgStr,
                         java.lang.String titleStr,
                         int messageType,
                         boolean modalFlag)
Displays a message in a popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
titleStr - the window title to use.
messageType - message type code.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).

popupErrorMessage

public void popupErrorMessage(LogFile logObj,
                              java.lang.String msgStr,
                              java.lang.String titleStr,
                              boolean modalFlag,
                              boolean normalizeFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
logObj - the log file to which the message text should also be delivered (with a log level of "warning"), or null for none.
msgStr - the error message text to display.
titleStr - the window title to use.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).
normalizeFlag - true to remove extra whitespace from the message text before showing it in the dialog; false to leave the text unchanged.

popupErrorMessage

public void popupErrorMessage(LogFile logObj,
                              java.lang.String msgStr,
                              java.lang.String titleStr,
                              boolean modalFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
logObj - the log file to which the message text should also be delivered (with a log level of "warning"), or null for none.
msgStr - the error message text to display.
titleStr - the window title to use.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).

popupErrorMessage

public void popupErrorMessage(java.lang.String msgStr,
                              java.lang.String titleStr,
                              boolean modalFlag,
                              boolean normalizeFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
titleStr - the window title to use.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).
normalizeFlag - true to remove extra whitespace from the message text before showing it in the dialog; false to leave the text unchanged.

popupErrorMessage

public void popupErrorMessage(java.lang.String msgStr,
                              java.lang.String titleStr,
                              boolean modalFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
titleStr - the window title to use.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).

popupErrorMessage

public void popupErrorMessage(LogFile logObj,
                              java.lang.String msgStr,
                              java.lang.String titleStr)
Displays an error message in a modal popup window with an "OK" button.

Parameters:
logObj - the log file to which the message text should also be delivered (with a log level of "warning"), or null for none.
msgStr - the error message text to display.
titleStr - the window title to use.

popupErrorMessage

public void popupErrorMessage(java.lang.String msgStr,
                              java.lang.String titleStr)
Displays an error message in a modal popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
titleStr - the window title to use.

popupErrorMessage

public void popupErrorMessage(LogFile logObj,
                              java.lang.String msgStr,
                              boolean modalFlag,
                              boolean normalizeFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
logObj - the log file to which the message text should also be delivered (with a log level of "warning"), or null for none.
msgStr - the error message text to display.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).
normalizeFlag - true to remove extra whitespace from the message text before showing it in the dialog; false to leave the text unchanged.

popupErrorMessage

public void popupErrorMessage(LogFile logObj,
                              java.lang.String msgStr,
                              boolean modalFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
logObj - the log file to which the message text should also be delivered (with a log level of "warning"), or null for none.
msgStr - the error message text to display.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).

popupErrorMessage

public void popupErrorMessage(java.lang.String msgStr,
                              boolean modalFlag,
                              boolean normalizeFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).
normalizeFlag - true to remove extra whitespace from the message text before showing it in the dialog; false to leave the text unchanged.

popupErrorMessage

public void popupErrorMessage(java.lang.String msgStr,
                              boolean modalFlag)
Displays an error message in a popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).

popupErrorMessage

public void popupErrorMessage(LogFile logObj,
                              java.lang.String msgStr)
Displays an error message in a modal popup window with an "OK" button.

Parameters:
logObj - the log file to which the message text should also be delivered (with a log level of "warning"), or null for none.
msgStr - the error message text to display.

popupErrorMessage

public void popupErrorMessage(java.lang.String msgStr)
Displays an error message in a modal popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.

popupInfoMessage

public void popupInfoMessage(java.lang.String msgStr,
                             boolean modalFlag)
Displays an informational message in a modal popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.
modalFlag - true for a modal dialog, false for non-modal (in which case this method does not wait for the popup window to be dismissed).

popupInfoMessage

public void popupInfoMessage(java.lang.String msgStr)
Displays an informational message in a modal popup window with an "OK" button.

Parameters:
msgStr - the error message text to display.

popupOKConfirmMessage

public int popupOKConfirmMessage(java.lang.String msgStr,
                                 java.lang.String titleStr,
                                 int messageType,
                                 boolean modalFlag)
Displays a user-confirmation popup dialog window with "OK" and "Cancel" buttons. This method blocks until the user selects an option button or closes the dialog window (even if 'modalFlag'==false).

Parameters:
msgStr - the message text to display.
titleStr - the window title to use.
messageType - the type of message to be displayed (primarily used to determine the icon from the pluggable Look and Feel): ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.
modalFlag - true for a modal dialog, false for non-modal.
Returns:
An integer indicating the option selected by the user, or IstiDialogPopup.CLOSED_OPTION if the user closed the dialog without selecting an option.

popupOKConfirmMessage

public int popupOKConfirmMessage(java.lang.String msgStr,
                                 java.lang.String titleStr,
                                 boolean modalFlag)
Displays a user-confirmation popup dialog window with "OK" and "Cancel" buttons. This method blocks until the user selects an option button or closes the dialog window (even if 'modalFlag'==false).

Parameters:
msgStr - the message text to display.
titleStr - the window title to use.
modalFlag - true for a modal dialog, false for non-modal.
Returns:
An integer indicating the option selected by the user: IstiDialogPopup.OK_OPTION, IstiDialogPopup.CANCEL_OPTION, or IstiDialogPopup.CLOSED_OPTION if the user closed the dialog without selecting an option.

popupYesNoConfirmMessage

public int popupYesNoConfirmMessage(java.lang.String msgStr,
                                    java.lang.String titleStr,
                                    int messageType,
                                    boolean modalFlag)
Displays a user-confirmation popup dialog window with "Yes" and "No" buttons. This method blocks until the user selects an option button or closes the dialog window (even if 'modalFlag'==false).

Parameters:
msgStr - the message text to display.
titleStr - the window title to use.
messageType - the type of message to be displayed (primarily used to determine the icon from the pluggable Look and Feel): ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE.
modalFlag - true for a modal dialog, false for non-modal.
Returns:
An integer indicating the option selected by the user: IstiDialogPopup.YES_OPTION, IstiDialogPopup.NO_OPTION, or IstiDialogPopup.CLOSED_OPTION if the user closed the dialog without selecting an option.

popupYesNoConfirmMessage

public int popupYesNoConfirmMessage(java.lang.String msgStr,
                                    java.lang.String titleStr,
                                    boolean modalFlag)
Displays a user-confirmation popup dialog window with "Yes" and "No" buttons. This method blocks until the user selects an option button or closes the dialog window (even if 'modalFlag'==false).

Parameters:
msgStr - the message text to display.
titleStr - the window title to use.
modalFlag - true for a modal dialog, false for non-modal.
Returns:
An integer indicating the option selected by the user: IstiDialogPopup.YES_OPTION, IstiDialogPopup.NO_OPTION, or IstiDialogPopup.CLOSED_OPTION if the user closed the dialog without selecting an option.

createMsgObj

public java.lang.Object createMsgObj(java.lang.String msgStr)
Creates a message object using the given string.

Parameters:
msgStr - the message string to use.
Returns:
A 'MultiLineJLabel' or 'JLabel' object constructed using the given string.