zinger.bsheet
Interface Persistence

All Known Implementing Classes:
AbstractPersistence, CompressedXMLPersistence, FlatFilePersistence, HTMLPersistence, StandardMapPersistence, StreamMapPersistence, XMLPersistence

public interface Persistence

Interface for Bean Sheet document persistance.

Author:
Alexey Zinger (inline_four@yahoo.com)

Method Summary
 java.io.File autocorrectFile(java.io.File file)
          Attempts to find a file based on the provided file if the implementation does not accept the file as it's passed in.
 javax.swing.filechooser.FileFilter getFileFilter()
           
 boolean isLoadCapable()
           
 boolean load(javax.swing.JTable table, java.io.File file)
          Loads a document into the model behind the table.
 boolean save(javax.swing.JTable table, java.io.File file)
          Persists the document from the model behind the table.
 

Method Detail

isLoadCapable

boolean isLoadCapable()
Returns:
true if the implementation can load a document as well as persist it

getFileFilter

javax.swing.filechooser.FileFilter getFileFilter()
Returns:
an object that knows how to accept and reject files in accordance with the implementation

load

boolean load(javax.swing.JTable table,
             java.io.File file)
             throws java.io.IOException,
                    java.lang.UnsupportedOperationException
Loads a document into the model behind the table.

Returns:
true if the document was loaded successfully
Throws:
java.lang.UnsupportedOperationException - if the implementation is not capable of loading documents as per isLoadCapable() method
java.io.IOException - if an IO problem occurred during loading the document
See Also:
isLoadCapable()

save

boolean save(javax.swing.JTable table,
             java.io.File file)
             throws java.io.IOException
Persists the document from the model behind the table.

Returns:
true if the document was persisted successfully
Throws:
java.io.IOException - if an IO problem occurred during persisting the document

autocorrectFile

java.io.File autocorrectFile(java.io.File file)
Attempts to find a file based on the provided file if the implementation does not accept the file as it's passed in. A typical implementation of this would autocomplete a file extension. Acceptance of a file is tested by getFileFilter().accept(file).

See Also:
getFileFilter()