UI
Class GEVAMessage

java.lang.Object
  extended by UI.GEVAMessage

public class GEVAMessage
extends java.lang.Object

Author:
eliottbartley

Field Summary
static int CANCEL_OPTION
          User clicks Cancel, or closes with the window X
static int DEFAULT
          Use the default option and/or type
static int ERROR_TYPE
          showMessage should display the error icon
static int INFORMATION_TYPE
          showMessage should display the information icon
static int NO_OPTION
          User clicks No
static int OK_CANCEL_OPTION
          showMessage should display an option ok/cancel dialog
static int OK_OPTION
          User clicks OK
static int QUESTION_TYPE
          showMessage should display the question icon
static int WARNING_TYPE
          showMessage should display the warning icon
static int YES_NO_CANCEL_OPTION
          showMessage should display an option yes/no/cancel dialog
static int YES_NO_OPTION
          showMessage should display an option yes/no dialog
static int YES_OPTION
          User clicks Yes
 
Method Summary
static int showMessage(java.awt.Component owner, java.lang.String message, int flags, java.lang.String... params)
          Displays a message to the user in a JOptionPane message dialog.
static int showMessage(java.awt.Component owner, java.lang.String message, java.lang.String... params)
          Displays a message to the user in a JOptionPane message dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT

public static final int DEFAULT
Use the default option and/or type

See Also:
Constant Field Values

OK_OPTION

public static final int OK_OPTION
User clicks OK

See Also:
Constant Field Values

YES_OPTION

public static final int YES_OPTION
User clicks Yes

See Also:
Constant Field Values

NO_OPTION

public static final int NO_OPTION
User clicks No

See Also:
Constant Field Values

CANCEL_OPTION

public static final int CANCEL_OPTION
User clicks Cancel, or closes with the window X

See Also:
Constant Field Values

YES_NO_OPTION

public static final int YES_NO_OPTION
showMessage should display an option yes/no dialog

See Also:
Constant Field Values

YES_NO_CANCEL_OPTION

public static final int YES_NO_CANCEL_OPTION
showMessage should display an option yes/no/cancel dialog

See Also:
Constant Field Values

OK_CANCEL_OPTION

public static final int OK_CANCEL_OPTION
showMessage should display an option ok/cancel dialog

See Also:
Constant Field Values

INFORMATION_TYPE

public static final int INFORMATION_TYPE
showMessage should display the information icon

See Also:
Constant Field Values

QUESTION_TYPE

public static final int QUESTION_TYPE
showMessage should display the question icon

See Also:
Constant Field Values

WARNING_TYPE

public static final int WARNING_TYPE
showMessage should display the warning icon

See Also:
Constant Field Values

ERROR_TYPE

public static final int ERROR_TYPE
showMessage should display the error icon

See Also:
Constant Field Values
Method Detail

showMessage

public static int showMessage(java.awt.Component owner,
                              java.lang.String message,
                              java.lang.String... params)
Displays a message to the user in a JOptionPane message dialog. Same as showMessage(owner, message, GEVAMessage.DEFAULT);

See Also:
showMessage(Component, String, int, String[])

showMessage

public static int showMessage(java.awt.Component owner,
                              java.lang.String message,
                              int flags,
                              java.lang.String... params)
Displays a message to the user in a JOptionPane message dialog. The message can begin with a brief statement or question. If this is the case, that brief is put into the message-box's title, rather than its body. A statement is made by ending the brief with an exclamation (!) and a question is made by ending the brief with a question mark (?). Note: if a *_TYPE is not specified (see flags), the brief will assign types of WARNING_TYPE for statements (!) and QUESTION_TYPE for questions (?) A brief can be no more than 3 words; e.g. "Save? Do you want to save?" becomes
Title:Save?
Body:[?] Do you want to Save?
A word is identified by a space character, regardless of non-white-space around it, and with 3 words, means only two spaces can be in the brief, so "Save ?" is not a brief, it has 3 white-spaces. A brief cannot contain white-space other than space characters. Any other white-space (tabs, newline; ASCII less than 32) found will cause the brief to be ignored, and it will be output to the body. The message can also contain placeholders and these are replaced by the values passed to params before display. Placeholders are in the form {N} where N is the index of the param to replace it with, e.g. showMessage ( null, "{0} {0}! {1}'s {2}? {3}! {3} {1}? {3} {4}.", GEVAMessage.DEFAULT_OPTION_TYPE, "knock", "who", "there", "Joe", "King" ); will display "knock knock!" (which, with !, is a statement, and appears as the title. The body displays "who's there? Joe! Joe who? Joe King." If {0} was meant to be output, and not replaced, use \{0}. This also means that to output \, you need to use \\, tho in general, a single \ will output as \. So to actually output \\, use \\\ or \\\\, etc. This method also formats the message so that long messages don't go outside the width of the screen by wrapping them at ~3/4 the width of the screen

Parameters:
owner - The parent window to the message
message - The message to display. If the message has a brief question or statement at the start of the message, it is used in the message boxes title, rather than message area (see above)
flags - The type and options for the message displayed, can be one of INFORMATION_TYPE, QUESTION_TYPE, WARNING_TYPE, ERROR_TYPE or'd with one of OK_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION.
params - Parameter values to fill placeholders
Returns:
The option clicked by the user, will be one of OK_OPTION, YES_OPTION, NO_OPTION, CANCEL_OPTION