edu.mit.csail.sdg.alloy4
Class OurDialog

java.lang.Object
  extended by edu.mit.csail.sdg.alloy4.OurDialog

public final class OurDialog
extends java.lang.Object

Graphical dialog methods for asking the user some questions.

Thread Safety: Can be called only by the AWT event thread.


Method Summary
static void alert(java.lang.Object message)
          Popup the given error message.
static java.io.File askFile(boolean isOpen, java.lang.String dir, java.lang.String ext, java.lang.String description)
          Use the platform's preferred file chooser to ask the user to select a file.
static java.lang.String askFont()
          Asks the user to choose a font; returns "" if the user cancels the request.
static boolean askOverwrite(java.lang.String filename)
          Ask if the user really wishes to overwrite the file (default is no).
static char askSaveDiscardCancel(java.lang.String description)
          Ask if the user wishes to save the file, discard the file, or cancel the entire operation (default is cancel).
static void fatal(java.lang.Object message)
          Popup the given error message, then terminate the program.
static boolean getInput(java.lang.String title, java.lang.Object... objects)
          Display a modal dialog window containing the "objects"; returns true iff the user clicks Ok.
static boolean hasFont(java.lang.String fontname)
          Returns true if a font with that name exists on the system (comparison is case-insensitive).
static void showmsg(java.lang.String title, java.lang.Object... msg)
          Popup the given informative message, then ask the user to click Close to close it.
static javax.swing.JFrame showtext(java.lang.String title, java.lang.String text)
          Display a simple non-modal window showing some text.
static boolean yesno(java.lang.Object msg)
          Display "msg" in a modal dialog window, and ask the user to choose "Yes" versus "No" (default is "no").
static boolean yesno(java.lang.Object msg, java.lang.String yes, java.lang.String no)
          Display "msg" in a modal dialog window, and ask the user to choose "yes" versus "no" (default is "no").
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

showmsg

public static void showmsg(java.lang.String title,
                           java.lang.Object... msg)
Popup the given informative message, then ask the user to click Close to close it.


alert

public static void alert(java.lang.Object message)
Popup the given error message.


fatal

public static void fatal(java.lang.Object message)
Popup the given error message, then terminate the program.


askSaveDiscardCancel

public static char askSaveDiscardCancel(java.lang.String description)
Ask if the user wishes to save the file, discard the file, or cancel the entire operation (default is cancel).

Returns:
'c' if cancel, 's' if save, 'd' if discard

askOverwrite

public static boolean askOverwrite(java.lang.String filename)
Ask if the user really wishes to overwrite the file (default is no).

Returns:
true if the user wishes to overwrite the file, false if the user does not wish to overwrite the file.

hasFont

public static boolean hasFont(java.lang.String fontname)
Returns true if a font with that name exists on the system (comparison is case-insensitive).


askFont

public static java.lang.String askFont()
Asks the user to choose a font; returns "" if the user cancels the request.


askFile

public static java.io.File askFile(boolean isOpen,
                                   java.lang.String dir,
                                   java.lang.String ext,
                                   java.lang.String description)
Use the platform's preferred file chooser to ask the user to select a file.
Note: if it is a save operation, and the user didn't include an extension, then we'll add the extension.

Parameters:
isOpen - - true means this is an Open operation; false means this is a Save operation
dir - - the initial directory (or null if we want to use the default)
ext - - the file extension (including "."; using lowercase letters; for example, ".als") or ""
description - - the description for the given extension
Returns:
null if the user didn't choose anything, otherwise it returns the selected file

yesno

public static boolean yesno(java.lang.Object msg,
                            java.lang.String yes,
                            java.lang.String no)
Display "msg" in a modal dialog window, and ask the user to choose "yes" versus "no" (default is "no").


yesno

public static boolean yesno(java.lang.Object msg)
Display "msg" in a modal dialog window, and ask the user to choose "Yes" versus "No" (default is "no").


getInput

public static boolean getInput(java.lang.String title,
                               java.lang.Object... objects)
Display a modal dialog window containing the "objects"; returns true iff the user clicks Ok.


showtext

public static javax.swing.JFrame showtext(java.lang.String title,
                                          java.lang.String text)
Display a simple non-modal window showing some text.