Overview | Package | Class | Tree | Deprecated | Index | Help |
Java Platform 1.1.7 |
||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Container for text that supports editing and provides notification of changes (serves as the model in an MVC relationship). Support is provided to mark up the text with structure that tracks changes. The unit of structure is called an element. Views will typically be built from an element structure. Each element can have an arbitrary set of attributes associated with it. The interface itself is intended to be free of any policy for structure that is provided, as the nature of the document structure should be determined by the implementation.
Typically there will be only one document structure, but the interface supports building an arbitrary number of structural projections over the text data. The document can have multiple root elements to support multiple document structures. Some examples might be:
Field Summary | |
static java.lang.String | StreamDescriptionProperty
The property name for the description of the stream used to initialize the document. |
static java.lang.String | TitleProperty
The property name for the title of the document, if there is one. |
Method Summary | |
void | addDocumentListener(DocumentListener listener)
Registers the given observer to begin receiving notifications when changes are made to the document. |
void | addUndoableEditListener(UndoableEditListener listener)
Registers the given observer to begin receiving notifications when undoable edits are made to the document. |
Position | createPosition(int offs)
Returns a position that will track change as the document is altered. |
Element | getDefaultRootElement()
Returns the root element that views should be based upon, unless some other mechanism for assigning views to element structures is provided. |
Position | getEndPosition()
Returns a position that represents the end of the document. |
int | getLength()
Returns number of characters of content currently in the document. |
java.lang.Object | getProperty(java.lang.Object key)
Gets properties associated with the document. |
Element[] | getRootElements()
Returns all of the root elements that are defined. |
Position | getStartPosition()
Returns a position that represents the start of the document. |
java.lang.String | getText(int offset,
int length)
Fetches the text contained within the given portion of the document. |
void | getText(int offset,
int length,
Segment txt)
Fetches the text contained within the given portion of the document. |
void | insertString(int offset,
java.lang.String str,
AttributeSet a)
Inserts a string of content. |
void | putProperty(java.lang.Object key,
java.lang.Object value)
Puts a new property on the list. |
void | remove(int offs,
int len)
Removes a portion of the content of the document. |
void | removeDocumentListener(DocumentListener listener)
Unregisters the given observer from the notification list so it will no longer receive change updates. |
void | removeUndoableEditListener(UndoableEditListener listener)
Unregisters the given observer from the notification list so it will no longer receive updates. |
void | render(java.lang.Runnable r)
This allows the model to be safely rendered in the presence of currency, if the model supports being updated asynchronously. |
Field Detail |
public static final java.lang.String StreamDescriptionProperty
public static final java.lang.String TitleProperty
Method Detail |
public int getLength()
public void addDocumentListener(DocumentListener listener)
listener
- the observer to registerpublic void removeDocumentListener(DocumentListener listener)
listener
- the observer to registerpublic void addUndoableEditListener(UndoableEditListener listener)
listener
- the observer to registerpublic void removeUndoableEditListener(UndoableEditListener listener)
listener
- the observer to registerpublic java.lang.Object getProperty(java.lang.Object key)
key
- a non-null propertypublic void putProperty(java.lang.Object key, java.lang.Object value)
key
- the non-null property key
value
- the property valuepublic void remove(int offs, int len) throws BadLocationException
offs
- the offset from the begining >= 0
len
- the number of characters to remove >= 0public void insertString(int offset, java.lang.String str, AttributeSet a) throws BadLocationException
offset
- the offset into the document to insert the content >= 0.
All positions that track change at or after the given location
will move.
str
- the string to insert
a
- the attributes to associate with the inserted
content. This may be null if there are no attributes.public java.lang.String getText(int offset, int length) throws BadLocationException
offset
- the offset into the document representing the desired
start of the text >= 0
length
- the length of the desired string >= 0public void getText(int offset, int length, Segment txt) throws BadLocationException
offset
- the offset into the document representing the desired
start of the text >= 0
length
- the length of the desired string >= 0
txt
- the Segment object to return the text inpublic Position getStartPosition()
public Position getEndPosition()
public Position createPosition(int offs) throws BadLocationException
offs
- the offset from the start of the document >= 0public Element[] getRootElements()
public Element getDefaultRootElement()
public void render(java.lang.Runnable r)
r
- a Runnable used to render the modelOverview | Package | Class | Tree | Deprecated | Index | Help |
Java Platform 1.1.7 |
||
PREV CLASS | NEXT CLASS | FRAMES | NO FRAMES | ||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |