uk.org.iscream.cms.server.core.loggers
Class SimpleGUILogger

java.lang.Object
  extended by uk.org.iscream.cms.server.core.loggers.SimpleGUILogger
All Implemented Interfaces:
LoggerImpl

public class SimpleGUILogger
extends Object
implements LoggerImpl

The SimpleGUILogger is an implementation of the LoggerImpl defined in the associated interface. It's only purpose is to simply print all the logging information it receives to a window frame. All very simple really... This class does have the problem that if too many messages are entered into the text area, then it will fill the memory of the JVM. This MAY have been fixed by adding the setRows(int) in the write(string) method, however the Java API does not specify if this enforces the max rows, but I THINK it does.

Version:
$Id: SimpleGUILogger.java,v 1.12 2004/08/01 10:40:56 tdb Exp $
Author:
$Author: tdb $

Field Summary
private  int _maxMessages
          The maximum number of messages that can be displayed before bottom items are removed.
private  String _name
          This is the friendly identifier of the component this class is running in.
private  Frame frame
          a frame
 String REVISION
          The current CVS revision of this class
private  TextArea textArea
          a text area
 
Constructor Summary
SimpleGUILogger()
          Creates a new ScreenLoggerServant.
 
Method Summary
private  Frame getFrame()
          An accessor for the frame
private  TextArea getTextArea()
          an accessor for the text area
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
 void write(String line, int verbosity)
          The write() method takes a line of text, pre-formatted and outputs it using a method defined by the actual implementation.
private  void write(String source, int verbosity, String message)
          This method is provided if this class wishes to log a message itself.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

frame

private Frame frame
a frame


textArea

private TextArea textArea
a text area


_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.


_maxMessages

private int _maxMessages
The maximum number of messages that can be displayed before bottom items are removed. This is needed to fix the memory overload problem that was seen when the GUI got too full!

Constructor Detail

SimpleGUILogger

public SimpleGUILogger()
Creates a new ScreenLoggerServant.

Method Detail

write

public void write(String line,
                  int verbosity)
The write() method takes a line of text, pre-formatted and outputs it using a method defined by the actual implementation. The verbosity is given in case the implementation wishes to utilise it in the layout - eg. a different colour or font. This instance writes the line to a simple GUI message window.

Specified by:
write in interface LoggerImpl
Parameters:
line - A line of formatted text to be logged
verbosity - the verbosity of this message

toString

public String toString()
Overrides the Object.toString() method to provide clean logging (every class should have this). This uses the uk.org.iscream.cms.util.FormatName class to format the toString()

Overrides:
toString in class Object
Returns:
the name of this class and its CVS revision

write

private void write(String source,
                   int verbosity,
                   String message)
This method is provided if this class wishes to log a message itself.

Parameters:
source - A String representation of the source
verbosity - the verbosity of this message
message - The message to log

getFrame

private Frame getFrame()
An accessor for the frame

Returns:
the frame for this class

getTextArea

private TextArea getTextArea()
an accessor for the text area

Returns:
the text area


Copyright © 2000-2003 i-scream. All Rights Reserved.