kiwi.ui.dialog
Class DialogSet

java.lang.Object
  |
  +--kiwi.ui.dialog.DialogSet

public class DialogSet
extends Object
implements PropertyChangeListener

This class is the Kiwi analogy to the Swing JOptionPane. It provides a simple interface for displaying some of the more commonly-used Kiwi dialogs without requiring any Dialog objects to be instantiated.

Although each instance of DialogSet may have its own owner Window and placement policy, they will all share singleton instances of KMessageDialog, KQuestionDialog, and KInputDialog.

A placement policy may be assigned to a DialogSet; this policy defines where dialogs will appear relative to their owner Window. If there is no owner, dialogs will appear in the center of the screen.

Version:
1.0.1 (10/98)
Author:
Mark Lindner, PING Software Group
See Also:
KMessageDialog, KQuestionDialog, KInputDialog

Field Summary
static int CASCADE_PLACEMENT
          Placement policy.
static int CENTER_PLACEMENT
          Placement policy.
 
Constructor Summary
DialogSet(Window owner, int placement)
          Construct a new DialogSet with the given owner and placement policy.
 
Method Summary
static DialogSet getInstance()
          Get a reference to the default instance of DialogSet.
 void propertyChange(PropertyChangeEvent evt)
          Respond to property change events.
 String showInputDialog(String prompt)
          Show a KInputDialog.
 String showInputDialog(String title, Icon icon, String prompt)
          Show a KInputDialog.
 void showMessageDialog(String message)
          Show a KMessageDialog.
 void showMessageDialog(String title, Icon icon, String message)
          Show a KMessageDialog.
 boolean showQuestionDialog(String prompt)
          Show a KQuestionDialog.
 boolean showQuestionDialog(String title, Icon icon, String prompt)
          Show a KQuestionDialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTER_PLACEMENT

public static final int CENTER_PLACEMENT
Placement policy. Display dialogs centered within the bounds of their owner Window.

CASCADE_PLACEMENT

public static final int CASCADE_PLACEMENT
Placement policy. Display dialogs cascaded off the top-left corner of their owner Window.
Constructor Detail

DialogSet

public DialogSet(Window owner,
                 int placement)
          throws IllegalArgumentException
Construct a new DialogSet with the given owner and placement policy.
Parameters:
owner - The Window that is the owner of this DialogSet.
placement - The placement for dialogs in this DialogSet; one of the numeric constants defined above.
Method Detail

getInstance

public static DialogSet getInstance()
Get a reference to the default instance of DialogSet. This instance has no owner Window, and hence its dialogs appear centered on the screen.
Returns:
The default (singleton) instance.

showInputDialog

public String showInputDialog(String prompt)
Show a KInputDialog. Displays an input dialog and returns when the dialog is dismissed.
Parameters:
prompt - The prompt to display in the dialog.
Returns:
The text that was entered in the dialog, or null if the dialog was cancelled.

showInputDialog

public String showInputDialog(String title,
                              Icon icon,
                              String prompt)
Show a KInputDialog. Displays an input dialog and returns when the dialog is dismissed.
Parameters:
title - The title for the dialog window.
icon - The icon to display in the dialog.
prompt - The prompt to display in the dialog.
Returns:
The text that was entered in the dialog, or null if the dialog was cancelled.

showQuestionDialog

public boolean showQuestionDialog(String prompt)
Show a KQuestionDialog. Displays a question dialog and returns when the dialog is dismissed.
Parameters:
prompt - The prompt to display in the dialog.
Returns:
The status of the dialog; true if the dialog was accepted or false if it was cancelled.

showQuestionDialog

public boolean showQuestionDialog(String title,
                                  Icon icon,
                                  String prompt)
Show a KQuestionDialog. Displays a question dialog and returns when the dialog is dismissed.
Parameters:
title - The title for the dialog window.
icon - The icon to display in the dialog.
prompt - The promopt to display in the dialog.
Returns:
The status of the dialog; true if the dialog was accepted or false if it was cancelled.

showMessageDialog

public void showMessageDialog(String message)
Show a KMessageDialog. Displays a message dialog and returns when the dialog is dismissed.
Parameters:
prompt - The prompt to display in the dialog.

showMessageDialog

public void showMessageDialog(String title,
                              Icon icon,
                              String message)
Show a KMessageDialog. Displays a message dialog and returns when the dialog is dismissed.
Parameters:
title - The title for the dialog window.
icon - The icon to display in the dialog.
prompt - The prompt to display in the dialog.

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Respond to property change events.
Specified by:
propertyChange in interface PropertyChangeListener