|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.util.MessageHandler
public class MessageHandler
This is a class that is used to report errors. It provides a set of static methods that are called to report errors. However, the actual reporting of the errors is deferred to an instance of this class that is set using the setMessageHandler() method. Normally there is only one instance, set up by the application, so the class is a singleton. But this is not enforced.
This base class simply writes the errors to System.err. When an applet or application starts up, it may wish to set a subclass of this class as the message handler, to allow a nicer way of reporting errors. For example, a Swing application will probably want to report errors in a dialog box, using for example the derived class GraphicalMessageHandler.
ptolemy.gui.GraphicalMessageHandler
Green (cxh) |
Green (cxh) |
Field Summary | |
---|---|
private static MessageHandler |
_handler
|
Constructor Summary | |
---|---|
MessageHandler()
|
Method Summary | |
---|---|
protected void |
_error(java.lang.String info)
Show the specified error message. |
protected void |
_error(java.lang.String info,
java.lang.Throwable throwable)
Show the specified message and throwable information. |
protected void |
_message(java.lang.String info)
Display the warning message. |
protected void |
_warning(java.lang.String info)
Show the specified message. |
protected void |
_warning(java.lang.String info,
java.lang.Throwable throwable)
Display the warning message and throwable information. |
protected boolean |
_yesNoCancelQuestion(java.lang.String question)
Ask the user a yes/no/cancel question, and return true if the answer is yes. |
protected boolean |
_yesNoQuestion(java.lang.String question)
Ask the user a yes/no question, and return true if the answer is yes. |
static void |
error(java.lang.String info)
Defer to the set message handler to show the specified error message. |
static void |
error(java.lang.String info,
java.lang.Throwable throwable)
Defer to the set message handler to show the specified message and throwable information. |
static MessageHandler |
getMessageHandler()
Return the message handler instance that is used by the static methods in this class. |
static void |
message(java.lang.String info)
Defer to the set message handler to show the specified message. |
static void |
setMessageHandler(MessageHandler handler)
Set the message handler instance that is used by the static methods in this class. |
static java.lang.String |
shortDescription(java.lang.Throwable throwable)
Return a short description of the throwable. |
static void |
warning(java.lang.String info)
Display the warning message. |
static void |
warning(java.lang.String info,
java.lang.Throwable throwable)
Display the warning message and throwable information. |
static boolean |
yesNoCancelQuestion(java.lang.String question)
Ask the user a yes/no/cancel question, and return true if the answer is yes. |
static boolean |
yesNoQuestion(java.lang.String question)
Ask the user a yes/no question, and return true if the answer is yes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static MessageHandler _handler
Constructor Detail |
---|
public MessageHandler()
Method Detail |
---|
public static void error(java.lang.String info)
info
- The message.public static void error(java.lang.String info, java.lang.Throwable throwable)
info
- The message.throwable
- The throwable.CancelException
public static MessageHandler getMessageHandler()
setMessageHandler(MessageHandler)
public static void message(java.lang.String info)
info
- The message.public static void setMessageHandler(MessageHandler handler)
handler
- The message handler.getMessageHandler()
public static java.lang.String shortDescription(java.lang.Throwable throwable)
throwable
- The throwable
public static void warning(java.lang.String info) throws CancelException
info
- The message.
CancelException
- If the user clicks on the "Cancel" button.public static void warning(java.lang.String info, java.lang.Throwable throwable) throws CancelException
info
- The message.throwable
- The throwable associated with this warning.
CancelException
- If the user clicks on the "Cancel" button.public static boolean yesNoQuestion(java.lang.String question)
question
- The yes/no question.
public static boolean yesNoCancelQuestion(java.lang.String question) throws CancelException
question
- The yes/no/cancel question.
CancelException
- If the user clicks on
the "Cancel" button.protected void _error(java.lang.String info)
info
- The message.protected void _error(java.lang.String info, java.lang.Throwable throwable)
info
- The message.throwable
- The throwable.CancelException
protected void _message(java.lang.String info)
info
- The message.protected void _warning(java.lang.String info) throws CancelException
Derived classes might show the specified message in a modal dialog. If the user clicks on the "Cancel" button, then throw an exception. This gives the user the option of not continuing the execution, something that is particularly useful if continuing execution will result in repeated warnings.
info
- The message.
CancelException
- If the user clicks on the "Cancel" button.protected void _warning(java.lang.String info, java.lang.Throwable throwable) throws CancelException
info
- The message.throwable
- The Throwable.
CancelException
- If the user clicks on the "Cancel" button.protected boolean _yesNoQuestion(java.lang.String question)
question
- The yes/no question to be asked.
protected boolean _yesNoCancelQuestion(java.lang.String question) throws CancelException
question
- The yes/no/cancel question to be asked.
CancelException
- If the user chooses
"cancel".
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |