JHotDraw 6.0b1

org.jhotdraw.contrib
Class SVGStorageFormat

java.lang.Object
  extended by org.jhotdraw.util.StandardStorageFormat
      extended by org.jhotdraw.contrib.SVGStorageFormat
All Implemented Interfaces:
StorageFormat

public class SVGStorageFormat
extends StandardStorageFormat

The SVGStorageFormat can save drawings in SVG 1.0. At this time, it cannot load SVG drawings. TODO: Refactor this and the other storage formats. There is too much duplication.


Constructor Summary
SVGStorageFormat()
           
 
Method Summary
 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()
          Return the file extension recognized by the FileFilter for this StandardStorageFormat.
 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.
 java.lang.String store(java.lang.String fileName, Drawing saveDrawing)
          Store a Drawing as SVG under a given name.
 
Methods inherited from class org.jhotdraw.util.StandardStorageFormat
adjustFileName, createFileFilter, equals, getFileDescription, getFileExtension, getFileFilter, hasCorrectFileExtension, setFileDescription, setFileExtension, setFileFilter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGStorageFormat

public SVGStorageFormat()
Method Detail

createFileExtension

protected java.lang.String createFileExtension()
Return the file extension recognized by the FileFilter for this StandardStorageFormat.

Overrides:
createFileExtension in class StandardStorageFormat
Returns:
the file extension

createFileDescription

public java.lang.String createFileDescription()
Factory method to create a file description for the file type when displaying the associated FileFilter.

Overrides:
createFileDescription in class StandardStorageFormat
Returns:
the file description

isRestoreFormat

public boolean isRestoreFormat()
Description copied from interface: StorageFormat
Every format has to identify itself as able to store and/or restore from the format it represents. If the storage format can load from the format, it should return true in this method.

Specified by:
isRestoreFormat in interface StorageFormat
Overrides:
isRestoreFormat in class StandardStorageFormat
Returns:
boolean true if the format can load
See Also:
StorageFormat.isRestoreFormat()

isStoreFormat

public boolean isStoreFormat()
Description copied from interface: StorageFormat
Every format has to identify itself as able to store and/or restore from the format it represents. If the storage format can save to the format, it should return true in this method.

Specified by:
isStoreFormat in interface StorageFormat
Overrides:
isStoreFormat in class StandardStorageFormat
Returns:
boolean true if the format can save
See Also:
StorageFormat.isStoreFormat()

store

public java.lang.String store(java.lang.String fileName,
                              Drawing saveDrawing)
                       throws java.io.IOException
Store a Drawing as SVG under a given name.

Specified by:
store in interface StorageFormat
Overrides:
store in class StandardStorageFormat
Parameters:
fileName - file name of the Drawing under which it should be stored
saveDrawing - drawing to be saved
Returns:
file name with correct file extension
Throws:
java.io.IOException
See Also:
StorageFormat.store(java.lang.String, org.jhotdraw.framework.Drawing)

restore

public Drawing restore(java.lang.String fileName)
                throws java.io.IOException
Description copied from class: StandardStorageFormat
Restore a Drawing from a file with a given name.

Specified by:
restore in interface StorageFormat
Overrides:
restore in class StandardStorageFormat
Parameters:
fileName - of the file in which the Drawing has been saved
Returns:
restored Drawing
Throws:
java.io.IOException
See Also:
StorageFormat.restore(java.lang.String)

JHotDraw 6.0b1