public class GraphicalMessageHandler extends UndeferredGraphicalMessageHandler
Note that to display a window with an error message, this graphical
handler must be registered by calling
MessageHandler.setMessageHandler(MessageHandler)
.
For example:
GraphicalMessageHandler handler = new GraphicalMessageHandler(); GraphicalMessageHandler.setMessageHandler(handler); GraphicalMessageHandler.error("My error", new Exception("My Exception"));If setMessageHandler() is not called, then the error() call will use the default handler and possibly display the message on standard error.
This class is based on (and contains code from) the diva GUIUtilities class.
Red (reviewmoderator) |
Yellow (eal) |
_context
Constructor and Description |
---|
GraphicalMessageHandler() |
Modifier and Type | Method and Description |
---|---|
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)
Show the specified message in a modal dialog.
|
protected void |
_warning(java.lang.String info)
Show the specified message in a modal dialog.
|
protected void |
_warning(java.lang.String info,
java.lang.Throwable throwable)
Show the specified message and throwable information
in a modal dialog.
|
protected boolean |
_yesNoCancelQuestion(java.lang.String question,
java.lang.String trueOption,
java.lang.String falseOption,
java.lang.String exceptionOption)
Ask the user a question with three possible answers;
return true if the answer is the first one and false if
the answer is the second one; throw an exception if the
user selects the third one.
|
protected boolean |
_yesNoQuestion(java.lang.String question)
Ask the user a yes/no question, and return true if the answer
is yes.
|
_checkThrowableNameable, _showNameable, _showStackTrace, getContext, setContext
error, error, getMessageHandler, isRunningNightlyBuild, message, setMessageHandler, shortDescription, warning, warning, yesNoCancelQuestion, yesNoCancelQuestion, yesNoQuestion
protected void _error(java.lang.String info)
_error
in class UndeferredGraphicalMessageHandler
info
- The message.protected void _error(java.lang.String info, java.lang.Throwable throwable)
_error
in class UndeferredGraphicalMessageHandler
info
- The message.throwable
- The throwable.CancelException
protected void _message(java.lang.String info)
_message
in class UndeferredGraphicalMessageHandler
info
- The message.protected void _warning(java.lang.String info) throws CancelException
_warning
in class UndeferredGraphicalMessageHandler
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
_warning
in class UndeferredGraphicalMessageHandler
info
- The message.throwable
- The throwable.CancelException
- If the user clicks on the
"Cancel" button.protected boolean _yesNoQuestion(java.lang.String question)
_yesNoQuestion
in class UndeferredGraphicalMessageHandler
question
- The yes/no question.protected boolean _yesNoCancelQuestion(java.lang.String question, java.lang.String trueOption, java.lang.String falseOption, java.lang.String exceptionOption) throws CancelException
_yesNoCancelQuestion
in class UndeferredGraphicalMessageHandler
question
- The question.trueOption
- The option for which to return true.falseOption
- The option for which to return false.exceptionOption
- The option for which to throw an exception.CancelException
- If the user selects the third option.