org.crosswire.common.util
Class Reporter

java.lang.Object
  extended by org.crosswire.common.util.Reporter

public final class Reporter
extends Object

This package looks after Exceptions and messages as they happen. It would be nice not to need this class - the principle being that any library that encounters an error can throw an exception to indicate that there is a problem. However this is not always the case. For example:

Author:
Joe Walker [joe at eireneh dot com]
See Also:
for license details.
The copyright to this program is held by it's authors.

Nested Class Summary
static class Reporter.CustomAWTExceptionHandler
          A class to handle AWT caught Exceptions
 
Field Summary
private static String AWT_HANDLER_PROPERTY
          The system property name for registering AWT exceptions
private static EventListenerList LISTENERS
          The list of listeners
private static org.slf4j.Logger log
          The log stream
private static String OUR_NAME
          The name of the class to register for AWT exceptions
 
Constructor Summary
private Reporter()
          Enforce Singleton
 
Method Summary
static void addReporterListener(ReporterListener li)
          Add an Exception listener to the list of things wanting to know whenever we capture an Exception
protected static void fireCapture(ReporterEvent ev)
          Log a message.
static void grabAWTExecptions(boolean grab)
          Sets the parent of any exception windows.
static void informUser(Object source, LucidException prob)
          Something has gone wrong.
static void informUser(Object source, LucidRuntimeException prob)
          Something has gone wrong.
static void informUser(Object source, String message)
          Something has happened.
static void informUser(Object source, Throwable prob)
          Something has gone wrong.
static void removeReporterListener(ReporterListener li)
          Remove an Exception listener from the list of things wanting to know whenever we capture an Exception
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AWT_HANDLER_PROPERTY

private static final String AWT_HANDLER_PROPERTY
The system property name for registering AWT exceptions

See Also:
Constant Field Values

OUR_NAME

private static final String OUR_NAME
The name of the class to register for AWT exceptions


LISTENERS

private static final EventListenerList LISTENERS
The list of listeners


log

private static final org.slf4j.Logger log
The log stream

Constructor Detail

Reporter

private Reporter()
Enforce Singleton

Method Detail

informUser

public static void informUser(Object source,
                              Throwable prob)
Something has gone wrong. We need to tell the user or someone, but we can carry on. In general having caught an exception and passed it to Reporter.informUser(), you should not throw another Exception. Called to fire a commandEntered event to all the Listeners

Parameters:
source - The cause of the problem, a Component if possible.
prob -

informUser

public static void informUser(Object source,
                              LucidException prob)
Something has gone wrong. We need to tell the user or someone, but we can carry on. In general having caught an exception and passed it to Reporter.informUser(), you should not throw another Exception. Called to fire a commandEntered event to all the Listeners

Parameters:
source - The cause of the problem, a Component if possible.
prob - The Exception that was thrown

informUser

public static void informUser(Object source,
                              LucidRuntimeException prob)
Something has gone wrong. We need to tell the user or someone, but we can carry on. In general having caught an exception and passed it to Reporter.informUser(), you should not throw another Exception. Called to fire a commandEntered event to all the Listeners

Parameters:
source - The cause of the problem, a Component if possible.
prob - The Exception that was thrown

informUser

public static void informUser(Object source,
                              String message)
Something has happened. We need to tell the user or someone.

Parameters:
source - The cause of the message, a Component if possible.
message - The message to pass to the user

addReporterListener

public static void addReporterListener(ReporterListener li)
Add an Exception listener to the list of things wanting to know whenever we capture an Exception


removeReporterListener

public static void removeReporterListener(ReporterListener li)
Remove an Exception listener from the list of things wanting to know whenever we capture an Exception


fireCapture

protected static void fireCapture(ReporterEvent ev)
Log a message.


grabAWTExecptions

public static void grabAWTExecptions(boolean grab)
Sets the parent of any exception windows.


Copyright ? 2003-2011