Class ErrorLogger

java.lang.Object
org.ka2ddo.yaac.core.ErrorLogger

public class ErrorLogger extends Object
This class contains static methods for reporting errors.
Author:
Andrew Pavlin, KA2DDO
  • Field Details

    • YES_OPTION

      public static final int YES_OPTION
      Return value from class method if YES is chosen.
      See Also:
    • NO_OPTION

      public static final int NO_OPTION
      Return value from class method if NO is chosen.
      See Also:
    • HELP_OPTION

      public static final int HELP_OPTION
      Return value from class method if HELP is chosen.
      See Also:
    • CLOSED_OPTION

      public static final int CLOSED_OPTION
      Return value from class method if user closes window without selecting anything, more than likely this should be treated as a NO_OPTION.
      See Also:
  • Method Details

    • setGraphicalErrorLogger

      public static void setGraphicalErrorLogger(GraphicalErrorLogger gel)
      Register the graphical error logger for this UI.
      Parameters:
      gel - GraphicalErrorLogger implementation to use for displaying error messages
    • reportError

      public static void reportError(Object parentWidget, Throwable ex, String msg)
      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 dialog
      ex - Throwable that caused the error being reported
      msg - text String to display in dialog
    • reportError

      public static void reportError(Object parentWidget, String msg)
      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 dialog
      msg - text String to display in dialog
    • reportError

      public static void reportError(Object parentWidget, String msg, boolean dontBlock)
      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 dialog
      msg - text String to display in dialog
      dontBlock - 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 dialog
      bodyText - 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: