uk.ac.essex.common.io
Class FileOp<T extends ApplicationFile>
java.lang.Object
uk.ac.essex.common.io.FileOp<T>
- Direct Known Subclasses:
- FileOpImpl
public abstract class FileOp<T extends ApplicationFile>
- extends java.lang.Object
Abstract superclass for all operations that load data from files stored
locally. Each function takes a Component as it's parameter. This is to
enable the GUI elements of subclasses to have a link to their 'caller' (so
they know where to place the file fileChooser dialogs).
- See Also:
You should have received a copy of GNU public license with this code.
If not please visit this site
Field Summary |
protected java.io.File |
file
|
Method Summary |
java.io.File |
getFile()
|
abstract T |
open(java.awt.Component caller)
Open a file, subclasses should initially open a file dialog then return
the files data as type Object. |
abstract void |
save(T applicationFile)
Save a data to a file
TODO: throw exceptions for error cases |
abstract boolean |
saveAs(T applicationFile,
java.awt.Component caller)
Save data to a new file, subclasses should allow the user to create the
new file first then the data should be saved to it |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
file
protected java.io.File file
FileOp
public FileOp()
open
public abstract T open(java.awt.Component caller)
- Open a file, subclasses should initially open a file dialog then return
the files data as type Object. This can then be casted to the required
type.
TODO: throw exceptions for error cases
- Parameters:
caller
- the GUI that called this function
- Returns:
- the object that is the selected files data
save
public abstract void save(T applicationFile)
- Save a data to a file
TODO: throw exceptions for error cases
- Parameters:
applicationFile
-
saveAs
public abstract boolean saveAs(T applicationFile,
java.awt.Component caller)
- Save data to a new file, subclasses should allow the user to create the
new file first then the data should be saved to it
- Parameters:
applicationFile
- caller
- the GUI component that called this function
- Returns:
- boolean - true if the file saved ok, false otherwise
getFile
public java.io.File getFile()
- Returns:
- File - the file that has just been opened/saved, null if none