public interface Document
| Modifier and Type | Field and Description |
|---|---|
static String |
StreamDescriptionProperty
The key for the property that describes the source of a document.
|
static String |
TitleProperty
The key for the property that is the title of a document.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDocumentListener(DocumentListener listener)
Adds a
DocumentListener to this document. |
void |
addUndoableEditListener(UndoableEditListener listener)
Adds an
UndoableEditListener to this document. |
Position |
createPosition(int offs)
Creates a mark in the character content at the specified offset.
|
Element |
getDefaultRootElement()
Returns the default root element.
|
Position |
getEndPosition()
Returns the position that marks the end of the document.
|
int |
getLength()
Returns the length of the document content.
|
Object |
getProperty(Object key)
Returns a document property with the specified key.
|
Element[] |
getRootElements()
Returns the root elements of the document content.
|
Position |
getStartPosition()
Returns the position that marks the beginning of the document
content.
|
String |
getText(int offset,
int length)
Returns the textual content starting at
offset with
a length of length. |
void |
getText(int offset,
int length,
Segment txt)
Fetch the textual content starting at
offset with
a length of length and store it in txt. |
void |
insertString(int offset,
String str,
AttributeSet a)
Inserts a piece of text with an AttributeSet at the specified
offset. |
void |
putProperty(Object key,
Object value)
Sets a document property.
|
void |
remove(int offs,
int len)
Removes a piece of content.
|
void |
removeDocumentListener(DocumentListener listener)
Removes a DocumentListener from this Document.
|
void |
removeUndoableEditListener(UndoableEditListener listener)
Removes an UndoableEditListener from this Document.
|
void |
render(Runnable r)
This allows the Document to be rendered safely.
|
static final String StreamDescriptionProperty
static final String TitleProperty
void addDocumentListener(DocumentListener listener)
DocumentListener to this document.listener - the DocumentListener to addvoid addUndoableEditListener(UndoableEditListener listener)
UndoableEditListener to this document.listener - the UndoableEditListener to addPosition createPosition(int offs) throws BadLocationException
offs - the offset where to place the markBadLocationException - of the specified offset is not a valid
position in the documents contentElement getDefaultRootElement()
Position getEndPosition()
int getLength()
Object getProperty(Object key)
key - the (non-null) key for the property to fetchkey or null if no such property
is storedElement[] getRootElements()
Position getStartPosition()
String getText(int offset, int length) throws BadLocationException
offset with
a length of length.offset - the beginning of the text fragment to fetchlength - the length of the text fragment to fetchoffset with
a length of lengthBadLocationException - if offset or length
are no valid locations in the document contentvoid getText(int offset, int length, Segment txt) throws BadLocationException
offset with
a length of length and store it in txt.offset - the beginning of the text fragment to fetchlength - the length of the text fragment to fetchtxt - the Segment where to store the text fragmentBadLocationException - if offset or length
are no valid locations in the document contentvoid insertString(int offset, String str, AttributeSet a) throws BadLocationException
offset.offset - the location where to insert the contentstr - the textual content to inserta - the Attributes associated with the piece of textBadLocationException - if offset
is not a valid location in the document contentvoid putProperty(Object key, Object value)
key - the key of the propertyvalue - the value of the propertyvoid remove(int offs, int len) throws BadLocationException
offs - the location of the fragment to removelen - the length of the fragment to removeBadLocationException - if offs or len
are no valid locations in the document contentvoid removeDocumentListener(DocumentListener listener)
listener - the DocumentListener to removevoid removeUndoableEditListener(UndoableEditListener listener)
listener - the UndoableEditListener to remove