ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able
Class AbleJTextAreaHandler

java.lang.Object
  |
  +--com.ibm.logging.LogObject
        |
        +--com.ibm.logging.Gate
              |
              +--com.ibm.logging.Handler
                    |
                    +--com.ibm.able.AbleJTextAreaHandler
All Implemented Interfaces:
java.lang.Cloneable, com.ibm.logging.IConstants, com.ibm.logging.IGate, com.ibm.logging.IHandler, com.ibm.logging.ILogObject, com.ibm.logging.mgr.IManageable, java.lang.Runnable, java.io.Serializable

public class AbleJTextAreaHandler
extends com.ibm.logging.Handler

AbleJTextAreaHandler extends Handler and writes to a Swing JTextArea.

This handler creates its own JTextArea when constructed. Use the getTextArea method to get a reference to the text area if it is necessary to change the text area parameters.

See Also:
Serialized Form

Fields inherited from class com.ibm.logging.Handler
DEFAULT_QUEUE_CAPACITY, DEFAULT_RETRY_COUNT, DEFAULT_RETRY_INTERVAL, deviceFailures, deviceLock, deviceOpen, formatters, myThread, pWriter, queueEmptyLock, queueFullLock, retryTimer
 
Fields inherited from class com.ibm.logging.Gate
isLogging, loggedRecordCount
 
Fields inherited from interface com.ibm.logging.IConstants
KEY_BACKUP_CAPACITY, KEY_CLASS_NAME, KEY_CLIENT, KEY_COMPONENT, KEY_DATE_FORMAT, KEY_DEFAULT_MESSAGE_LOGGER, KEY_DEFAULT_TRACE_LOGGER, KEY_DESCRIPTION, KEY_ENCODING, KEY_FILE_NAME, KEY_FILTER_NAMES, KEY_FORMATTER_NAMES, KEY_GROUP, KEY_HANDLER_NAMES, KEY_HEX_DATA, KEY_IS_BACKUP_ENABLED, KEY_IS_CIRCULAR, KEY_IS_LOGGING, KEY_IS_SYNC, KEY_LOGGING_CLASS, KEY_LOGGING_METHOD, KEY_MASK, KEY_MAX_FILE_SIZE, KEY_MAX_FILES, KEY_MAX_MSG_CATS, KEY_MAX_RETRIES, KEY_MESSAGE_FILE, KEY_NAME, KEY_OBJECT_TYPE, KEY_ORGANIZATION, KEY_PARENT, KEY_PRODUCT, KEY_QUEUE_CAPACITY, KEY_RECORD_CLASSES, KEY_RETRY_INTERVAL, KEY_SEPARATOR, KEY_SERVER, KEY_SOCKET_PORT, KEY_SOCKET_SERVER, KEY_SUPPRESSED_KEYS, KEY_THREAD_ID, KEY_THROWABLE, KEY_THROWABLE_TRACE, KEY_TIME_FORMAT, LOG_VERSION, OBJ_TYPE_FILTER, OBJ_TYPE_FORMATTER, OBJ_TYPE_HANDLER, OBJ_TYPE_LOGGER, OBJ_TYPE_MESSAGE_LOGGER, OBJ_TYPE_TRACE_LOGGER, VALUE_LOCALIZED_DATE_TIME
 
Constructor Summary
AbleJTextAreaHandler()
          Creates a AbleJTextAreaHandler.
AbleJTextAreaHandler(java.lang.String name)
          Creates a AbleJTextAreaHandler.
AbleJTextAreaHandler(java.lang.String name, java.lang.String desc)
          Creates a TextAreaHandler.
AbleJTextAreaHandler(java.lang.String name, java.lang.String desc, javax.swing.JTextArea textArea)
          Creates a TextAreaHandler.
 
Method Summary
 void closeDevice()
          Closes the device to which the handler is sending its log entries and sets the deviceOpen flag to false.
 javax.swing.JTextArea getTextArea()
          Gets the JTextArea used by this handler.
 void init()
          Initializes this object to a default state.
 void openDevice()
          Opens the device to which the handler will send its log entries.
 void setTextArea(javax.swing.JTextArea textArea)
          Sets the name of the text area used by this handler.
protected  void writeRecord(com.ibm.logging.ILogRecord record)
          Passes a log record synchronously from a logger to a handler.
 
Methods inherited from class com.ibm.logging.Handler
addFormatter, dumpQueue, findFormatter, getBackupCapacity, getConfig, getFormatters, getMaxRetries, getQueueCapacity, getQueueCount, getRetryInterval, getThread, isBackupEnabled, isCircular, logRecord, newQueue, removeFormatter, run, setBackupCapacity, setBackupEnabled, setCircular, setConfig, setMaxRetries, setQueueCapacity, setRetryInterval, start, stop, toString
 
Methods inherited from class com.ibm.logging.Gate
addFilter, getFilters, isLoggable, isLogging, removeAllFilters, removeFilter, setLogging
 
Methods inherited from class com.ibm.logging.LogObject
addRecordClass, clone, getDescription, getGroup, getName, getRecordClasses, getType, isManaged, maskLongValue, maskToString, removeRecordClass, setDescription, setGroup, setManaged, setName, setType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.logging.IGate
addFilter, getFilters, isLoggable, isLogging, removeAllFilters, removeFilter, setLogging
 
Methods inherited from interface com.ibm.logging.ILogObject
addRecordClass, getRecordClasses, maskLongValue, maskToString, removeRecordClass
 
Methods inherited from interface com.ibm.logging.mgr.IManageable
getDescription, getGroup, getName, getType, isManaged, setDescription, setGroup, setManaged, setName, setType
 

Constructor Detail

AbleJTextAreaHandler

public AbleJTextAreaHandler()
Creates a AbleJTextAreaHandler. The name and description of this object are empty strings.

AbleJTextAreaHandler

public AbleJTextAreaHandler(java.lang.String name)
Creates a AbleJTextAreaHandler. The description of this object is an empty string.
Parameters:
name - The name of this object.

AbleJTextAreaHandler

public AbleJTextAreaHandler(java.lang.String name,
                            java.lang.String desc)
Creates a TextAreaHandler.
Parameters:
name - The name of this object.
desc - The description of this object.

AbleJTextAreaHandler

public AbleJTextAreaHandler(java.lang.String name,
                            java.lang.String desc,
                            javax.swing.JTextArea textArea)
Creates a TextAreaHandler.
Parameters:
name - The name of this object.
desc - The description of this object.
textArea - The JTextArea to which this handler will write.
Method Detail

init

public void init()
Initializes this object to a default state. This method is used by the com.ibm.logging.mgr.LogManager to initialize a log object.
Overrides:
init in class com.ibm.logging.Handler

openDevice

public void openDevice()
Opens the device to which the handler will send its log entries. If this operation is successful the deviceOpen flag is set to true. If not, the handler sets deviceOpen to false and writes a message to System.err.

If the device is already open, it will be closed and then reopened.

Note: It is not necessary for an application to call openDevice. TextAreaHandler will do this automatically before attempting to write a log entry.

Overrides:
openDevice in class com.ibm.logging.Handler

closeDevice

public void closeDevice()
Closes the device to which the handler is sending its log entries and sets the deviceOpen flag to false.
Overrides:
closeDevice in class com.ibm.logging.Handler

writeRecord

protected void writeRecord(com.ibm.logging.ILogRecord record)
Passes a log record synchronously from a logger to a handler. The handler processes the log entry immediately by calling the format method of the configured formatter and then the println method of the configured print writer. The logger must compare the record type against the handler's message or trace mask before calling this method. If the log record is null, this method does nothing.

If an error occurs (as reported by the PrintWriter.checkError method), the deviceOpen flag is set false and the print writer is released.

Overrides:
writeRecord in class com.ibm.logging.Handler
Parameters:
record - A log record.

getTextArea

public javax.swing.JTextArea getTextArea()
Gets the JTextArea used by this handler.
Returns:
The name of the text area. If no text area has been set, null is returned.

setTextArea

public void setTextArea(javax.swing.JTextArea textArea)
Sets the name of the text area used by this handler. If the text area is null, the current text area is not changed.
Parameters:
textArea - The text area.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003