au.com.zip.cs
Class LoggedDocument
java.lang.Object
javax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
au.com.zip.cs.LoggedDocument
- All Implemented Interfaces:
- Serializable, Document
public class LoggedDocument
- extends PlainDocument
A PlainDocument that appends all inserts to a logging Writer.
- Author:
- Cameron Simpson <cs@zip.com.au> 28jun2002
- See Also:
- Serialized Form
| Methods inherited from class javax.swing.text.AbstractDocument |
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LoggedDocument
public LoggedDocument(Writer w)
throws IOException
- Constructs a new LoggedDocument that transcribes all
insertString(int,String,AttributeSet)s
to the specified Writer.
- Parameters:
w - the log
- Throws:
IOException
setLogWriter
public void setLogWriter(Writer w)
throws IOException
- Set the current log
Writer, closing the previous one if any.
- Parameters:
w - the new Writer
- Throws:
IOException
getLogWriter
public Writer getLogWriter()
- Return the current log Writer.
close
public void close()
throws IOException
- Close the LoggedDocument.
- Throws:
IOException
insertString
public void insertString(int offset,
String str,
AttributeSet a)
throws BadLocationException
- Insert the supplied
String into the PlainDocument and log it.
- Specified by:
insertString in interface Document- Overrides:
insertString in class PlainDocument
- Parameters:
offset - the insertion locationstr - the String to inserta - the associated AttributeSet
- Throws:
BadLocationException