All Packages Class Hierarchy This Package Previous Next Index
Class framework.ModuleData
java.lang.Object
|
+----framework.ModuleData
- public abstract class ModuleData
- extends Object
- implements Data
Abstract class that should be used as the super class of all Data classes.
It has an implementation for each method of the the Data interface to make
the task of writing a Data class easier. A Data class only has provide
implementations for a limited number of methods in this class and to
override the methods of interest.
This class provides three boolean variables called canLoad, canSave and
canDisplay with the value true
. It also implements emtpy
methods load(), save() and display(). Data classes that can load, save or
display their data need to override the appropriate methods. Data classes
that do not want to provide methods for load, save or display need to
override the corresponding canLoad, canSave or canDisplay variable with one
that has the value false
, so the Framework will not call the
corresponding load(), save() or display() method. Please note: the
canLoad, canSave and canDisplay methods must be public and static because
they are meant to override a variable declared in an interface.
This class is abstract to prevent it from instantiation.
- Version:
- $Revision: $
- See Also:
- Data
-
canDisplay
-
Indicates whether the data objects of this type can be displayed to the
user of the Framework.
-
canLoad
-
Indicates whether the data objects of this type can be loaded from
disk.
-
canSave
-
Indicates whether the data objects of this type can be saved to disk.
-
ModuleData()
-
-
display(String, String)
- All Data classes can have a display method that displays the data to the
user of the Framework.
-
getLoadTags()
- The subclass of this class should implement the getLoadTags method.
-
getSaveTags()
- The subclass of this class should implement the getSaveTags method.
-
load(String)
-
May be overridden by subclasses of this class, the method in the subclass
will then load data from disk.
-
loadFileAvailable(String)
- Checks whether a file exists with this name and (one of the defined)
extension(s).
-
save(String)
-
May be overridden by subclasses of this class, the method in the subclass
will then write data to disk.
-
saveFileAvailable(String)
- Checks whether a file can be saved with this name and the first
extension as it is defined in the data type class.
canLoad
public static boolean canLoad
- Indicates whether the data objects of this type can be loaded from
disk. If there is no load method implemented for the data type then the
Data class should contain a public and static boolean variable called
canLoad that has the value
false
.
- See Also:
- load
canSave
public static boolean canSave
- Indicates whether the data objects of this type can be saved to disk. If
there is no save method implemented for the data type then the Data class
should contain a public and static boolean variable called canSave that
has the value
false
.
- See Also:
- save
canDisplay
public static boolean canDisplay
- Indicates whether the data objects of this type can be displayed to the
user of the Framework. If there is no display method implemented for the
data type then the Data class should contain a public and static boolean
variable called canDisplay that has the value
false
.
- See Also:
- display
ModuleData
public ModuleData()
getLoadTags
protected abstract String[] getLoadTags()
- The subclass of this class should implement the getLoadTags method.
getSaveTags
protected abstract String[] getSaveTags()
- The subclass of this class should implement the getSaveTags method.
load
public void load(String filename) throws FileNotFoundException, IOException
- May be overridden by subclasses of this class, the method in the subclass
will then load data from disk. If not overridden, the subclass must
contain a public and static boolean variable called canLoad which must
have the value
false
, so the Framework will not call the
load() method of the Data class. So in reality this method is
never called.
- See Also:
- canLoad
save
public void save(String filename) throws FileNotFoundException, IOException
- May be overridden by subclasses of this class, the method in the subclass
will then write data to disk. If not overridden, the subclass must
contain a public and static boolean variable called canSave which must
have the value
false
, so the Framework will not call the
save() method of the Data class. So in reality this method is
never called.
- See Also:
- canSave
display
public DataVisualisation display(String title,
String filename)
- All Data classes can have a display method that displays the data to the
user of the Framework. The empty implementation in this class may be
overridden by subclasses, the method in the subclass will then display
the data. If not overridden, the subclass must contain a public and
static boolean variable called canDisplay which must have the value
false
, so the Framework will not call the display() method
of the Data class. So in reality this method is never called.
- Returns:
-
null
. Subclasses must override this
method with one that returns a proper instance of a class that
implements the DataVisualisation class.
- See Also:
- canDisplay, display, DataVisualisation
loadFileAvailable
public File loadFileAvailable(String partialFilename)
- Checks whether a file exists with this name and (one of the defined)
extension(s).
- Returns:
- the
File
if one file has been found that can
be loaded,null
otherwise.
saveFileAvailable
public File saveFileAvailable(String partialFilename) throws DataException
- Checks whether a file can be saved with this name and the first
extension as it is defined in the data type class.
- Returns:
- the
File
if the file can be saved,
null
otherwise.
All Packages Class Hierarchy This Package Previous Next Index