zinger.bsheet
Class AbstractPersistence

java.lang.Object
  extended by zinger.bsheet.AbstractPersistence
All Implemented Interfaces:
Persistence
Direct Known Subclasses:
HTMLPersistence, StandardMapPersistence

public abstract class AbstractPersistence
extends java.lang.Object
implements Persistence

Base class for Persistence implementations. Provides basic autocorrectFile(File) implementation based on supported file extensions.

Author:
Alexey Zinger (inline_four@yahoo.com)
See Also:
autocorrectFile(java.io.File)

Field Summary
protected  java.lang.String[] extensions
           
protected  javax.swing.filechooser.FileFilter fileFilter
           
 
Constructor Summary
AbstractPersistence(javax.swing.filechooser.FileFilter fileFilter, java.lang.String[] extensions)
           
 
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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface zinger.bsheet.Persistence
isLoadCapable, load, save
 

Field Detail

fileFilter

protected final javax.swing.filechooser.FileFilter fileFilter

extensions

protected final java.lang.String[] extensions
Constructor Detail

AbstractPersistence

public AbstractPersistence(javax.swing.filechooser.FileFilter fileFilter,
                           java.lang.String[] extensions)
Method Detail

getFileFilter

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

autocorrectFile

public java.io.File autocorrectFile(java.io.File file)
Description copied from interface: Persistence
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).

Specified by:
autocorrectFile in interface Persistence
See Also:
Persistence.getFileFilter()