Package diva.gui
Class BasicStoragePolicy
- java.lang.Object
-
- diva.gui.AbstractStoragePolicy
-
- 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$
- Author:
- John Reekie
-
-
Constructor Summary
Constructors Constructor Description BasicStoragePolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
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.
-
-