com.isti.util.gui
Class IstiDialogPopup

java.lang.Object
  extended by com.isti.util.gui.IstiDialogPopup
All Implemented Interfaces:
IstiDialogInterface, javax.swing.WindowConstants
Direct Known Subclasses:
HelpAboutDialog, IstiConnectionInfoDialog, IstiPasswordDialog, ProgressDialog

public class IstiDialogPopup
extends java.lang.Object
implements javax.swing.WindowConstants, IstiDialogInterface

Class IstiDialogPopup defines a popup dialog window that is easily configurable and programatically closeable. The other major advantage of this class over 'JOptionPane' is the ability to use non-modal dialog windows.


Nested Class Summary
static class IstiDialogPopup.CloseListener
          Class CloseListener defines a call-back method that is to be invoked when a dialog instance is closed, hidden or disposed.
 
Field Summary
static int CANCEL_OPTION
          Return value if CANCEL is chosen.
static int CLOSED_OPTION
          Return value for closed without selection.
static int DEFAULT_OPTION
          Value for 'optionType' parameter.
static int DISPOSE_ON_CLOSE
          Value for 'setDefaultCloseOperation()' method.
protected  boolean disposeDialogOnButtonFlag
           
protected  javax.swing.JDialog dlgObj
           
static int DO_NOTHING_ON_CLOSE
          Value for 'setDefaultCloseOperation()' method.
protected  boolean enforceDispatchThreadFlag
           
static int ERROR_MESSAGE
          Specifies error message type.
static int HIDE_ON_CLOSE
          Value for 'setDefaultCloseOperation()' method.
protected  boolean hideDialogOnButtonFlag
           
static int INFORMATION_MESSAGE
          Specifies information message type.
protected  java.awt.Component initialFocusCompObj
           
protected  boolean initialFocusFlag
           
protected  boolean maxHeightLimitFlag
           
protected  java.lang.String messageString
           
static int NO_AUTOBUTTONS_OPTION
          Value for 'optionType' parameter; specifies no auto-created buttons.
static int NO_OPTION
          Return value if NO is chosen.
static int OK_CANCEL_OPTION
          Value for 'optionType' parameter.
static int OK_OPTION
          Return value if OK is chosen.
protected  java.lang.Object[] optionsArr
           
protected  boolean packNeededFlag
           
protected  javax.swing.JOptionPane paneObj
           
protected  boolean parentHeightLimitFlag
           
static int PLAIN_MESSAGE
          Specifies plain message with no icon.
static int QUESTION_MESSAGE
          Specifies question message type.
protected  java.awt.Point repackCheckLocationObj
           
protected  boolean repackNeededFlag
           
protected static boolean staticEnforceDispatchThreadFlag
           
protected static boolean staticMaxHeightLimitFlag
           
protected static boolean staticParentHeightLimitFlag
           
protected  boolean waitingForShowFlag
           
static int WARNING_MESSAGE
          Specifies warning message type.
static int YES_NO_CANCEL_OPTION
          Value for 'optionType' parameter.
static int YES_NO_OPTION
          Value for 'optionType' parameter.
static int YES_OPTION
          Return value if YES is chosen.
 
Fields inherited from interface javax.swing.WindowConstants
EXIT_ON_CLOSE
 
Constructor Summary
IstiDialogPopup(java.awt.Component parentComp, javax.swing.JDialog givenDialogObj, java.lang.Object msgObj, java.lang.String titleStr, int msgType, java.lang.Object[] optionsArr, int initValIdx, boolean modalFlag, boolean createButtonFlag, int optionType)
          Creates a popup dialog window.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, boolean modalFlag, int optionType)
          Creates a plain-message popup dialog window with default buttons based on the value of 'optionType'.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType)
          Creates a plain-message modal popup dialog window with default buttons based on the value of 'optionType'.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, boolean modalFlag, int optionType)
          Creates a popup dialog window with default buttons based on the value of 'optionType'.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, int optionType)
          Creates a modal popup dialog window with default buttons based on the value of 'optionType'.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, java.lang.Object optionObj)
          Creates a popup dialog window containing a single button.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, java.lang.Object[] optionsArr, int initValIdx)
          Creates a popup dialog window.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, java.lang.Object[] optionsArr, int initValIdx, boolean modalFlag)
          Creates a popup dialog window.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, java.lang.Object[] optionsArr, int initValIdx, boolean modalFlag, boolean createButtonFlag)
          Creates a popup dialog window.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, java.lang.Object[] optionsArr, int initValIdx, boolean modalFlag, boolean createButtonFlag, int optionType)
          Creates a popup dialog window.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int msgType, java.lang.Object optionObj, boolean modalFlag)
          Creates a popup dialog window containing a single button.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, java.lang.Object optionObj)
          Creates a plain-message popup dialog window containing a single button.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, java.lang.Object[] optionsArr, int initValIdx)
          Creates a plain-message popup dialog window.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, java.lang.Object[] optionsArr, int initValIdx, boolean modalFlag)
          Creates a plain-message popup dialog window.
IstiDialogPopup(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, java.lang.Object optionObj, boolean modalFlag)
          Creates a plain-message popup dialog window containing a single button.
 
Method Summary
 void addCloseListener(IstiDialogPopup.CloseListener listenerObj)
          Adds the given "close" listener to the dialog.
 void addComponentListener(java.awt.event.ComponentListener listenerObj)
          Adds the given component listener to the dialog.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener for a specific property.
 void addWindowListener(java.awt.event.WindowListener listenerObj)
          Adds the given window listener to the dialog.
protected  boolean allowDialogClose()
          This method is invoked before the dialog is closed by pressing the OK button.
protected  boolean allowDialogClose(java.lang.Object value)
          This method is invoked before the dialog is closed by pressing a button.
 void close()
          Closes the popup dialog window.
 void close(java.lang.Object obj)
          Closes the popup dialog window.
 void closeWithWait(int maxWaitTimeMs)
          Waits (if necessary) for the popup dialog window to be visible and then closes it.
 void closeWithWait(java.lang.Object obj, int maxWaitTimeMs)
          Waits (if necessary) for the popup dialog window to be visible and then closes it.
 javax.swing.JDialog createDialog(java.awt.Component parentComponent, java.lang.String title)
          Creates and returns a new JDialog wrapping the JOptionPane for this IstiDialogPanel centered on the parentComponent in the parentComponent's frame.
 javax.swing.JDialog createDialog(javax.swing.JDialog givenDialogObj, java.awt.Component parentComponent, java.lang.String title)
          Creates and returns a new JDialog wrapping the JOptionPane for this IstiDialogPanel centered on the parentComponent in the parentComponent's frame.
 void dispose()
          Disposes the popup dialog window.
protected  void doDelayedRepack(java.awt.Component parentComp)
          Performs a repack after a slight delay (using a worker thread).
protected  void doPack()
          Causes this dialog to be sized to fit the preferred size and layouts of its subcomponents.
protected  void doSetDialogVisible(boolean flgVal)
          Sets the visibility of the dialog window.
protected  void doSetVisible(boolean flgVal)
          Sets the visibility of the dialog window.
 java.awt.Color getBackground()
          Returns the background color of the dialog.
 javax.swing.JDialog getDialogObj()
          Returns the 'JDialog' object used by this object.
 boolean getDisposeDialogOnButtonFlag()
          Returns a flag indicating whether or not the dialog will be automatically closed after any button is pressed.
 boolean getEnforceDispatchThreadFlag()
          Returns the enforce-changes-via-event-dispatch-thread flag.
 java.awt.Color getForeground()
          Returns the foreground color of the dialog.
 boolean getHideDialogOnButtonFlag()
          Returns a flag indicating whether or not the dialog will be automatically hidden after any button is pressed.
 java.lang.Object getInputValue()
          Returns the value the user has input.
 boolean getMaxHeightLimit()
          Returns the limit-height-to-the-maximum flag.
 java.lang.Object getMessageObj()
          Returns the message object displayed by this dialog.
 java.lang.String getMessageStr()
          Returns the message string displayed by this dialog.
 javax.swing.JOptionPane getOptionPaneObj()
          Returns the 'JOptionPane' object used by this object.
 boolean getParentHeightLimit()
          Returns the limit-height-to-that-of-parent flag.
 boolean getRepackNeededFlag()
          Returns a flag indicating whether or not the dialog will be repacked the first time it is shown.
static boolean getStaticEnforceDispatchThreadFlag()
          Returns the static enforce-changes-via-event-dispatch-thread flag that is used as a default on all newly-created instances.
static boolean getStaticMaxHeightLimit()
          Returns the static limit-height-to-the-maximum flag that is used as a default on all newly-created instances.
static boolean getStaticParentHeightLimit()
          Returns the static limit-height-to-that-of-parent flag that is used as a default on all newly-created instances.
 java.lang.String getTitleStr()
          Returns the title displayed by this dialog.
 java.lang.String getUserMessageString()
          Returns the user-defined message string set via the 'setMessageString()' method.
 java.lang.Object getValue()
          Returns the value the user has selected.
static java.awt.Window getWindowForComponent(java.awt.Component parentComponent)
          Returns the specified component's toplevel Frame or Dialog.
 void hide()
          Hides the popup dialog window.
 void invalidate()
          Invalidates the popup dialog window.
 boolean isModal()
          Returns the modal status of the dialog.
 boolean isShowing()
          Returns true if the popup dialog window is showing.
 boolean isVisible()
          Determines whether the popup dialog should be visible when its parent is visible.
 void pack()
          Causes this dialog to be sized to fit the preferred size and layouts of its subcomponents.
 void removeCloseListener(IstiDialogPopup.CloseListener listenerObj)
          Removes the given "close" listener from the dialog.
 void removeComponentListener(java.awt.event.ComponentListener listenerObj)
          Removes the given component listener from the dialog.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener for a specific property.
 void removeWindowListener(java.awt.event.WindowListener listenerObj)
          Removes the given window listener from the dialog.
 void repaint()
          Repaints the popup dialog window.
 void requestFocus()
          Requests that the dialog get the input focus, and that the dialog's top-level ancestor become the focused Window.
protected  void selectAndShow()
          Selects the initial button and calls the dialog's 'show()' method.
 void setBackground(java.awt.Color colorObj)
          Sets the background color of the dialog.
 void setDefaultCloseOperation(int selVal)
          Sets the operation which will happen by default when the user initiates a "close" on this dialog.
 void setDisposeDialogOnButtonFlag(boolean flgVal)
          Configures whether or not the dialog will be automatically hidden and disposed after any button is pressed.
 void setEnforceDispatchThreadFlag(boolean flgVal)
          Sets the enforce-changes-via-event-dispatch-thread flag.
 void setForeground(java.awt.Color colorObj)
          Sets the foreground color of the dialog.
 void setHideDialogOnButtonFlag(boolean flgVal)
          Configures whether or not the dialog will be automatically hidden after any button is pressed.
 void setInitialFocus()
          Requests that the current "initial" component have focus.
 void setInitialFocusComponent(java.awt.Component compObj)
          Sets the initial focus component for the dialog and requests that it have focus.
 void setLocation(int x, int y)
          Moves the dialog to a new location.
 void setLocation(java.awt.Point ptObj)
          Moves the dialog to a new location.
 void setLocationRelativeTo(java.awt.Component compObj)
          Sets the location of the dialog relative to the specified component.
 void setMaxHeightLimit(boolean flgVal)
          Sets the limit-height-to-the-maximum flag.
 void setMessageObj(java.lang.Object obj)
          Sets the message object displayed by this dialog.
 void setMessageStr(java.lang.String str)
          Sets the message object displayed by this dialog to the given string.
 void setModal(boolean modalFlag)
          Specifies whether this dialog should be modal.
 void setOptionPaneValue(java.lang.Object obj)
          Sets the value that will be returned by the 'getValue()' method.
 void setParentHeightLimit(boolean flgVal)
          Sets the limit-height-to-that-of-parent flag.
 void setRepackNeededFlag(boolean flgVal)
          Configures whether or not the dialog will be repacked the first time it is shown.
 void setResizable(boolean resizableFlag)
          Sets whether the dialog is resizable by the user.
 void setSize(java.awt.Dimension dimObj)
          Sets the size of the dialog.
 void setSize(int width, int height)
          Sets the size of the dialog.
static void setStaticEnforceDispatchThreadFlag(boolean flgVal)
          Sets the static enforce-changes-via-event-dispatch-thread flag that is used as a default on all newly-created instances.
static void setStaticMaxHeightLimit(boolean flgVal)
          Sets the static limit-height-to-the-maximum flag that is used as a default on all newly-created instances.
static void setStaticParentHeightLimit(boolean flgVal)
          Sets the static limit-height-to-that-of-parent flag that is used as a default on all newly-created instances.
 void setTitleStr(java.lang.String str)
          Sets the title displayed by this dialog.
 void setUserMessageString(java.lang.String str)
          Sets a user-defined message string that may be fetched via the 'getMessageString()' method.
 void setVisible(boolean flgVal)
          Sets the visibility of the dialog window.
 void setVisibleViaInvokeLater(boolean flgVal)
          Sets the visibility of the dialog window, using the event-dispatch thread via a call to 'SwingUtilities.invokeLater()'.
 java.lang.Object show()
          Displays the popup dialog window.
 int showAndReturnIndex()
          Displays a popup option dialog window.
 java.lang.Object showAndWait()
          Displays the popup dialog window.
static int showMessageDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr)
          Creates and displays a modal information-message popup dialog window with a default "OK" button.
static int showMessageDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, boolean modalFlag, boolean waitFlag)
          Creates and displays a information-message popup dialog window with a default "OK" button.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType)
          Creates and displays a plain-message modal popup dialog window with default buttons based on the value of 'optionType'.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType, boolean modalFlag, boolean waitFlag)
          Creates and displays a plain-message popup dialog window with default buttons based on the value of 'optionType'.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType, int msgType)
          Creates and displays a modal popup dialog window with default buttons based on the value of 'optionType'.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType, int msgType, boolean modalFlag, boolean waitFlag)
          Creates and displays a popup dialog window with default buttons based on the value of 'optionType'.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType, int msgType, java.lang.Object[] optionsArr, int initValIdx)
          Creates and displays a modal popup dialog window.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType, int msgType, java.lang.Object[] optionsArr, int initValIdx, boolean modalFlag, boolean waitFlag)
          Creates and displays a popup dialog window.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType, int msgType, java.lang.Object[] optionsArr, java.lang.Object initialValue)
          Creates and displays a modal popup dialog window.
static int showOptionDialog(java.awt.Component parentComp, java.lang.Object msgObj, java.lang.String titleStr, int optionType, int msgType, java.lang.Object[] optionsArr, java.lang.Object initialValue, boolean modalFlag, boolean waitFlag)
          Creates and displays a popup dialog window.
 void validate()
          Validates the popup dialog window.
 boolean waitForDialogVisible(int maxWaitTimeMs)
          Waits for the popup dialog window to be visible, up to the given maximum time value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paneObj

protected final javax.swing.JOptionPane paneObj

dlgObj

protected final javax.swing.JDialog dlgObj

messageString

protected java.lang.String messageString

initialFocusCompObj

protected java.awt.Component initialFocusCompObj

initialFocusFlag

protected boolean initialFocusFlag

packNeededFlag

protected boolean packNeededFlag

repackNeededFlag

protected boolean repackNeededFlag

repackCheckLocationObj

protected java.awt.Point repackCheckLocationObj

waitingForShowFlag

protected boolean waitingForShowFlag

hideDialogOnButtonFlag

protected boolean hideDialogOnButtonFlag

disposeDialogOnButtonFlag

protected boolean disposeDialogOnButtonFlag

optionsArr

protected final java.lang.Object[] optionsArr

staticEnforceDispatchThreadFlag

protected static boolean staticEnforceDispatchThreadFlag

enforceDispatchThreadFlag

protected boolean enforceDispatchThreadFlag

staticParentHeightLimitFlag

protected static boolean staticParentHeightLimitFlag

parentHeightLimitFlag

protected boolean parentHeightLimitFlag

staticMaxHeightLimitFlag

protected static boolean staticMaxHeightLimitFlag

maxHeightLimitFlag

protected boolean maxHeightLimitFlag

ERROR_MESSAGE

public static final int ERROR_MESSAGE
Specifies error message type. Same value as in JOptionPane.

See Also:
Constant Field Values

INFORMATION_MESSAGE

public static final int INFORMATION_MESSAGE
Specifies information message type. Same value as in JOptionPane.

See Also:
Constant Field Values

WARNING_MESSAGE

public static final int WARNING_MESSAGE
Specifies warning message type. Same value as in JOptionPane.

See Also:
Constant Field Values

QUESTION_MESSAGE

public static final int QUESTION_MESSAGE
Specifies question message type. Same value as in JOptionPane.

See Also:
Constant Field Values

PLAIN_MESSAGE

public static final int PLAIN_MESSAGE
Specifies plain message with no icon. Same value as in JOptionPane.

See Also:
Constant Field Values

DEFAULT_OPTION

public static final int DEFAULT_OPTION
Value for 'optionType' parameter. Same value as in JOptionPane.

See Also:
Constant Field Values

YES_NO_OPTION

public static final int YES_NO_OPTION
Value for 'optionType' parameter. Same value as in JOptionPane.

See Also:
Constant Field Values

YES_NO_CANCEL_OPTION

public static final int YES_NO_CANCEL_OPTION
Value for 'optionType' parameter. Same value as in JOptionPane.

See Also:
Constant Field Values

OK_CANCEL_OPTION

public static final int OK_CANCEL_OPTION
Value for 'optionType' parameter. Same value as in JOptionPane.

See Also:
Constant Field Values

NO_AUTOBUTTONS_OPTION

public static final int NO_AUTOBUTTONS_OPTION
Value for 'optionType' parameter; specifies no auto-created buttons.

See Also:
Constant Field Values

YES_OPTION

public static final int YES_OPTION
Return value if YES is chosen. Same as in JOptionPane.

See Also:
Constant Field Values

NO_OPTION

public static final int NO_OPTION
Return value if NO is chosen. Same as in JOptionPane.

See Also:
Constant Field Values

CANCEL_OPTION

public static final int CANCEL_OPTION
Return value if CANCEL is chosen. Same as in JOptionPane.

See Also:
Constant Field Values

OK_OPTION

public static final int OK_OPTION
Return value if OK is chosen. Same as in JOptionPane.

See Also:
Constant Field Values

CLOSED_OPTION

public static final int CLOSED_OPTION
Return value for closed without selection. Same as in JOptionPane.

See Also:
Constant Field Values

DISPOSE_ON_CLOSE

public static final int DISPOSE_ON_CLOSE
Value for 'setDefaultCloseOperation()' method.

See Also:
Constant Field Values

DO_NOTHING_ON_CLOSE

public static final int DO_NOTHING_ON_CLOSE
Value for 'setDefaultCloseOperation()' method.

See Also:
Constant Field Values

HIDE_ON_CLOSE

public static final int HIDE_ON_CLOSE
Value for 'setDefaultCloseOperation()' method.

See Also:
Constant Field Values
Constructor Detail

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       javax.swing.JDialog givenDialogObj,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       java.lang.Object[] optionsArr,
                       int initValIdx,
                       boolean modalFlag,
                       boolean createButtonFlag,
                       int optionType)
Creates a popup dialog window.

Parameters:
parentComp - the parent component for the popup.
givenDialogObj - A 'JDialog' to be used, or null to have a new one created.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for default or no buttons, based on 'optionType'.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.
modalFlag - true for modal, false for modeless (allows other windows to run).
createButtonFlag - if true and the given 'optionsArr' contains a single non-Component item and the given 'modalFlag' is false then the button created for 'optionObj' will dispose the dialog (in addition to hiding it) when used.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION. If default buttons are created and the user selects one then the object value returned by 'show()' or 'getValue()' will be an 'Integer' object wrapping one of the 'JOptionPane' values (such as 'OK_OPTION').

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       java.lang.Object[] optionsArr,
                       int initValIdx,
                       boolean modalFlag,
                       boolean createButtonFlag,
                       int optionType)
Creates a popup dialog window.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for default or no buttons, based on 'optionType'.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.
modalFlag - true for modal, false for modeless (allows other windows to run).
createButtonFlag - if true and the given 'optionsArr' contains a single non-Component item and the given 'modalFlag' is false then the button created for 'optionObj' will dispose the dialog (in addition to hiding it) when used.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION. If default buttons are created and the user selects one then the object value returned by 'show()' or 'getValue()' will be an 'Integer' object wrapping one of the 'JOptionPane' values (such as 'OK_OPTION').

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       java.lang.Object[] optionsArr,
                       int initValIdx,
                       boolean modalFlag,
                       boolean createButtonFlag)
Creates a popup dialog window.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for no buttons.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.
modalFlag - true for modal, false for modeless (allows other windows to run).
createButtonFlag - if true and the given 'optionsArr' contains a single non-Component item and the given 'modalFlag' is false then the button created for 'optionObj' will dispose the dialog (in addition to hiding it) when used.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       java.lang.Object[] optionsArr,
                       int initValIdx,
                       boolean modalFlag)
Creates a popup dialog window.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for no buttons.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.
modalFlag - true for modal, false for modeless (allows other windows to run).

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       java.lang.Object[] optionsArr,
                       int initValIdx,
                       boolean modalFlag)
Creates a plain-message popup dialog window.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionsArr - an array of Objects that defines what buttons are shown, or null for no buttons.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.
modalFlag - true for modal, false for modeless (allows other windows to run).

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       java.lang.Object[] optionsArr,
                       int initValIdx)
Creates a popup dialog window. By default the dialog is modal.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for no buttons.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       java.lang.Object[] optionsArr,
                       int initValIdx)
Creates a plain-message popup dialog window. By default the dialog is modal.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionsArr - an array of Objects that defines what buttons are shown, or null for no buttons.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       java.lang.Object optionObj,
                       boolean modalFlag)
Creates a popup dialog window containing a single button. If the given 'optionObj' is not a Component and the given 'modalFlag' is false then the button created for 'optionObj' will dispose the dialog (in addition to hiding it) when used.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionObj - the Object that defines the button, or null to display no buttons.
modalFlag - true for modal, false for modeless (allows other windows to run).

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       java.lang.Object optionObj,
                       boolean modalFlag)
Creates a plain-message popup dialog window containing a single button.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionObj - the Object that defines the button, or null to display no buttons.
modalFlag - true for modal, false for modeless (allows other windows to run).

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       java.lang.Object optionObj)
Creates a popup dialog window containing a single button. By default the dialog is modal.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionObj - the Object that defines the button, or null to display no buttons.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       java.lang.Object optionObj)
Creates a plain-message popup dialog window containing a single button. By default the dialog is modal.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionObj - the Object that defines the button, or null to display no buttons.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       boolean modalFlag,
                       int optionType)
Creates a popup dialog window with default buttons based on the value of 'optionType'. If the user selects a default button then the object value returned by 'show()' or 'getValue()' will be an 'Integer' object wrapping one of the 'JOptionPane' values (such as 'OK_OPTION').

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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 modal, false for modeless (allows other windows to run).
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int msgType,
                       int optionType)
Creates a modal popup dialog window with default buttons based on the value of 'optionType'. If the user selects a default button then the object value returned by 'show()' or 'getValue()' will be an 'Integer' object wrapping one of the 'JOptionPane' values (such as 'OK_OPTION').

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
msgType - 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.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       boolean modalFlag,
                       int optionType)
Creates a plain-message popup dialog window with default buttons based on the value of 'optionType'. If the user selects a default button then the object value returned by 'show()' or 'getValue()' will be an 'Integer' object wrapping one of the 'JOptionPane' values (such as 'OK_OPTION').

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
modalFlag - true for modal, false for modeless (allows other windows to run).
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.

IstiDialogPopup

public IstiDialogPopup(java.awt.Component parentComp,
                       java.lang.Object msgObj,
                       java.lang.String titleStr,
                       int optionType)
Creates a plain-message modal popup dialog window with default buttons based on the value of 'optionType'. If the user selects a default button then the object value returned by 'show()' or 'getValue()' will be an 'Integer' object wrapping one of the 'JOptionPane' values (such as 'OK_OPTION').

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
Method Detail

setStaticEnforceDispatchThreadFlag

public static void setStaticEnforceDispatchThreadFlag(boolean flgVal)
Sets the static enforce-changes-via-event-dispatch-thread flag that is used as a default on all newly-created instances.

Parameters:
flgVal - true to make changes occur via the event-dispatch thread, false to not.

getStaticEnforceDispatchThreadFlag

public static boolean getStaticEnforceDispatchThreadFlag()
Returns the static enforce-changes-via-event-dispatch-thread flag that is used as a default on all newly-created instances.

Returns:
true if changes are made to occur via the event-dispatch thread, false if not.

setEnforceDispatchThreadFlag

public void setEnforceDispatchThreadFlag(boolean flgVal)
Sets the enforce-changes-via-event-dispatch-thread flag.

Parameters:
flgVal - true to make changes occur via the event-dispatch thread, false to not.

getEnforceDispatchThreadFlag

public boolean getEnforceDispatchThreadFlag()
Returns the enforce-changes-via-event-dispatch-thread flag.

Returns:
true if changes are made to occur via the event-dispatch thread, false if not.

setStaticParentHeightLimit

public static void setStaticParentHeightLimit(boolean flgVal)
Sets the static limit-height-to-that-of-parent flag that is used as a default on all newly-created instances.

Parameters:
flgVal - true to limit the height of the dialog to be no taller than its parent component, false to not.

getStaticParentHeightLimit

public static boolean getStaticParentHeightLimit()
Returns the static limit-height-to-that-of-parent flag that is used as a default on all newly-created instances.

Returns:
true if the height of the dialog is limited to be no taller than its parent component, false if not.

setParentHeightLimit

public void setParentHeightLimit(boolean flgVal)
Sets the limit-height-to-that-of-parent flag.

Parameters:
flgVal - true to limit the height of the dialog to be no taller than its parent component, false to not.

getParentHeightLimit

public boolean getParentHeightLimit()
Returns the limit-height-to-that-of-parent flag.

Returns:
true if the height of the dialog is limited to be no taller than its parent component, false if not.

setStaticMaxHeightLimit

public static void setStaticMaxHeightLimit(boolean flgVal)
Sets the static limit-height-to-the-maximum flag that is used as a default on all newly-created instances.

Parameters:
flgVal - true to limit the height of the dialog to be no taller than the maximum, false to not.

getStaticMaxHeightLimit

public static boolean getStaticMaxHeightLimit()
Returns the static limit-height-to-the-maximum flag that is used as a default on all newly-created instances.

Returns:
true if the height of the dialog is limited to be no taller than the maximum, false if not.

setMaxHeightLimit

public void setMaxHeightLimit(boolean flgVal)
Sets the limit-height-to-the-maximum flag.

Parameters:
flgVal - true to limit the height of the dialog to be no taller than the maximum, false to not.

getMaxHeightLimit

public boolean getMaxHeightLimit()
Returns the limit-height-to-the-maximum flag.

Returns:
true if the height of the dialog is limited to be no taller than the maximum, false if not.

createDialog

public final javax.swing.JDialog createDialog(javax.swing.JDialog givenDialogObj,
                                              java.awt.Component parentComponent,
                                              java.lang.String title)
Creates and returns a new JDialog wrapping the JOptionPane for this IstiDialogPanel centered on the parentComponent in the parentComponent's frame. title is the title of the returned dialog. The returned JDialog will be set up such that once it is closed, or the user clicks on one of the buttons, the optionpane's value property will be set accordingly and the dialog will be closed. Each time the dialog is made visible, it will reset the option pane's value property to JOptionPane.UNINITIALIZED_VALUE to ensure the user's subsequent action closes the dialog properly.

Parameters:
givenDialogObj - A 'JDialog' to be used, or null to have a new one created.
parentComponent - determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used
title - the title string for the dialog
Returns:
a new JDialog containing this instance
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()

allowDialogClose

protected boolean allowDialogClose()
This method is invoked before the dialog is closed by pressing the OK button. This method should be overridden to prevent the dialog from being closed.

Returns:
true to allow the dialog to be closed, false otherwise.

allowDialogClose

protected boolean allowDialogClose(java.lang.Object value)
This method is invoked before the dialog is closed by pressing a button. This method should be overridden to prevent the dialog from being closed.

Parameters:
value - The Object chosen by the user.
Returns:
true to allow the dialog to be closed, false otherwise.

createDialog

public final javax.swing.JDialog createDialog(java.awt.Component parentComponent,
                                              java.lang.String title)
Creates and returns a new JDialog wrapping the JOptionPane for this IstiDialogPanel centered on the parentComponent in the parentComponent's frame. title is the title of the returned dialog. The returned JDialog will be set up such that once it is closed, or the user clicks on one of the buttons, the optionpane's value property will be set accordingly and the dialog will be closed. Each time the dialog is made visible, it will reset the option pane's value property to JOptionPane.UNINITIALIZED_VALUE to ensure the user's subsequent action closes the dialog properly.

Parameters:
parentComponent - determines the frame in which the dialog is displayed; if the parentComponent has no Frame, a default Frame is used
title - the title string for the dialog
Returns:
a new JDialog containing this instance
Throws:
java.awt.HeadlessException - if GraphicsEnvironment.isHeadless returns true
See Also:
GraphicsEnvironment.isHeadless()

setHideDialogOnButtonFlag

public void setHideDialogOnButtonFlag(boolean flgVal)
Configures whether or not the dialog will be automatically hidden after any button is pressed. If this method is not called then the dialog will default to being automatically hidden after any button is pressed.

Parameters:
flgVal - true to be hidden after any button is pressed; false to remain open (in which case the hiding and disposing of the dialog will need to be handled by the calling code).

getHideDialogOnButtonFlag

public boolean getHideDialogOnButtonFlag()
Returns a flag indicating whether or not the dialog will be automatically hidden after any button is pressed.

Returns:
true if hidden after any button is pressed; false if remaining open (in which case the hiding and disposing of the dialog will need to be handled by the calling code).

setDisposeDialogOnButtonFlag

public void setDisposeDialogOnButtonFlag(boolean flgVal)
Configures whether or not the dialog will be automatically hidden and disposed after any button is pressed. If this method is not called then the dialog will default to not automatically being disposed after a button is pressed (this matches the default for Java 1.4 but not Java 1.3).

Parameters:
flgVal - true to hide and dispose after any button is pressed; false to not dispose (in which case the disposing of the dialog will need to be handled by the calling code).

getDisposeDialogOnButtonFlag

public boolean getDisposeDialogOnButtonFlag()
Returns a flag indicating whether or not the dialog will be automatically closed after any button is pressed.

Returns:
true if closed after any button is pressed; false if remaining open (in which case the hiding and disposing of the dialog will need to be handled by the calling code).

setRepackNeededFlag

public void setRepackNeededFlag(boolean flgVal)
Configures whether or not the dialog will be repacked the first time it is shown. The can help the layout of components whose dimension are undetermined until laid out (like 'JTextArea' with word-wrapping enabled), but it can hurt the layout of components whose contents are loaded after the component is shown (like 'ViewHTMLPanel' and some uses of 'JEditorPane'). If this method is not called then the dialog will default to not doing the repack.

Parameters:
flgVal - true to have the dialog repacked the first time it is shown; false to not.

getRepackNeededFlag

public boolean getRepackNeededFlag()
Returns a flag indicating whether or not the dialog will be repacked the first time it is shown.

Returns:
true if the dialog is to be repacked the first time it is shown; false if not.

doDelayedRepack

protected void doDelayedRepack(java.awt.Component parentComp)
Performs a repack after a slight delay (using a worker thread).

Parameters:
parentComp - parent component to be recentered upon after repack, or null for no recentering.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all properties. A PropertyChangeEvent will get fired in response to setting a bound property, such as setFont, setBackground, or setForeground.

Parameters:
listener - the PropertyChangeListener to be added.

addPropertyChangeListener

public void addPropertyChangeListener(java.lang.String propertyName,
                                      java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. If listener is null, no exception is thrown and no action is performed.

Parameters:
propertyName - the name of the property to listen on.
listener - the PropertyChangeListener to be added.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - the PropertyChangeListener to be removed.

removePropertyChangeListener

public void removePropertyChangeListener(java.lang.String propertyName,
                                         java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener for a specific property. If listener is null, no exception is thrown and no action is performed.

Parameters:
propertyName - the name of the property that was listened on.
listener - the PropertyChangeListener to be removed.

show

public java.lang.Object show()
Displays the popup dialog window. If the dialog is modal then this method blocks until the dialog is dismissed by the user or the 'close()' method is called.

Specified by:
show in interface IstiDialogInterface
Returns:
The Object chosen by the user (UNINITIALIZED_VALUE if the user has not yet made a choice, or null if the user closed the window without making a choice) or the value entered via the 'close()' method.

showAndWait

public java.lang.Object showAndWait()
Displays the popup dialog window. The method blocks until the dialog is dismissed by the user or the 'close()' method is called (even if the window is non-modal).

Specified by:
showAndWait in interface IstiDialogInterface
Returns:
The Object chosen by the user (UNINITIALIZED_VALUE if the user has not yet made a choice, or null if the user closed the window without making a choice) or the value entered via the 'close()' method.

showAndReturnIndex

public int showAndReturnIndex()
Displays a popup option dialog window. The method blocks until the dialog is dismissed by the user or the 'close()' method is called (even if the window is non-modal). The returned value will be one of the "..._OPTION" values, or the index corresponding to the constructor-parameter 'optionsArr[]' entry selected by the user.

Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option.

setVisible

public void setVisible(boolean flgVal)
Sets the visibility of the dialog window. If the dialog is non-modal then the call is redirected to the dialog object's 'show()' or 'hide()' method (depending on the state of the given flag parameter).

Specified by:
setVisible in interface IstiDialogInterface
Parameters:
flgVal - true for visible, false for hidden.

doPack

protected void doPack()
Causes this dialog to be sized to fit the preferred size and layouts of its subcomponents. If the dialog and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.


doSetDialogVisible

protected void doSetDialogVisible(boolean flgVal)
Sets the visibility of the dialog window.

Parameters:
flgVal - true for visible, false for hidden.

doSetVisible

protected void doSetVisible(boolean flgVal)
Sets the visibility of the dialog window. If the dialog is non-modal then the call is redirected to the dialog object's 'show()' or 'hide()' method (depending on the state of the given flag parameter).

Parameters:
flgVal - true for visible, false for hidden.

setVisibleViaInvokeLater

public void setVisibleViaInvokeLater(boolean flgVal)
Sets the visibility of the dialog window, using the event-dispatch thread via a call to 'SwingUtilities.invokeLater()'. This allows a modal dialog to be shown without blocking the invoking thread.

Specified by:
setVisibleViaInvokeLater in interface IstiDialogInterface
Parameters:
flgVal - true for visible, false for hidden.

selectAndShow

protected void selectAndShow()
Selects the initial button and calls the dialog's 'show()' method.


isVisible

public boolean isVisible()
Determines whether the popup dialog should be visible when its parent is visible.

Specified by:
isVisible in interface IstiDialogInterface
Returns:
true if the popup dialog is visible; false otherwise.

isShowing

public boolean isShowing()
Returns true if the popup dialog window is showing.

Specified by:
isShowing in interface IstiDialogInterface
Returns:
true if the popup dialog window is showing, false if not.

waitForDialogVisible

public boolean waitForDialogVisible(int maxWaitTimeMs)
Waits for the popup dialog window to be visible, up to the given maximum time value.

Specified by:
waitForDialogVisible in interface IstiDialogInterface
Parameters:
maxWaitTimeMs - the maximum time to wait, in milliseconds.
Returns:
true if the dialog is visible, false if the maximum time was reached without the dialog being visible.

close

public void close(java.lang.Object obj)
Closes the popup dialog window. This method performs 'hide()' followed by 'dispose()'. Calling 'hide()' (and not dispose()') on a non-modal dialog that is minimized can result in the dialog becoming "stuck".

Specified by:
close in interface IstiDialogInterface
Parameters:
obj - the value to be returned via the 'show()' or 'showAndWait()' method.

close

public void close()
Closes the popup dialog window. This method performs 'hide()' followed by 'dispose()'. Calling 'hide()' (and not dispose()') on a non-modal dialog that is minimized can result in the dialog becoming "stuck".

Specified by:
close in interface IstiDialogInterface

closeWithWait

public void closeWithWait(java.lang.Object obj,
                          int maxWaitTimeMs)
Waits (if necessary) for the popup dialog window to be visible and then closes it.

Specified by:
closeWithWait in interface IstiDialogInterface
Parameters:
obj - the value to be returned via the 'show()' or 'showAndWait()' method.
maxWaitTimeMs - the maximum time to wait for the popup dialog window to be visible, in milliseconds.

closeWithWait

public void closeWithWait(int maxWaitTimeMs)
Waits (if necessary) for the popup dialog window to be visible and then closes it.

Specified by:
closeWithWait in interface IstiDialogInterface
Parameters:
maxWaitTimeMs - the maximum time to wait for the popup dialog window to be visible, in milliseconds.

hide

public void hide()
Hides the popup dialog window. Calling 'hide()' (and not dispose()') on a non-modal dialog that is minimized can result in the dialog becoming "stuck".

Specified by:
hide in interface IstiDialogInterface

dispose

public void dispose()
Disposes the popup dialog window.

Specified by:
dispose in interface IstiDialogInterface

repaint

public void repaint()
Repaints the popup dialog window.

Specified by:
repaint in interface IstiDialogInterface

validate

public void validate()
Validates the popup dialog window.

Specified by:
validate in interface IstiDialogInterface

invalidate

public void invalidate()
Invalidates the popup dialog window.

Specified by:
invalidate in interface IstiDialogInterface

pack

public void pack()
Causes this dialog to be sized to fit the preferred size and layouts of its subcomponents. If the dialog and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.

Specified by:
pack in interface IstiDialogInterface

setSize

public void setSize(int width,
                    int height)
Sets the size of the dialog.

Specified by:
setSize in interface IstiDialogInterface
Parameters:
width - the width to use.
height - the height to use.

setSize

public void setSize(java.awt.Dimension dimObj)
Sets the size of the dialog.

Parameters:
dimObj - the dimension of width and height to use.

setResizable

public void setResizable(boolean resizableFlag)
Sets whether the dialog is resizable by the user.

Specified by:
setResizable in interface IstiDialogInterface
Parameters:
resizableFlag - true if the user can resize this dialog; false otherwise.

setLocation

public void setLocation(int x,
                        int y)
Moves the dialog to a new location. The top-left corner of the new location is specified by the x and y parameters in the coordinate space of this component's parent.

Specified by:
setLocation in interface IstiDialogInterface
Parameters:
x - The x-coordinate of the new location's top-left corner in the parent's coordinate space.
y - The y-coordinate of the new location's top-left corner in the parent's coordinate space.

setLocation

public void setLocation(java.awt.Point ptObj)
Moves the dialog to a new location. The top-left corner of the new location is specified by point p. Point p is given in the parent's coordinate space.

Parameters:
ptObj - The point defining the top-left corner of the new location, given in the coordinate space of this component's parent.

setLocationRelativeTo

public void setLocationRelativeTo(java.awt.Component compObj)
Sets the location of the dialog relative to the specified component. If the component is not currently showing, the dialog is centered on the screen.

Parameters:
compObj - the component in relation to which the dialog's location is determined.

requestFocus

public void requestFocus()
Requests that the dialog get the input focus, and that the dialog's top-level ancestor become the focused Window.

Specified by:
requestFocus in interface IstiDialogInterface

setModal

public void setModal(boolean modalFlag)
Specifies whether this dialog should be modal.

Specified by:
setModal in interface IstiDialogInterface
Parameters:
modalFlag - true for modal, false for modeless (allows other windows to run).

isModal

public boolean isModal()
Returns the modal status of the dialog.

Specified by:
isModal in interface IstiDialogInterface
Returns:
true if modal, false if modeless (allows other windows to run).

setDefaultCloseOperation

public void setDefaultCloseOperation(int selVal)
Sets the operation which will happen by default when the user initiates a "close" on this dialog. The possible choices are: DO_NOTHING_ON_CLOSE - do not do anything - require the program to handle the operation in the windowClosing method of a registered WindowListener object; HIDE_ON_CLOSE - automatically hide the dialog after invoking any registered WindowListener objects; DISPOSE_ON_CLOSE - automatically hide and dispose the dialog after invoking any registered WindowListener objects. The value is set to HIDE_ON_CLOSE by default.

Specified by:
setDefaultCloseOperation in interface IstiDialogInterface
Parameters:
selVal - one of the following constants: DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, or HIDE_ON_CLOSE.

setForeground

public void setForeground(java.awt.Color colorObj)
Sets the foreground color of the dialog.

Parameters:
colorObj - to color object to use.

getForeground

public java.awt.Color getForeground()
Returns the foreground color of the dialog.

Returns:
the foreground color object.

setBackground

public void setBackground(java.awt.Color colorObj)
Sets the background color of the dialog.

Parameters:
colorObj - to color object to use.

getBackground

public java.awt.Color getBackground()
Returns the background color of the dialog.

Returns:
the background color object.

setMessageObj

public void setMessageObj(java.lang.Object obj)
Sets the message object displayed by this dialog.

Specified by:
setMessageObj in interface IstiDialogInterface
Parameters:
obj - the message obj.

getMessageObj

public java.lang.Object getMessageObj()
Returns the message object displayed by this dialog.

Specified by:
getMessageObj in interface IstiDialogInterface
Returns:
The message obj.

setMessageStr

public void setMessageStr(java.lang.String str)
Sets the message object displayed by this dialog to the given string.

Specified by:
setMessageStr in interface IstiDialogInterface
Parameters:
str - the message string.

getMessageStr

public java.lang.String getMessageStr()
Returns the message string displayed by this dialog.

Specified by:
getMessageStr in interface IstiDialogInterface
Returns:
The message String object, or null if a String object could not be retrieved.

setTitleStr

public void setTitleStr(java.lang.String str)
Sets the title displayed by this dialog.

Specified by:
setTitleStr in interface IstiDialogInterface
Parameters:
str - the title string to display.

getTitleStr

public java.lang.String getTitleStr()
Returns the title displayed by this dialog.

Specified by:
getTitleStr in interface IstiDialogInterface
Returns:
The title string.

addCloseListener

public void addCloseListener(IstiDialogPopup.CloseListener listenerObj)
Adds the given "close" listener to the dialog. The listener's call-back method will be invoked when a dialog instance is closed, hidden or disposed. See the 'CloseListener' description for more information.

Parameters:
listenerObj - the "close" listener object to add.

removeCloseListener

public void removeCloseListener(IstiDialogPopup.CloseListener listenerObj)
Removes the given "close" listener from the dialog.

Parameters:
listenerObj - the "close" listener object to remove.

addWindowListener

public void addWindowListener(java.awt.event.WindowListener listenerObj)
Adds the given window listener to the dialog.

Parameters:
listenerObj - the window listener to add.

removeWindowListener

public void removeWindowListener(java.awt.event.WindowListener listenerObj)
Removes the given window listener from the dialog.

Parameters:
listenerObj - the window listener to remove.

addComponentListener

public void addComponentListener(java.awt.event.ComponentListener listenerObj)
Adds the given component listener to the dialog.

Parameters:
listenerObj - the component listener to add.

removeComponentListener

public void removeComponentListener(java.awt.event.ComponentListener listenerObj)
Removes the given component listener from the dialog.

Parameters:
listenerObj - the component listener to remove.

getDialogObj

public javax.swing.JDialog getDialogObj()
Returns the 'JDialog' object used by this object.

Returns:
A 'JDialog' object.

getOptionPaneObj

public javax.swing.JOptionPane getOptionPaneObj()
Returns the 'JOptionPane' object used by this object.

Returns:
A 'JOptionPane' object.

getInputValue

public java.lang.Object getInputValue()
Returns the value the user has input.

Specified by:
getInputValue in interface IstiDialogInterface
Returns:
The Object the user specified.

getValue

public java.lang.Object getValue()
Returns the value the user has selected. UNINITIALIZED_VALUE implies the user has not yet made a choice, null means the user closed the window with out choosing anything. Otherwise the returned value will be one of the options defined in this object.

Specified by:
getValue in interface IstiDialogInterface
Returns:
The Object chosen by the user, UNINITIALIZED_VALUE if the user has not yet made a choice, or null if the user closed the window without making a choice.

setOptionPaneValue

public void setOptionPaneValue(java.lang.Object obj)
Sets the value that will be returned by the 'getValue()' method. Entering a new value will usually close the dialog.

Parameters:
obj - the value object to set.

setUserMessageString

public void setUserMessageString(java.lang.String str)
Sets a user-defined message string that may be fetched via the 'getMessageString()' method.

Specified by:
setUserMessageString in interface IstiDialogInterface
Parameters:
str - the message text.

getUserMessageString

public java.lang.String getUserMessageString()
Returns the user-defined message string set via the 'setMessageString()' method.

Specified by:
getUserMessageString in interface IstiDialogInterface
Returns:
The message text, or null if none has been set.

setInitialFocusComponent

public void setInitialFocusComponent(java.awt.Component compObj)
Sets the initial focus component for the dialog and requests that it have focus.

Parameters:
compObj - the component to use.

setInitialFocus

public void setInitialFocus()
Requests that the current "initial" component have focus.

Specified by:
setInitialFocus in interface IstiDialogInterface

getWindowForComponent

public static java.awt.Window getWindowForComponent(java.awt.Component parentComponent)
Returns the specified component's toplevel Frame or Dialog.

Parameters:
parentComponent - the Component to check for a Frame or Dialog
Returns:
the Frame or Dialog that contains the component, or the default frame if the component is null, or does not have a valid Frame or Dialog parent

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType,
                                   int msgType,
                                   java.lang.Object[] optionsArr,
                                   java.lang.Object initialValue,
                                   boolean modalFlag,
                                   boolean waitFlag)
Creates and displays a popup dialog window.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for default or no buttons, based on 'optionType'.
initialValue - the object that represents the default selection for the dialog.
modalFlag - true for modal, false for modeless (allows other windows to run).
waitFlag - if false and 'modalFlag' is false then this method will not wait for the dialog window to be dismissed; otherwise this method blocks until the dialog window is dismissed.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option or if the method returned before the dialog was dismissed (running non-modal with 'waitFlag'==false).

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType,
                                   int msgType,
                                   java.lang.Object[] optionsArr,
                                   int initValIdx,
                                   boolean modalFlag,
                                   boolean waitFlag)
Creates and displays a popup dialog window.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for default or no buttons, based on 'optionType'.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.
modalFlag - true for modal, false for modeless (allows other windows to run).
waitFlag - if false and 'modalFlag' is false then this method will not wait for the dialog window to be dismissed; otherwise this method blocks until the dialog window is dismissed.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option or if the method returned before the dialog was dismissed (running non-modal with 'waitFlag'==false).

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType,
                                   int msgType,
                                   java.lang.Object[] optionsArr,
                                   java.lang.Object initialValue)
Creates and displays a modal popup dialog window. This method blocks until the dialog window is dismissed.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for default or no buttons, based on 'optionType'.
initialValue - the object that represents the default selection for the dialog.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option.

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType,
                                   int msgType,
                                   java.lang.Object[] optionsArr,
                                   int initValIdx)
Creates and displays a modal popup dialog window. This method blocks until the dialog window is dismissed.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
msgType - 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.
optionsArr - an array of Objects that defines what buttons are shown, or null for default or no buttons, based on 'optionType'.
initValIdx - the index of the 'optionsArr[]' object corresponding to the option to be selected by default.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option.

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType,
                                   int msgType,
                                   boolean modalFlag,
                                   boolean waitFlag)
Creates and displays a popup dialog window with default buttons based on the value of 'optionType'. This method blocks until the dialog window is dismissed (even if 'modalFlag' is false).

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
msgType - 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 modal, false for modeless (allows other windows to run).
waitFlag - if false and 'modalFlag' is false then this method will not wait for the dialog window to be dismissed; otherwise this method blocks until the dialog window is dismissed.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option or if the method returned before the dialog was dismissed (running non-modal with 'waitFlag'==false).

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType,
                                   int msgType)
Creates and displays a modal popup dialog window with default buttons based on the value of 'optionType'. This method blocks until the dialog window is dismissed.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
msgType - 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.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option.

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType,
                                   boolean modalFlag,
                                   boolean waitFlag)
Creates and displays a plain-message popup dialog window with default buttons based on the value of 'optionType'. This method blocks until the dialog window is dismissed (even if 'modalFlag' is false).

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
modalFlag - true for modal, false for modeless (allows other windows to run).
waitFlag - if false and 'modalFlag' is false then this method will not wait for the dialog window to be dismissed; otherwise this method blocks until the dialog window is dismissed.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option or if the method returned before the dialog was dismissed (running non-modal with 'waitFlag'==false).

showOptionDialog

public static int showOptionDialog(java.awt.Component parentComp,
                                   java.lang.Object msgObj,
                                   java.lang.String titleStr,
                                   int optionType)
Creates and displays a plain-message modal popup dialog window with default buttons based on the value of 'optionType'. This method blocks until the dialog window is dismissed.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
optionType - specifies what default option buttons to automatically create if 'optionsArr' is null or empty; one of: DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION or NO_AUTOBUTTONS_OPTION.
Returns:
An integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog without selecting an option.

showMessageDialog

public static int showMessageDialog(java.awt.Component parentComp,
                                    java.lang.Object msgObj,
                                    java.lang.String titleStr,
                                    boolean modalFlag,
                                    boolean waitFlag)
Creates and displays a information-message popup dialog window with a default "OK" button.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
modalFlag - true for modal, false for modeless (allows other windows to run).
waitFlag - if false and 'modalFlag' is false then this method will not wait for the dialog window to be dismissed; otherwise this method blocks until the dialog window is dismissed.
Returns:
The value 'JOptionPane.OK_OPTION' if the "OK" button was selected, or CLOSED_OPTION if the user closed the dialog without selecting the button or if the method returned before the dialog was dismissed (running non-modal with 'waitFlag'==false).

showMessageDialog

public static int showMessageDialog(java.awt.Component parentComp,
                                    java.lang.Object msgObj,
                                    java.lang.String titleStr)
Creates and displays a modal information-message popup dialog window with a default "OK" button. This method blocks until the dialog window is dismissed.

Parameters:
parentComp - the parent component for the popup.
msgObj - the message object to be shown.
titleStr - the title string for popup window.
Returns:
The value 'JOptionPane.OK_OPTION' if the "OK" button was selected, or CLOSED_OPTION if the user closed the dialog without selecting the button.