Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
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 String | StreamDescriptionProperty
|
static String | TitleProperty
|
Method Summary | |
void | addDocumentListener(DocumentListener listener)
|
void | addUndoableEditListener(UndoableEditListener listener)
|
Position | createPosition(int offs)
|
Element | getDefaultRootElement()
|
Position | getEndPosition()
|
int | getLength()
|
Object | getProperty(Object key)
|
Element[] | getRootElements()
|
Position | getStartPosition()
|
String | getText(int offset,
int length)
|
void | getText(int offset,
int length,
Segment txt)
|
void | insertString(int offset,
String str,
AttributeSet a)
|
void | putProperty(Object key,
Object value)
|
void | remove(int offs,
int len)
|
void | removeDocumentListener(DocumentListener listener)
|
void | removeUndoableEditListener(UndoableEditListener listener)
|
void | render(Runnable r)
|
Field Detail |
public static final String StreamDescriptionProperty
public static final String TitleProperty
Method Detail |
public int getLength()
public void addDocumentListener(DocumentListener listener)
listener
- the observer to register
public void removeDocumentListener(DocumentListener listener)
listener
- the observer to register
public void addUndoableEditListener(UndoableEditListener listener)
listener
- the observer to register
public void removeUndoableEditListener(UndoableEditListener listener)
listener
- the observer to register
public Object getProperty(Object key)
key
- a property
public void putProperty(Object key, Object value)
key
- the property key
value
- the property value
public void remove(int offs, int len) throws BadLocationException
offs
- the offset from the begining
len
- the number of characters to remove
public void insertString(int offset, String str, AttributeSet a) throws BadLocationException
offset
- the offset into the document to insert the content.
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 String getText(int offset, int length) throws BadLocationException
offset
- the offset into the document representing the desired
start of the text
length
- the length of the desired string
public void getText(int offset, int length, Segment txt) throws BadLocationException
offset
- the offset into the document representing the desired
start of the text
length
- the length of the desired string
txt
- the Segment object to return the text in
public Position getStartPosition()
public Position getEndPosition()
public Position createPosition(int offs) throws BadLocationException
offs
- the offset from the start of the document
public Element[] getRootElements()
public Element getDefaultRootElement()
public void render(Runnable r)
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |