jimm.datavision
Class ErrorHandler

java.lang.Object
  extended by jimm.datavision.ErrorHandler

public class ErrorHandler
extends java.lang.Object

This class provides static methods for displaying error messages. It displays error messages to System.err. When the GUI is being used it displays error messages in dialog boxes as well.

The only shortcoming is that you have to explicitly tell this class whether to use the GUI or not.

This class is also used by other parts of the system to determine if the report is being run with or without a GUI.

Author:
Jim Menard, jimm@io.com

Field Summary
protected static int MAX_MESSAGE_WIDTH
           
protected static boolean useGUI
           
 
Constructor Summary
ErrorHandler()
           
 
Method Summary
static void error(java.lang.String message)
          Displays an error message.
static void error(java.lang.String message, java.lang.String windowTitle)
          Displays an error message with the given window title.
static void error(java.lang.String message, java.lang.Throwable t)
          Displays an error message and an exception (actually a Throwable) Both arguments are optionally null.
static void error(java.lang.String message, java.lang.Throwable t, java.lang.String windowTitle)
          Displays an error message and an exception (actually a Throwable) with the given window title.
static void error(java.lang.Throwable t)
          Displays an exception (actually a Throwable).
static void error(java.lang.Throwable t, java.lang.String windowTitle)
          Displays an error message and an exception (actually a Throwable) with the given window title.
static void useGUI(boolean b)
          Tells the error handler routines whether to display error messages in dialog boxes or not.
static boolean usingGUI()
          Returns true if we've been told to use the GUI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_MESSAGE_WIDTH

protected static final int MAX_MESSAGE_WIDTH
See Also:
Constant Field Values

useGUI

protected static boolean useGUI
Constructor Detail

ErrorHandler

public ErrorHandler()
Method Detail

useGUI

public static void useGUI(boolean b)
Tells the error handler routines whether to display error messages in dialog boxes or not.

Parameters:
b - if true, all error messages will be displayed using a dialog box in addition to being printed on System.err

usingGUI

public static boolean usingGUI()
Returns true if we've been told to use the GUI.

Returns:
true if we've been told to use the GUI

error

public static void error(java.lang.String message)
Displays an error message.

Parameters:
message - the error message; may be null, but that would be rather silly

error

public static void error(java.lang.String message,
                         java.lang.Throwable t)
Displays an error message and an exception (actually a Throwable) Both arguments are optionally null.

Parameters:
message - the error message; may be null
t - a throwable; may be null

error

public static void error(java.lang.String message,
                         java.lang.String windowTitle)
Displays an error message with the given window title. Both arguments are optionally null.

Parameters:
message - the error message; may be null
windowTitle - a string to use as the dialog title; may be null

error

public static void error(java.lang.Throwable t)
Displays an exception (actually a Throwable). It may be null, but that would be rather silly.

Parameters:
t - a throwable; may be null

error

public static void error(java.lang.Throwable t,
                         java.lang.String windowTitle)
Displays an error message and an exception (actually a Throwable) with the given window title. All three arguments are optionally null.

Parameters:
t - a throwable; may be null
windowTitle - a string to use as the dialog title; may be null

error

public static void error(java.lang.String message,
                         java.lang.Throwable t,
                         java.lang.String windowTitle)
Displays an error message and an exception (actually a Throwable) with the given window title. All three arguments are optionally null.

Parameters:
message - the error message; may be null
t - a throwable; may be null
windowTitle - a string to use as the dialog title; may be null