edu.rice.cs.drjava.model
Interface SingleDisplayModel

All Superinterfaces:
GlobalModel, ILoadDocuments
All Known Implementing Classes:
AbstractGlobalModel, DefaultGlobalModel, GlobalModelTestCase.TestGlobalModel

public interface SingleDisplayModel
extends GlobalModel

A GlobalModel that enforces invariants associated with having one active document at a time. Invariants:

  1. GlobalModel.getOpenDefinitionsDocuments() will always return an array of at least size 1.
  2. (follows from previous) If there is ever no document in the model, a new one will be created.
  3. There is always exactly one active document, which can be get/set via getActiveDocument() and setActiveDocument(edu.rice.cs.drjava.model.OpenDefinitionsDocument).
Other functions added by this class:
  1. When calling ILoadDocuments.openFile(edu.rice.cs.util.FileOpenSelector), if there is currently only one open document, and it is untitled and unchanged, it will be closed after the new document is opened. This means that, in one atomic transaction, the model goes from having one totally empty document open to having one document (the requested one) open.

Version:
$Id: SingleDisplayModel.java 4581 2008-07-15 17:18:39Z rcartwright $

Field Summary
 
Fields inherited from interface edu.rice.cs.drjava.model.GlobalModel
RUNTIME_CLASS_PATH
 
Method Summary
 boolean closeAllFilesOnQuit()
           
 boolean closeFiles(List<OpenDefinitionsDocument> docList)
          Shared code between close project and close All files which only sets the new active document after all documents to be closed have been closed.
 void dispose()
           
 void disposeExternalResources()
          Disposes of external resources, e.g.
 OpenDefinitionsDocument getActiveDocument()
           
 Container getDocCollectionWidget()
           
 File[] getExclFiles()
          Return an array of the files excluded from the current project
 void refreshActiveDocument()
          Invokes the activeDocumentChanged method in the global listener on the argument _activeDocument.
 void setActiveDocument(OpenDefinitionsDocument doc)
          Sets the currently active document by updating the selection model.
 void setActiveFirstDocument()
           
 void setActiveNextDocument()
          Sets the active document to be the next one in the list.
 void setActivePreviousDocument()
          Sets the active document to be the previous one in the list.
 void setExcludedFiles(File[] fs)
          Sets the array of files excluded from the current project
 
Methods inherited from interface edu.rice.cs.drjava.model.GlobalModel
addAuxiliaryFile, addListener, addToBrowserHistory, cleanBuildDirectory, clearHistory, closeAllFiles, closeFile, closeFileWithoutPrompt, closeProject, configNewProject, createFindResultsManager, createNewProject, findFileInPaths, fixPathForNavigator, forceQuit, getAutoRefreshStatus, getAuxiliaryBinTitle, getAuxiliaryDocuments, getBookmarkManager, getBreakpointManager, getBrowserHistoryManager, getBuildDirectory, getClassFiles, getClassPath, getCompilerModel, getConsoleDocument, getCreateJarFile, getCreateJarFlags, getDebugger, getDebugPort, getDocumentCount, getDocumentForFile, getDocumentIterator, getDocumentNavigator, getEditorKit, getExternalBinTitle, getExtraClassPath, getHistoryAsString, getHistoryAsStringWithSemicolons, getInteractionsClassPath, getInteractionsDocument, getInteractionsModel, getJavadocModel, getJUnitModel, getMainClass, getMasterWorkingDirectory, getNonProjectDocuments, getNotifier, getNumCompErrors, getODDForDocument, getOpenDefinitionsDocuments, getPageFormat, getProjectDocuments, getProjectFile, getProjectFiles, getProjectRoot, getSourceBinTitle, getSourceFile, getSourceRootSet, getSwingConsoleDocument, getSwingInteractionsDocument, getWorkingDirectory, hasModifiedDocuments, hasModifiedDocuments, hasOutOfSyncDocuments, hasOutOfSyncDocuments, hasUntitledDocuments, inProject, inProjectPath, interpretCurrentInteraction, isProjectActive, isProjectChanged, loadHistory, loadHistoryAsScript, newFile, newTestCase, openFolder, openProject, printDebugMessage, quit, reloadProject, removeAuxiliaryFile, removeFindResultsManager, removeListener, resetConsole, resetInteractions, resetInteractions, saveAllFiles, saveHistory, saveHistory, saveProject, setAutoRefreshStatus, setBuildDirectory, setCreateJarFile, setCreateJarFlags, setDocumentNavigator, setExtraClassPath, setMainClass, setNumCompErrors, setPageFormat, setProjectChanged, setProjectFile, setProjectRoot, setWorkingDirectory, systemErrPrint, systemInEcho, systemOutPrint, waitForInterpreter
 
Methods inherited from interface edu.rice.cs.drjava.model.ILoadDocuments
openFile, openFiles
 

Method Detail

getActiveDocument

OpenDefinitionsDocument getActiveDocument()
Returns:
the currently active document.

setActiveDocument

void setActiveDocument(OpenDefinitionsDocument doc)
Sets the currently active document by updating the selection model.

Parameters:
doc - Document to set as active

refreshActiveDocument

void refreshActiveDocument()
Invokes the activeDocumentChanged method in the global listener on the argument _activeDocument.

Specified by:
refreshActiveDocument in interface GlobalModel

getDocCollectionWidget

Container getDocCollectionWidget()
Returns:
the IDocumentNavigator container expressed as an AWT component.

setActiveNextDocument

void setActiveNextDocument()
Sets the active document to be the next one in the list.


setActivePreviousDocument

void setActivePreviousDocument()
Sets the active document to be the previous one in the list.


closeFiles

boolean closeFiles(List<OpenDefinitionsDocument> docList)
Shared code between close project and close All files which only sets the new active document after all documents to be closed have been closed.

Parameters:
docList - the list of files to close
Returns:
whether all files were closed

setActiveFirstDocument

void setActiveFirstDocument()

dispose

void dispose()

disposeExternalResources

void disposeExternalResources()
Disposes of external resources, e.g. other VMs.


closeAllFilesOnQuit

boolean closeAllFilesOnQuit()

getExclFiles

File[] getExclFiles()
Return an array of the files excluded from the current project


setExcludedFiles

void setExcludedFiles(File[] fs)
Sets the array of files excluded from the current project