logahawk.swing
Class JOptionPaneListener

java.lang.Object
  extended by logahawk.swing.JOptionPaneListener
All Implemented Interfaces:
Listener

public class JOptionPaneListener
extends Object
implements Listener

Displays a JOptionPane message dialog for each log message. It is HIGHLY RECOMMENDED that this be used with the following classes:

  1. SeverityFilterLogger, SeverityFilter, or some other FilterLogger or FilterListener to avoid bombarding the user with an endless parade of log messages.
  2. LengthTruncatingListener to overloading the user with an extremely wordy message.
  3. LineTruncatingListener to keep the dialog reasonably sized (if its too long the OK button will go off screen).
  4. EventDispatchThreadListener to enforce that this executes only on the EDT.

See Also:
JOptionPane.showMessageDialog(Component, Object)

Field Summary
protected  JComponent parent
          Used as the "parentComponent" argument of the call to JOptionPane.showMessageDialog(Component, Object)s.
 
Constructor Summary
JOptionPaneListener(JComponent parent)
           
 
Method Summary
protected  int getMessageType(Severity severity)
          Returns the following: JOptionPane.PLAIN_MESSAGE for Severity.DEBUG JOptionPane.INFORMATION_MESSAGE for Severity.INFO JOptionPane.INFORMATION_MESSAGE for Severity.ALERT JOptionPane.WARNING_MESSAGE for Severity.WARN JOptionPane.ERROR_MESSAGE for Severity.ERROR JOptionPane.ERROR_MESSAGE for Severity.FATAL JOptionPane.ERROR_MESSAGE for Severity.PANIC
 void log(LogMeta meta, String text)
          Logs the provided statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected final JComponent parent
Used as the "parentComponent" argument of the call to JOptionPane.showMessageDialog(Component, Object)s.

Constructor Detail

JOptionPaneListener

public JOptionPaneListener(JComponent parent)
Method Detail

log

public void log(LogMeta meta,
                String text)
Description copied from interface: Listener
Logs the provided statement. Normally this method should not throw any exceptions. If exceptions are expected it is recommend to wrap this Listener with a FailSafeListener.

Specified by:
log in interface Listener

getMessageType

protected int getMessageType(Severity severity)
Returns the following: