public class TextDocument extends AbstractDocument
This class also contains a DocumentFactory for documents of this type. The document factory is used by an application to create documents of this type.
| Modifier and Type | Class and Description |
|---|---|
static class |
TextDocument.Factory
TextDocument.Factory is a factory for Text Documents
|
| Modifier and Type | Field and Description |
|---|---|
(package private) java.lang.String |
_text
The string contained in this document.
|
| Constructor and Description |
|---|
TextDocument(Application application)
Create an text document for the given application containing an
empty string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the document.
|
java.lang.String |
getText()
Return the text contained in this document.
|
void |
open()
Open the document from its current file or URL.
|
void |
save()
Save the document to its current file or URL.
|
void |
saveAs(java.io.File file)
Save the document to the given file.
|
void |
saveAs(java.net.URL url)
Save the document to the given URL.
|
void |
setText(java.lang.String text)
Set the text contained by this document.
|
addPropertyChangeListener, getApplication, getEditSupport, getFile, getShortTitle, getTitle, getUndoManager, getURL, isDirty, isEditable, isWritable, removePropertyChangeListener, setDirty, setEditable, setFile, setURL, setWritablepublic TextDocument(Application application)
public void close()
close in interface Documentclose in class AbstractDocumentpublic java.lang.String getText()
public void open()
throws java.lang.Exception
open in interface Documentopen in class AbstractDocumentjava.lang.Exception - If the close operation fails.public void save()
throws java.lang.Exception
save in interface Documentsave in class AbstractDocumentjava.lang.Exception - If the save operation fails.public void saveAs(java.io.File file)
throws java.lang.Exception
saveAs in interface DocumentsaveAs in class AbstractDocumentjava.lang.Exception - If the save-as operation fails.save()public void saveAs(java.net.URL url)
throws java.lang.Exception
saveAs in interface DocumentsaveAs in class AbstractDocumentjava.lang.Exception - If the save-as operation fails.save()public void setText(java.lang.String text)