Package de.sciss.app
Class AbstractDocumentHandler
- java.lang.Object
-
- de.sciss.app.AbstractDocumentHandler
-
- All Implemented Interfaces:
DocumentHandler,EventManager.Processor
public abstract class AbstractDocumentHandler extends java.lang.Object implements DocumentHandler, EventManager.Processor
A basic implementation of theDocumentHandlerinterface.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Objectsync
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDocumentHandler(boolean isMDA)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDocument(java.lang.Object source, Document doc)Adds a new document to the list of open documents.voidaddDocumentListener(DocumentListener l)Registeres a listener which will be informed about document handler actions such as adding or removing a document.DocumentgetActiveDocument()Determines the currently active document.DocumentgetDocument(int idx)Returns one of the open documents.intgetDocumentCount()Returns the number of open documentsbooleanisMultiDocumentApplication()Determines whether the underlying application handles more than a single open document or not.voidprocessEvent(BasicEvent e)This is called by the EventManager if new events are to be processed.voidremoveDocument(java.lang.Object source, Document doc)Removes a document from the list of open documents.voidremoveDocumentListener(DocumentListener l)Unregisteres a listener who wishes to not be notified any more about document handler actions such as adding or removing a document.voidsetActiveDocument(java.lang.Object source, Document doc)Makes a document the active one.
-
-
-
Method Detail
-
isMultiDocumentApplication
public boolean isMultiDocumentApplication()
Description copied from interface:DocumentHandlerDetermines whether the underlying application handles more than a single open document or not.- Specified by:
isMultiDocumentApplicationin interfaceDocumentHandler- Returns:
trueif the application allows more than one document to be opened at a time.falsefor a single-document-application.
-
getDocumentCount
public int getDocumentCount()
Description copied from interface:DocumentHandlerReturns the number of open documents- Specified by:
getDocumentCountin interfaceDocumentHandler- Returns:
- the number of open documents
-
getDocument
public Document getDocument(int idx)
Description copied from interface:DocumentHandlerReturns one of the open documents.- Specified by:
getDocumentin interfaceDocumentHandler- Parameters:
idx- the index of the document, ranging from0togetDocumentCount() - 1.- Returns:
- the requested document
-
addDocument
public void addDocument(java.lang.Object source, Document doc)Description copied from interface:DocumentHandlerAdds a new document to the list of open documents. ADocumentEventis generated and dispatched to all registered listeners. The caller is responsible for callingsetActiveDocumentseparately, if desired.- Specified by:
addDocumentin interfaceDocumentHandler- Parameters:
source- the source of the dispatchedDocumentEvent, ornullto not dispatch an event.doc- the document to add.- See Also:
DocumentHandler.isMultiDocumentApplication()
-
removeDocument
public void removeDocument(java.lang.Object source, Document doc)Description copied from interface:DocumentHandlerRemoves a document from the list of open documents. ADocumentEventis generated and dispatched to all registered listeners. This method will first callsetActiveDocument( null )if the removed document was the active document. After removing the document, this method will calldoc.dispose()to free resources occupied by the document.- Specified by:
removeDocumentin interfaceDocumentHandler- Parameters:
source- the source of the dispatchedDocumentEvent, ornullto not dispatch an event.doc- the document to remove.
-
setActiveDocument
public void setActiveDocument(java.lang.Object source, Document doc)Description copied from interface:DocumentHandlerMakes a document the active one. The active document is the one whose data representation window has the focus, are more generally speaking, is the one who is affected by editing operations. ADocumentEventis generated and dispatched to all registered listeners.- Specified by:
setActiveDocumentin interfaceDocumentHandler- Parameters:
source- the source of the dispatchedDocumentEvent, ornullto not dispatch an event.doc- the document to make the active one, ornullto indicate that no document is active.- See Also:
DocumentHandler.getActiveDocument()
-
getActiveDocument
public Document getActiveDocument()
Description copied from interface:DocumentHandlerDetermines the currently active document. The active document is the one whose data representation window has the focus, are more generally speaking, is the one who is affected by editing operations.- Specified by:
getActiveDocumentin interfaceDocumentHandler- Returns:
- the active document or
null, if there is none (this is the case when all documents have been removed) - See Also:
DocumentHandler.setActiveDocument( Object, Document )
-
addDocumentListener
public void addDocumentListener(DocumentListener l)
Description copied from interface:DocumentHandlerRegisteres a listener which will be informed about document handler actions such as adding or removing a document.- Specified by:
addDocumentListenerin interfaceDocumentHandler- Parameters:
l- the listener to add- See Also:
DocumentHandler.removeDocumentListener( DocumentListener )
-
removeDocumentListener
public void removeDocumentListener(DocumentListener l)
Description copied from interface:DocumentHandlerUnregisteres a listener who wishes to not be notified any more about document handler actions such as adding or removing a document.- Specified by:
removeDocumentListenerin interfaceDocumentHandler- Parameters:
l- the listener to remove- See Also:
DocumentHandler.addDocumentListener( DocumentListener )
-
processEvent
public void processEvent(BasicEvent e)
This is called by the EventManager if new events are to be processed.- Specified by:
processEventin interfaceEventManager.Processor
-
-