org.openide.text
Class FilterDocument

java.lang.Object
  |
  +--org.openide.text.FilterDocument
All Implemented Interfaces:
Document, StyledDocument
Direct Known Subclasses:
FilterStyledDocument

public class FilterDocument
extends Object
implements StyledDocument

Document that delegates all functionality to given document. Useful if a subclass wants to modify a behaviour of a document.

StyledDocument methods are just defaulted to the plainest behavior.


Field Summary
protected  Document original
          the original document to delegate to
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
FilterDocument(Document original)
          Create new document instance.
 
Method Summary
 void addDocumentListener(DocumentListener l)
           
 Style addStyle(String nm, Style parent)
           
 void addUndoableEditListener(UndoableEditListener listener)
           
 Position createPosition(int offset)
           
 Color getBackground(AttributeSet attr)
           
 Element getCharacterElement(int pos)
           
 Element getDefaultRootElement()
           
 Position getEndPosition()
           
 Font getFont(AttributeSet attr)
           
 Color getForeground(AttributeSet attr)
           
 int getLength()
           
 Style getLogicalStyle(int p)
           
 Element getParagraphElement(int pos)
           
 Object getProperty(Object key)
           
 Element[] getRootElements()
           
 Position getStartPosition()
           
 Style getStyle(String nm)
           
 String getText(int offset, int len)
           
 void getText(int offset, int len, Segment txt)
           
 void insertString(int offset, String str, AttributeSet a)
           
 void putProperty(Object key, Object value)
           
 void remove(int offset, int len)
           
 void removeDocumentListener(DocumentListener l)
           
 void removeStyle(String nm)
           
 void removeUndoableEditListener(UndoableEditListener listener)
           
 void render(Runnable r)
           
 void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace)
           
 void setLogicalStyle(int pos, Style s)
           
 void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

original

protected Document original
the original document to delegate to
Constructor Detail

FilterDocument

public FilterDocument(Document original)
Create new document instance.
Parameters:
original - delegated-to document
Method Detail

getLength

public int getLength()
Specified by:
getLength in interface Document

addDocumentListener

public void addDocumentListener(DocumentListener l)
Specified by:
addDocumentListener in interface Document

removeDocumentListener

public void removeDocumentListener(DocumentListener l)
Specified by:
removeDocumentListener in interface Document

addUndoableEditListener

public void addUndoableEditListener(UndoableEditListener listener)
Specified by:
addUndoableEditListener in interface Document

removeUndoableEditListener

public void removeUndoableEditListener(UndoableEditListener listener)
Specified by:
removeUndoableEditListener in interface Document

getProperty

public Object getProperty(Object key)
Specified by:
getProperty in interface Document

putProperty

public void putProperty(Object key,
                        Object value)
Specified by:
putProperty in interface Document

remove

public void remove(int offset,
                   int len)
            throws BadLocationException
Specified by:
remove in interface Document

insertString

public void insertString(int offset,
                         String str,
                         AttributeSet a)
                  throws BadLocationException
Specified by:
insertString in interface Document

getText

public String getText(int offset,
                      int len)
               throws BadLocationException
Specified by:
getText in interface Document

getText

public void getText(int offset,
                    int len,
                    Segment txt)
             throws BadLocationException
Specified by:
getText in interface Document

getStartPosition

public Position getStartPosition()
Specified by:
getStartPosition in interface Document

getEndPosition

public Position getEndPosition()
Specified by:
getEndPosition in interface Document

createPosition

public Position createPosition(int offset)
                        throws BadLocationException
Specified by:
createPosition in interface Document

getRootElements

public Element[] getRootElements()
Specified by:
getRootElements in interface Document

getDefaultRootElement

public Element getDefaultRootElement()
Specified by:
getDefaultRootElement in interface Document

render

public void render(Runnable r)
Specified by:
render in interface Document

addStyle

public Style addStyle(String nm,
                      Style parent)
Specified by:
addStyle in interface StyledDocument

removeStyle

public void removeStyle(String nm)
Specified by:
removeStyle in interface StyledDocument

getStyle

public Style getStyle(String nm)
Specified by:
getStyle in interface StyledDocument

setCharacterAttributes

public void setCharacterAttributes(int offset,
                                   int length,
                                   AttributeSet s,
                                   boolean replace)
Specified by:
setCharacterAttributes in interface StyledDocument

setParagraphAttributes

public void setParagraphAttributes(int offset,
                                   int length,
                                   AttributeSet s,
                                   boolean replace)
Specified by:
setParagraphAttributes in interface StyledDocument

setLogicalStyle

public void setLogicalStyle(int pos,
                            Style s)
Specified by:
setLogicalStyle in interface StyledDocument

getLogicalStyle

public Style getLogicalStyle(int p)
Specified by:
getLogicalStyle in interface StyledDocument

getParagraphElement

public Element getParagraphElement(int pos)
Specified by:
getParagraphElement in interface StyledDocument

getCharacterElement

public Element getCharacterElement(int pos)
Specified by:
getCharacterElement in interface StyledDocument

getForeground

public Color getForeground(AttributeSet attr)
Specified by:
getForeground in interface StyledDocument

getBackground

public Color getBackground(AttributeSet attr)
Specified by:
getBackground in interface StyledDocument

getFont

public Font getFont(AttributeSet attr)
Specified by:
getFont in interface StyledDocument


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.