diva.gui
Class BasicStoragePolicy

java.lang.Object
  extended by diva.gui.AbstractStoragePolicy
      extended by diva.gui.BasicStoragePolicy
All Implemented Interfaces:
StoragePolicy

public class BasicStoragePolicy
extends AbstractStoragePolicy

A StoragePolicy that doesn't really check for correct operation. This is a simple policy that simply closes modified documents and so on. It is recommended only for simple examples and tutorials.

Version:
$Id: BasicStoragePolicy.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie

Constructor Summary
BasicStoragePolicy()
           
 
Method Summary
 boolean close(Document d)
          Close the document.
 Document open(Application app)
          Open a new document.
 Document open(java.io.File file, Application app)
          Open a file and create a new document.
 Document open(java.net.URL url, Application app)
          Open a URL and create a new document.
 boolean save(Document d)
          Save the document.
 boolean saveAs(Document d)
          Save the document to a user-specified location.
 
Methods inherited from class diva.gui.AbstractStoragePolicy
getDirectory, setDirectory, setDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicStoragePolicy

public BasicStoragePolicy()
Method Detail

close

public boolean close(Document d)
Close the document. Forward the request to the document. Do nothing if the document is null. Always return true, unless an I/O exception occurs.


open

public Document open(Application app)
Open a new document. Open a file chooser and open the selected file using the application's document factory. Return the new document if one was created, otherwise null. If the file exists, then remember it for the next call to getDirectory.


open

public Document open(java.io.File file,
                     Application app)
Open a file and create a new document. Return the new document if one was created, otherwise null. If the file exists, then remember it for the next call to getDirectory.


open

public Document open(java.net.URL url,
                     Application app)
Open a URL and create a new document. Return the new document if one was created, otherwise null.


save

public boolean save(Document d)
Save the document. Forward the request to the document. Do nothing if the document is null. Always return true, unless an I/O exception occurred.


saveAs

public boolean saveAs(Document d)
Save the document to a user-specified location. Open a file chooser and forward the request to the document. Don't change the document's file object. Do nothing if the document is null. Return true if successful, otherwise false.