Package de.sciss.app

Class AbstractDocumentHandler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object sync  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractDocumentHandler​(boolean isMDA)  
    • Field Detail

      • sync

        protected final java.lang.Object sync
    • Constructor Detail

      • AbstractDocumentHandler

        protected AbstractDocumentHandler​(boolean isMDA)
    • Method Detail

      • isMultiDocumentApplication

        public boolean isMultiDocumentApplication()
        Description copied from interface: DocumentHandler
        Determines whether the underlying application handles more than a single open document or not.
        Specified by:
        isMultiDocumentApplication in interface DocumentHandler
        Returns:
        true if the application allows more than one document to be opened at a time. false for a single-document-application.
      • getDocumentCount

        public int getDocumentCount()
        Description copied from interface: DocumentHandler
        Returns the number of open documents
        Specified by:
        getDocumentCount in interface DocumentHandler
        Returns:
        the number of open documents
      • getDocument

        public Document getDocument​(int idx)
        Description copied from interface: DocumentHandler
        Returns one of the open documents.
        Specified by:
        getDocument in interface DocumentHandler
        Parameters:
        idx - the index of the document, ranging from 0 to getDocumentCount() - 1.
        Returns:
        the requested document
      • addDocument

        public void addDocument​(java.lang.Object source,
                                Document doc)
        Description copied from interface: DocumentHandler
        Adds a new document to the list of open documents. A DocumentEvent is generated and dispatched to all registered listeners. The caller is responsible for calling setActiveDocument separately, if desired.
        Specified by:
        addDocument in interface DocumentHandler
        Parameters:
        source - the source of the dispatched DocumentEvent, or null to 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: DocumentHandler
        Removes a document from the list of open documents. A 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.
        Specified by:
        removeDocument in interface DocumentHandler
        Parameters:
        source - the source of the dispatched DocumentEvent, or null to not dispatch an event.
        doc - the document to remove.
      • setActiveDocument

        public void setActiveDocument​(java.lang.Object source,
                                      Document doc)
        Description copied from interface: DocumentHandler
        Makes 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. A DocumentEvent is generated and dispatched to all registered listeners.
        Specified by:
        setActiveDocument in interface DocumentHandler
        Parameters:
        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.
        See Also:
        DocumentHandler.getActiveDocument()
      • getActiveDocument

        public Document getActiveDocument()
        Description copied from interface: DocumentHandler
        Determines 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:
        getActiveDocument in interface DocumentHandler
        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 )