|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DocumentHandler
The DocumentHandler
interface
describes an object that manages registration
and unregistration of documents in a
multi-document-environment.
Method Summary | |
---|---|
void |
addDocument(java.lang.Object source,
Document doc)
Adds a new document to the list of open documents. |
void |
addDocumentListener(DocumentListener l)
Registeres a listener which will be informed about document handler actions such as adding or removing a document. |
Document |
getActiveDocument()
Determines the currently active document. |
Document |
getDocument(int idx)
Returns one of the open documents. |
int |
getDocumentCount()
Returns the number of open documents |
boolean |
isMultiDocumentApplication()
Determines whether the underlying application handles more than a single open document or not. |
void |
removeDocument(java.lang.Object source,
Document doc)
Removes a document from the list of open documents. |
void |
removeDocumentListener(DocumentListener l)
Unregisteres a listener who wishes to not be notified any more about document handler actions such as adding or removing a document. |
void |
setActiveDocument(java.lang.Object source,
Document doc)
Makes a document the active one. |
Method Detail |
---|
boolean isMultiDocumentApplication()
true
if the application
allows more than one document to be opened
at a time. false
for a
single-document-application.int getDocumentCount()
Document getDocument(int idx)
idx
- the index of the document, ranging
from 0
to getDocumentCount() - 1
.
java.lang.IndexOutOfBoundsException
- if idx
is invalidvoid addDocument(java.lang.Object source, Document doc)
DocumentEvent
is generated and dispatched to all
registered listeners. The caller is responsible for calling
setActiveDocument
separately, if desired.
source
- the source of the dispatched DocumentEvent
,
or null
to not dispatch an event.doc
- the document to add.
java.lang.UnsupportedOperationException
- if the caller tries to add
a document when there is already one
and isMultiDocumentApplication
returns false
.
java.lang.IllegalArgumentException
- if the document has been added beforeisMultiDocumentApplication()
void removeDocument(java.lang.Object source, Document doc)
DocumentEvent
is generated and dispatched to all
registered listeners. This method will first call
setActiveDocument( null )
if the removed document
was the active document. After removing the document, this method
will call doc.dispose()
to free resources occupied
by the document.
source
- the source of the dispatched DocumentEvent
,
or null
to not dispatch an event.doc
- the document to remove.
java.lang.IllegalArgumentException
- if the document
was not in the list of known documentsvoid setActiveDocument(java.lang.Object source, Document doc)
DocumentEvent
is generated and dispatched to all
registered listeners.
source
- the source of the dispatched DocumentEvent
,
or null
to not dispatch an event.doc
- the document to make the active one, or null
to indicate that no document is active.
java.lang.IllegalArgumentException
- if the document
is not in the list of known documentsgetActiveDocument()
Document getActiveDocument()
null
, if there is none
(this is the case when all documents have been removed)setActiveDocument( Object, Document )
void addDocumentListener(DocumentListener l)
l
- the listener to addremoveDocumentListener( DocumentListener )
void removeDocumentListener(DocumentListener l)
l
- the listener to removeaddDocumentListener( DocumentListener )
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |