|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.spiffyui.client.MessageUtil
public final class MessageUtil
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 |
---|
public static final org.spiffyui.client.ErrorPanel ERROR_PANEL
Method Detail |
---|
public static void showFatalError(java.lang.String msg)
msg
- the message to showpublic static void showWarning(java.lang.String msg)
Show a warning message.
This message has a default style of white text with a red background.
msg
- the message to showpublic 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.
msg
- the message to showshouldLog
- indicates if this warning should be sent to the in-browser error logpublic static void showMessage(java.lang.String msg)
Show an information message.
This message has a default style of white text with a black background.
msg
- the message to showpublic 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.
msg
- the message to showclassName
- the name of the class to applypublic static void showError(java.lang.String msg)
msg
- the message to showpublic 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.
errorMsg
- the error message for the alertlogMsg
- the message for the error logpublic static void logError(java.lang.String msg)
msg
- the message to showpublic static void logWarning(java.lang.String msg)
msg
- the message to showpublic static void setLogTitleJS(java.lang.String title)
title
- the error log title
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |