|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.StringableFileIO
Class StringableFileIO contains
methods to load or save the state of a
Stringable model object
using text file IO.
The basic methods use file dialogs. The most complex methods assume a File object has been defined and associated with a text file and then work with that object.
An instance retains information about the
Stringable model object as well as
the file extension, the file filter, and the most
recent directory visited by its file chooser
internal object.
Utilizes the class TextFileIO in
its implementation.
| Field Summary | |
protected Stringable |
model
The stringable model to read or save via this class. |
protected TextFileIO |
textFileIO
The text file IO tool. |
| Constructor Summary | |
StringableFileIO(Stringable model,
String extension)
The constructor that provides the Stringable model to read or save via this class and the file extension for its files. |
|
| Method Summary | |
Stringable |
getModel()
Returns the Stringable model object. |
boolean |
readDataFromFile()
Opens a file dialog to get the file name of a text file with model data and then reads the data into the model. |
boolean |
readDataFromFile(boolean displayErrorDialogs)
Opens a file dialog to get the file name of a text file with model data and then reads the data into the model. |
boolean |
readDataFromFile(File source,
boolean displayErrorDialogs)
Reads the model data from the given text file. |
boolean |
saveDataToFile()
Opens a file dialog to get the file name of a model file and then saves the model data to the file. |
boolean |
saveDataToFile(boolean displayErrorDialogs)
Opens a file dialog to get the file name of a model file and then saves the model data to the file. |
boolean |
saveDataToFile(File target,
boolean displayErrorDialogs)
Saves the model data to the given model file. |
protected boolean |
setModel(String data,
boolean displayErrorDialogs)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Stringable model
protected TextFileIO textFileIO
| Constructor Detail |
public StringableFileIO(Stringable model,
String extension)
The constructor that provides the Stringable model to read or save via this class and the file extension for its files.
Throws NullPointerException if the model
is null.
Uses no file extension if the given extension is
null.
model - the Stringable model requiring file IOextension - the file extension to use for model files
NullPointerException| Method Detail |
public Stringable getModel()
public boolean readDataFromFile()
Opens a file dialog to get the file name of a text file with model data and then reads the data into the model.
Displays error dialogs.
Does nothing to the current data in the model if errors occur.
public boolean readDataFromFile(boolean displayErrorDialogs)
Opens a file dialog to get the file name of a text file with model data and then reads the data into the model.
Displays error dialogs if the parameter is set to true.
Does nothing to the current data in the model if errors occur.
public boolean readDataFromFile(File source,
boolean displayErrorDialogs)
Reads the model data from the given text file.
Does nothing to the current data if errors occur.
source - the data sourcedisplayErrorDialogs - if true display error dialogs
protected boolean setModel(String data,
boolean displayErrorDialogs)
public boolean saveDataToFile()
Opens a file dialog to get the file name of a model file and then saves the model data to the file.
Displays error dialogs.
Does no save if any errors occur.
public boolean saveDataToFile(boolean displayErrorDialogs)
Opens a file dialog to get the file name of a model file and then saves the model data to the file.
Displays error dialogs if the parameter is set to true.
Does no save if any errors occur.
public boolean saveDataToFile(File target,
boolean displayErrorDialogs)
Saves the model data to the given model file.
Displays error dialogs if the last parameter is set to true.
Does no save if any errors occur.
target - the data targetdisplayErrorDialogs - if true display error dialogs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||