|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.util.StandardStorageFormat
public class 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 | |
---|---|
java.lang.String |
createFileDescription()
Factory method to create a file description for the file type when displaying the associated FileFilter. |
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. |
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 |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StandardStorageFormat()
Method Detail |
---|
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()
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)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |