Package org.ka2ddo.yaac.core
Class ErrorLogger
java.lang.Object
org.ka2ddo.yaac.core.ErrorLogger
This class contains static methods for reporting errors.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Helper class for transferring error displays to the GUI dispatch thread. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Return value from class method if user closes window without selecting anything, more than likely this should be treated as aNO_OPTION
.static final int
Return value from class method if HELP is chosen.static final int
Return value from class method if NO is chosen.static final int
Return value from class method if YES is chosen. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
reportError
(Object parentWidget, String msg) Report an error message to the user, using the GUI if available.static void
reportError
(Object parentWidget, String msg, boolean dontBlock) Report an error message to the user, using the GUI if available.static void
reportError
(Object parentWidget, Throwable ex, String msg) Report an error message to the user, using the GUI if available.static int
reportErrorWithResponse
(Object parentWidget, Throwable ex, String msg, String bodyText) Display a standard error message dialog for a stack trace that asks for a yes/no confirmation.static void
Register the graphical error logger for this UI.
-
Field Details
-
YES_OPTION
public static final int YES_OPTIONReturn value from class method if YES is chosen.- See Also:
-
NO_OPTION
public static final int NO_OPTIONReturn value from class method if NO is chosen.- See Also:
-
HELP_OPTION
public static final int HELP_OPTIONReturn value from class method if HELP is chosen.- See Also:
-
CLOSED_OPTION
public static final int CLOSED_OPTIONReturn value from class method if user closes window without selecting anything, more than likely this should be treated as aNO_OPTION
.- See Also:
-
-
Method Details
-
setGraphicalErrorLogger
Register the graphical error logger for this UI.- Parameters:
gel
- GraphicalErrorLogger implementation to use for displaying error messages
-
reportError
Report an error message to the user, using the GUI if available. The resulting GUI dialog will be blocking.- Parameters:
parentWidget
- GUI component to locate the popup dialogex
- Throwable that caused the error being reportedmsg
- text String to display in dialog
-
reportError
Report an error message to the user, using the GUI if available. The resulting GUI dialog will be blocking.- Parameters:
parentWidget
- GUI component to locate the popup dialogmsg
- text String to display in dialog
-
reportError
Report an error message to the user, using the GUI if available. The resulting GUI dialog will be blocking.- Parameters:
parentWidget
- GUI component to locate the popup dialogmsg
- text String to display in dialogdontBlock
- boolean true if dialog should not block access to other windows (or cause stack overflow if more errors are reported)
-
reportErrorWithResponse
public static int reportErrorWithResponse(Object parentWidget, Throwable ex, String msg, String bodyText) Display a standard error message dialog for a stack trace that asks for a yes/no confirmation.- Parameters:
parentWidget
- widget that asked the dialog to be displayed (may be null)ex
- Throwable being reported (or null)msg
- localized title string to display in dialogbodyText
- optional extra text String to display before stack trace, or null- Returns:
- int 0 for YES, 1 for NO, 2 for HELP, and -1 for dialog close
- See Also:
-