|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.util.StandardStorageFormat
A StandardStorageFormat is an internal file format to store and restore Drawings. It uses its own descriptive syntax ands write classes and attributes as plain text in a text file. The StandardStorageFormat has the file extension "draw" (e.g. my_picasso.draw).
Constructor Summary | |
StandardStorageFormat()
Create a StandardStorageFormat for storing and restoring Drawings. |
Method Summary | |
protected java.lang.String |
adjustFileName(java.lang.String testFileName)
Adjust a file name to have the correct file extension. |
java.lang.String |
createFileDescription()
Factory method to create a file description for the file type when displaying the associated FileFilter. |
protected java.lang.String |
createFileExtension()
Factory method to create the file extension recognized by the FileFilter for this StandardStorageFormat. |
protected javax.swing.filechooser.FileFilter |
createFileFilter()
Factory method to create a FileFilter that accepts file with the appropriate file exention used by a javax.swing.JFileChooser. |
boolean |
equals(java.lang.Object compareObject)
Test, whether two StorageFormats are the same. |
java.lang.String |
getFileDescription()
Return the file description for the file type of the storage format |
java.lang.String |
getFileExtension()
Return the file extension for the storage format |
javax.swing.filechooser.FileFilter |
getFileFilter()
Return the FileFilter used to identify Drawing files with the correct file extension for this StorageFormat. |
protected boolean |
hasCorrectFileExtension(java.lang.String testFileName)
Test whether the file name has the correct file extension |
boolean |
isRestoreFormat()
Every format has to identify itself as able to store and/or restore from the format it represents. |
boolean |
isStoreFormat()
Every format has to identify itself as able to store and/or restore from the format it represents. |
Drawing |
restore(java.lang.String fileName)
Restore a Drawing from a file with a given name. |
void |
setFileDescription(java.lang.String newFileDescription)
Set the file description for the file type of the storage format |
void |
setFileExtension(java.lang.String newFileExtension)
Set the file extension for the storage format |
void |
setFileFilter(javax.swing.filechooser.FileFilter newFileFilter)
Set the FileFilter used to identify Drawing files with the correct file extension for this StorageFormat. |
java.lang.String |
store(java.lang.String fileName,
Drawing saveDrawing)
Store a Drawing under a given name. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StandardStorageFormat()
Method Detail |
protected java.lang.String createFileExtension()
public void setFileExtension(java.lang.String newFileExtension)
newFileExtension
- extensionpublic java.lang.String getFileExtension()
public java.lang.String createFileDescription()
public void setFileDescription(java.lang.String newFileDescription)
newFileDescription
- description of the file typepublic java.lang.String getFileDescription()
protected javax.swing.filechooser.FileFilter createFileFilter()
public void setFileFilter(javax.swing.filechooser.FileFilter newFileFilter)
newFileFilter
- FileFilter for this StorageFormatpublic javax.swing.filechooser.FileFilter getFileFilter()
getFileFilter
in interface StorageFormat
public boolean isRestoreFormat()
StorageFormat
isRestoreFormat
in interface StorageFormat
true
if the format can loadStorageFormat.isRestoreFormat()
public boolean isStoreFormat()
StorageFormat
isStoreFormat
in interface StorageFormat
true
if the format can saveStorageFormat.isStoreFormat()
public java.lang.String store(java.lang.String fileName, Drawing saveDrawing) throws java.io.IOException
store
in interface StorageFormat
fileName
- file name of the Drawing under which it should be storedsaveDrawing
- drawing to be saved
java.io.IOException
public Drawing restore(java.lang.String fileName) throws java.io.IOException
restore
in interface StorageFormat
fileName
- of the file in which the Drawing has been saved
java.io.IOException
public boolean equals(java.lang.Object compareObject)
protected java.lang.String adjustFileName(java.lang.String testFileName)
testFileName
- file name to be tested for a correct file extension
protected boolean hasCorrectFileExtension(java.lang.String testFileName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |