diva.whiteboard
Class SketchStoragePolicy

java.lang.Object
  extended by diva.gui.AbstractStoragePolicy
      extended by diva.gui.DefaultStoragePolicy
          extended by diva.whiteboard.SketchStoragePolicy
All Implemented Interfaces:
StoragePolicy

public class SketchStoragePolicy
extends DefaultStoragePolicy

A SketchStoragePolicy implements methods of closing, opening, and saving sketch documents. Only the saveAs method is overwritten, the rest of the methods are the same as DefaultStoragePolicy.

Version:
$Revision: 1.8 $
Author:
Heloise Hse (hwawen@eecs.berkeley.edu)

Field Summary
static String JPEG
          The file extension for JPEG images.
static String SML
          The file extension for sketch documents.
 
Constructor Summary
SketchStoragePolicy()
           
 
Method Summary
 boolean saveAs(Document d)
          Save the document to a user-specified location.
 
Methods inherited from class diva.gui.DefaultStoragePolicy
close, getFileChooser, getOpenFileChooser, getSaveFileChooser, open, open, open, save
 
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
 

Field Detail

SML

public static final String SML
The file extension for sketch documents.

See Also:
Constant Field Values

JPEG

public static final String JPEG
The file extension for JPEG images.

See Also:
Constant Field Values
Constructor Detail

SketchStoragePolicy

public SketchStoragePolicy()
Method Detail

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 successul, otherwise false. File extension is checked and modified in the following way:
  1. If the selected file filter is "*.*", then the file will be saved in .sml format. If the file name does not have a ".sml" extension, it is appended with ".sml".
  2. If the selected file filter is ".gif" or ".sml", the corresponding file extension will be appended if the file name lacks the extension.

Specified by:
saveAs in interface StoragePolicy
Overrides:
saveAs in class DefaultStoragePolicy


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.