|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectmultex.Awt
Services for reporting onto AWT Dialogs the messages for any exception with dynamic or static or no internationalization. The exception can be
Exc)
Failure)
MsgText.
| Method Summary | |
static int |
countLines(java.lang.String i_text)
Result: Number of lines in String i_text. |
static void |
report(java.awt.Component io_ownerHook,
java.lang.Throwable i_throwable)
Reports i_throwable into an error message dialog with static internationalization. |
static void |
report(java.awt.Component io_ownerHook,
java.lang.Throwable i_throwable,
java.util.ResourceBundle i_resourceBundle)
Reports i_throwable into an AWT Dialog, detail description here. |
static void |
setAwtExceptionHandlerClass(AwtExceptionHandler i_exceptionHandler)
Registers the class of the passed object as the default exception handler for AWT and Swing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void report(java.awt.Component io_ownerHook,
java.lang.Throwable i_throwable)
public static void report(java.awt.Component io_ownerHook,
java.lang.Throwable i_throwable,
java.util.ResourceBundle i_resourceBundle)
Msg.printMessages(StringBuffer, Throwable, ResourceBundle)
into a pop-up window of appropriate size.
Accepting the message is done by
The Button "Show Stack Trace" will add the compactified
stack trace including the chain of all causing exceptions
to the message dialog box. The contents of the compact
stack trace are described at method
Msg.printStackTrace(StringBuffer,Throwable).
In an application this method should not be called directly from a GUI class, but the author of each GUI class should set up a method e.g.
private void _report(Throwable ex){Awt.report(this,ex,null);}
, which will be called from each catch-clause in the event listeners
and adds the actual GUI class as the owner of the message dialog.
io_ownerHook - The owner Window of the dialog box will be determined
from io_ownerHook by searching the nearest parent Window.
The owner window is blocked for further input
until this dialog box will be closed.
If the owner hook is null, the dialog is created as a nonmodal dialog
with a shared, anonymous owner frame.i_throwable - The exception to be reported along with its causal chaini_resourceBundle - Where to take from the message texts for the exceptions
to be reported. If null, falls back to static or no internationalization,
depending on the actual state of @{link MsgText}.Msg.printReport(StringBuffer,Throwable, ResourceBundle)public static int countLines(java.lang.String i_text)
BufferedReader.readLine()
public static void setAwtExceptionHandlerClass(AwtExceptionHandler i_exceptionHandler)
throws Failure
Quoted below is the documentation of the private method handleException of java.awt.EventDispatchThread. It's not a long-term solution but it does work.
Handles an exception thrown in the event-dispatch thread.If the system property "sun.awt.exception.handler" is defined, then when this method is invoked it will attempt to do the following:
Note: This method is a temporary hack to work around the absence of a real API that provides the ability to replace the event-dispatch thread. The magic "sun.awt.exception.handler" property will be removed in a future release.
i_exceptionHandler - Any instance of the class, which shall be used as global AWT/Swing AwtExceptionHandler
Failure - i_exceptionHandler is null, or its class has no default constructor, or it is not instantiable via its default constructor or the necessary System property is not settable.
It seems, too, that the class must be public, and must be a static class (if inner).
The diagnostics of Class.newInstance() are not very clear.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||