ptolemy.gui
Class GraphicalMessageHandler
java.lang.Object
|
+--ptolemy.gui.MessageHandler
|
+--ptolemy.gui.GraphicalMessageHandler
- public class GraphicalMessageHandler
- extends MessageHandler
This is a message handler that reports errors in a graphical dialog box.
When an applet or application starts up, it should call setContext()
to specify a component with respect to which the display window
should be created. This ensures that if the application is iconified
or deiconified, that the display window goes with it. If the context
is not specified, then the display window is centered on the screen,
but iconifying and deiconifying may not work as desired.
This class is based on (and contains code from) the diva GUIUtilities
class.
- Since:
- Ptolemy II 1.0
- Version:
- $Id: GraphicalMessageHandler.java,v 1.14 2002/02/22 18:40:45 cxh Exp $
- Author:
- Edward A. Lee, Steve Neuendorffer, and John Reekie
Field Summary |
protected static java.awt.Component |
_context
|
Method Summary |
protected void |
_error(java.lang.String info)
Show the specified error message. |
protected void |
_error(java.lang.String info,
java.lang.Exception exception)
Show the specified message and exception 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.Exception exception)
Show the specified message and exception information
in a modal dialog. |
static java.awt.Component |
getContext()
Get the component set by a call to setContext(), or null if none. |
static void |
setContext(java.awt.Component context)
Set the component with respect to which the display window
should be created. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_context
protected static java.awt.Component _context
GraphicalMessageHandler
public GraphicalMessageHandler()
getContext
public static java.awt.Component getContext()
- Get the component set by a call to setContext(), or null if none.
- Returns:
- The component with respect to which the display window
is iconified, or null if none has been specified.
- See Also:
setContext(Component)
setContext
public static void setContext(java.awt.Component context)
- Set the component with respect to which the display window
should be created. This ensures that if the application is
iconified or deiconified, that the display window goes with it.
- Parameters:
context
- The component context.- See Also:
getContext()
_error
protected void _error(java.lang.String info)
- Show the specified error message.
- Overrides:
_error
in class MessageHandler
- Parameters:
info
- The message.
_error
protected void _error(java.lang.String info,
java.lang.Exception exception)
- Show the specified message and exception information.
If the exception is an instance of CancelException, then it
is not shown. By default, only the message of the exception
is thrown. The stack trace information is only shown if the
user clicks on the "Display Stack Trace" button.
- Overrides:
_error
in class MessageHandler
- Parameters:
info
- The message.exception
- The exception.- See Also:
CancelException
_message
protected void _message(java.lang.String info)
- Show the specified message in a modal dialog.
- Overrides:
_message
in class MessageHandler
- Parameters:
info
- The message.
_warning
protected void _warning(java.lang.String info)
throws CancelException
- 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.
- Overrides:
_warning
in class MessageHandler
- Parameters:
info
- The message.- Throws:
CancelException
- If the user clicks on the "Cancel" button.
_warning
protected void _warning(java.lang.String info,
java.lang.Exception exception)
throws CancelException
- Show the specified message and exception information
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.
By default, only the message of the exception
is thrown. The stack trace information is only shown if the
user clicks on the "Display Stack Trace" button.
- Overrides:
_warning
in class MessageHandler
- Parameters:
info
- The message.- Throws:
CancelException
- If the user clicks on the "Cancel" button.