com.metamatrix.console.util
Class DialogUtility

java.lang.Object
  extended by com.metamatrix.console.util.DialogUtility

public class DialogUtility
extends java.lang.Object

This class consists of convenient static methods for displaying common and oft-used dialog boxes, such as confirmation dialogs, message dialogs, etc. Confirm dialogs are in yes/no mode, and return a boolean indicating if yes was selected.

TODO - add company icons to dialog boxes


Field Summary
static int CANCEL
           
static java.lang.String CONFIRM_DELETE_HDR
           
static int NO
           
static int YES
           
 
Constructor Summary
DialogUtility()
           
 
Method Summary
static int displayYesNoDialog(java.awt.Component c, java.lang.String header, java.lang.String message)
          Put up a dialog with YES or NO options.
static javax.swing.JFrame getDefaultComponent()
           
static void setDefaultComponent(java.awt.Component c)
          Set the default java.awt.Component which is used if null is passed in for an argument on any of the public methods.
static int showPendingChangesDialog(java.lang.String msg, java.lang.String url, java.lang.String userName)
          Static method to show a dialog inquiring about saving the pending changes.
static boolean yesNoDialog(java.awt.Component c, java.lang.Object message, java.lang.String title)
          Generic implementation of a yes/no dialog box, used by other methods of this class (which simply supply the necessary text and title)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIRM_DELETE_HDR

public static final java.lang.String CONFIRM_DELETE_HDR
See Also:
Constant Field Values

YES

public static final int YES
See Also:
Constant Field Values

NO

public static final int NO
See Also:
Constant Field Values

CANCEL

public static final int CANCEL
See Also:
Constant Field Values
Constructor Detail

DialogUtility

public DialogUtility()
Method Detail

setDefaultComponent

public static void setDefaultComponent(java.awt.Component c)
Set the default java.awt.Component which is used if null is passed in for an argument on any of the public methods. If this is not set, and null is passed in later, Swing will still produce the JDialog, but it may not be in reference to the proper "parent" Component.


getDefaultComponent

public static javax.swing.JFrame getDefaultComponent()

yesNoDialog

public static boolean yesNoDialog(java.awt.Component c,
                                  java.lang.Object message,
                                  java.lang.String title)
Generic implementation of a yes/no dialog box, used by other methods of this class (which simply supply the necessary text and title)

Parameters:
c - java.awt.Component needed by the Dialog Window
message - Object displayed in window (usually a String, but JOptionPane will take an Object)
title - String displayed in title bar
Returns:
boolean indicating if yes was selected

displayYesNoDialog

public static int displayYesNoDialog(java.awt.Component c,
                                     java.lang.String header,
                                     java.lang.String message)
Put up a dialog with YES or NO options.

Returns:
one of YES or NO

showPendingChangesDialog

public static int showPendingChangesDialog(java.lang.String msg,
                                           java.lang.String url,
                                           java.lang.String userName)
Static method to show a dialog inquiring about saving the pending changes.

Parameters:
msg - The message to be displayed
Returns:
One of: DialogUtility.YES, DialogUtility.NO, or DialogUtility.CANCEL


Copyright © 2009. All Rights Reserved.