|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdsto.dfc.util.BasicPropertyEventSource
dsto.dfc.swing.persistence.AbstractDocument
dsto.dfc.swing.persistence.FileDocument
public abstract class FileDocument
A base class for documents that are file-based. The default
implementations of readModel(java.lang.Object) and writeModel(java.lang.Object, java.lang.Object) use the
Deserializer and Serializer classes, but these may be
overridden to provide other serialization mechanisms.
| Field Summary | |
|---|---|
protected File |
file
|
protected SerializedFormat |
format
|
| Fields inherited from class dsto.dfc.swing.persistence.AbstractDocument |
|---|
changed |
| Constructor Summary | |
|---|---|
FileDocument()
|
|
| Method Summary | |
|---|---|
protected abstract Object |
createModelInstance()
Return a new model instance. |
protected void |
customizeChooser(String mode,
JFileChooser chooser)
Customize a file chooser before it is displayed. |
protected void |
customizeFileFilter(ExtensionFileFilter filter)
Customize the default file filter used in file choosers. |
protected abstract String |
getDefaultExtension()
The default extension to apply to files with no explicit extension. |
File |
getFile()
|
protected Object |
getLocation()
|
String |
getName()
Returns the file name without extension if one is set. |
abstract String |
getType()
The type of document eg "Spreadsheet". |
Object |
newModel()
Create a new, empty model and set it as the document's model. |
protected Object |
readModel(Object location)
Read a model using Deserializer. |
protected Object |
selectLocation(String mode)
Prompt the user for a location (probably in a persistent storage system) to save the model in. |
void |
setFile(File newValue)
|
protected void |
setLocation(Object newValue)
The abstract location in persistent storage where the document is to be saved. |
protected void |
writeModel(Object location,
Object theModel)
Write a model using Serializer. |
| Methods inherited from class dsto.dfc.swing.persistence.AbstractDocument |
|---|
basicSetModel, checkSaveChanges, dispose, getClient, getModel, handleOpenError, handleSaveError, isChanged, isLocationSelected, modelPropertyChanged, modelStateChanged, open, propertyChange, registerModelListener, save, saveAs, setChanged, setModel, stateChanged, unregisterModelListener, write |
| Methods inherited from class dsto.dfc.util.BasicPropertyEventSource |
|---|
addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeSource, removePropertyChangeListener, setPropertyChangeSource |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface dsto.dfc.util.PropertyEventSource |
|---|
addPropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
protected File file
protected SerializedFormat format
| Constructor Detail |
|---|
public FileDocument()
| Method Detail |
|---|
protected abstract Object createModelInstance()
AbstractDocument
createModelInstance in class AbstractDocumentprotected abstract String getDefaultExtension()
public abstract String getType()
Document
getType in interface DocumentgetType in class AbstractDocumentpublic File getFile()
public void setFile(File newValue)
protected void customizeChooser(String mode,
JFileChooser chooser)
protected void customizeFileFilter(ExtensionFileFilter filter)
protected void setLocation(Object newValue)
AbstractDocument
setLocation in class AbstractDocumentprotected Object getLocation()
getLocation in class AbstractDocumentprotected Object selectLocation(String mode)
AbstractDocumentAbstractDocument.readModel(java.lang.Object),
AbstractDocument.writeModel(java.lang.Object, java.lang.Object) and AbstractDocument.setLocation(java.lang.Object).
selectLocation in class AbstractDocumentmode - The mode the selection is being made in: either "Open" or
"Save".
protected Object readModel(Object location)
throws IOException
Deserializer. May be overridden to enable
alternative deserialization mechanism.
readModel in class AbstractDocumentlocation - The location the persistent store to read from.
IOException - if an error occurred while reading the model.AbstractDocument.selectLocation(java.lang.String)
protected void writeModel(Object location,
Object theModel)
throws IOException
Serializer. May be overridden to enable
alternative serialization mechanism.
writeModel in class AbstractDocumentlocation - The location the persistent store to write to.theModel - The model to write.
IOException - if an error occurred while writing the model.AbstractDocument.selectLocation(java.lang.String)public Object newModel()
Document
newModel in interface DocumentnewModel in class AbstractDocumentpublic String getName()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||