org.spiffyui.client
Class MessageUtil

java.lang.Object
  extended by org.spiffyui.client.MessageUtil

public final class MessageUtil
extends java.lang.Object

This class is a set of static utility methods for showing messages and errors in the browser and handle them all in a consistent way.

Applications have a large variety of messages they show to users. They can vary from "That name is already taken" to "Your database server crashed." These messages have a very different level of severity. To support that the Spiffy UI framework supports four levels of user messages.

Informational messages tell the user something they need to know but don't need to respond to. "Your changes are saved" is a common example of this type of message.

Warning messages tell the user something they need to respond to like "That username is already taken."

Error messages tell the user something went wrong. For example, "Unable to contact your email server."

Fatal error messages tell the user something went so wrong the system probably can't continue. "Unable to contact your server" is a typical fatal error message.

The first three types of messages are transient. The UI follows the Humanized Messages idiom layed out by Jef Raskin. They show up on top of the content and fade in a small amount of time. Wiggling your mouse on them will make them fade faster.

Error messages and some warnings will also show up in the error log at the bottom of the page. This makes it easy to find them again if the user needs to.

Fatal errors are different since they normally prevent the program from continuing. These errors show up on top of the screen and do not move until the user clicks on them.

Each of these messages can be seen on the Widgets page of the Spiffy UI Application.

Many of the methods use the Humanized Message Panels and require the Spiffy UI JavaScript libraries. This class also depends on the Spiffy UI HTML structure.


Field Summary
static org.spiffyui.client.ErrorPanel ERROR_PANEL
          This is the singleton instance of the error panel.
 
Method Summary
static void logError(java.lang.String msg)
          Write a message to the error log
static void logWarning(java.lang.String msg)
          Write a message to the error log
static void setLogTitleJS(java.lang.String title)
          Set the title of the error log.
static void showError(java.lang.String msg)
          Show a temporary error message and logs it to the client-side error log
static void showError(java.lang.String errorMsg, java.lang.String logMsg)
           Show aan error message.
static void showFatalError(java.lang.String msg)
          Show a fatal error message in the error panel with the ID errorPanel.
static void showMessage(java.lang.String msg)
           Show an information message.
static void showMessage(java.lang.String msg, java.lang.String className)
           Show an warning message.
static void showWarning(java.lang.String msg)
           Show a warning message.
static void showWarning(java.lang.String msg, boolean shouldLog)
           Show a warning message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_PANEL

public static final org.spiffyui.client.ErrorPanel ERROR_PANEL
This is the singleton instance of the error panel.

Method Detail

showFatalError

public static void showFatalError(java.lang.String msg)
Show a fatal error message in the error panel with the ID errorPanel. This message has a default style of

Parameters:
msg - the message to show

showWarning

public static void showWarning(java.lang.String msg)

Show a warning message.

This message has a default style of white text with a red background.

CSS Style Ryles

Parameters:
msg - the message to show

showWarning

public static void showWarning(java.lang.String msg,
                               boolean shouldLog)

Show a warning message.

This message has a default style of black text with a yellow background.

CSS Style Ryles

Parameters:
msg - the message to show
shouldLog - indicates if this warning should be sent to the in-browser error log

showMessage

public static void showMessage(java.lang.String msg)

Show an information message.

This message has a default style of white text with a black background.

CSS Style Ryles

Parameters:
msg - the message to show

showMessage

public static void showMessage(java.lang.String msg,
                               java.lang.String className)

Show an warning message.

This message has a default style of white text with a black background.

CSS Style Ryles

Parameters:
msg - the message to show
className - the name of the class to apply

showError

public static void showError(java.lang.String msg)
Show a temporary error message and logs it to the client-side error log

Parameters:
msg - the message to show

showError

public static void showError(java.lang.String errorMsg,
                             java.lang.String logMsg)

Show aan error message.

This message has a default style of black text with a red background.

CSS Style Ryles

Parameters:
errorMsg - the error message for the alert
logMsg - the message for the error log

logError

public static void logError(java.lang.String msg)
Write a message to the error log

Parameters:
msg - the message to show

logWarning

public static void logWarning(java.lang.String msg)
Write a message to the error log

Parameters:
msg - the message to show

setLogTitleJS

public static void setLogTitleJS(java.lang.String title)
Set the title of the error log. It may not contain HTML

Parameters:
title - the error log title