wyvern.util
Interface DocumentManager


public interface DocumentManager

The DocumentManager interface. If you're using a DocumentControl, you'll need to have your document object implement this interface and store a reference in the docctrl.

Version:
1.0, July 20, 1997
Author:
Steve Yegge

Method Summary
 void closeDocument()
          Tells the Document object to close the current document.
 java.lang.String decorateFilename(java.lang.String filename)
          Many apps have a standard document extension, e.g. ".map".
 boolean isDirty()
          Returns true if the document has been modified.
 void loadDocument(java.lang.String filename)
          Tells the Document object to open the specified document.
 void newDocument()
          Tells the Document object to create a new, empty document.
 void saveDocument(java.lang.String filename)
          Tells the document to save itself to the specified file.
 void setDirty(boolean isDirty)
          Specifies whether the document has been modified.
 

Method Detail

isDirty

public boolean isDirty()
Returns true if the document has been modified. The document object must keep an internal flag that is set whenever the user modifies the document, and cleared when the document is saved.

Returns:
true if the document has been modified since last saved.

setDirty

public void setDirty(boolean isDirty)
Specifies whether the document has been modified. The document object must keep an internal flag that is set whenever the user modifies the document, and cleared when the document is saved.

Parameters:
isDirty - true if the document is now dirty.

newDocument

public void newDocument()
Tells the Document object to create a new, empty document.


closeDocument

public void closeDocument()
Tells the Document object to close the current document.


loadDocument

public void loadDocument(java.lang.String filename)
Tells the Document object to open the specified document.

Parameters:
filename - the full path to the document to open

saveDocument

public void saveDocument(java.lang.String filename)
Tells the document to save itself to the specified file. Note that the document should clear the dirty flag when this is

Parameters:
filename - the file to save to (absolute path)

decorateFilename

public java.lang.String decorateFilename(java.lang.String filename)
Many apps have a standard document extension, e.g. ".map". Before the docctrl checks whether it's overwriting an existing file, it needs to get the name that the file will ultimately be called. The user may have typed "caves" into the JFileSelector, but the app might want it to be called "caves.map". This method is how the docctrl finds out.

Parameters:
filename - the filename the user typed in
Returns:
the name to use for saving the file