All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface framework.Data

public interface Data
extends StoreElement
An object that implements this interface can serve as input for a module and can be used as the output of a module. This interface extends interface store.StoreElement, so objects that implement this interface can be stored in a class that implements the Store interface.

Among other things, this interface contains methods for loading and saving the Data and displaying the Data to the user of the Framework. These methods are called load, save and display. Not every Data class has to provide this functionality. For each of these methods, this interface contains a corresponding boolean variable which indicates wether a particular Data class can load, save or display its data. Before any of these methods are used by the Framework, it checks the corresponding boolean variable and only calls the method if the variable has the value true. These variables are called canLoad, canSave and canDisplay. If a Data class does not provide functionality for loading, saving or displaying its data, it still has to provide an implementation for each of these methods, in order to implement this interface. The Data class can give an empty implementation and set the corresponding access variable to false. The easiest way to create a Data class is to extend class ModuleData. This abstract class has implements the Data interface and has useful implementations for most of the methods from the Data interface.

The access variables, canLoad, canSave and canDisplay are declared in this interface with a default value which is false. Data classes that want to change this value have to contain a public and static boolean variable with the same name. Such a variable hides the variable declared in this interface. A method that wants to access a variable in the Data class must use a reference which is of the same type as the Data class. If it is of the same type as this interface, the method will get the value declared here, the hidden value. If only a reference of the same type as this interface is available, the correct value can be retrieved using reflection.

Version:
$Revision: 1.12 $
See Also:
ModuleData

Variable Index

 o canDisplay
Indicates whether this class can display the Data or not.
 o canLoad
Indicates whether this class can load the data from disk or not.
 o canSave
Indicates whether this class can save the data to disk or not.

Method Index

 o display(String, String)
Display the data of the object to the user of the Framework.
 o load(String)
Load the contents of this data object from a specified file.
 o loadFileAvailable(String)
Checks whether the input file is available or not.
 o save(String)
Save the contents of this data object to a specified file.
 o 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.

Variables

 o canSave
 public static final boolean canSave
Indicates whether this class can save the data to disk or not. The default value, specified in this interface, is false. Data classes that implement this interface can supply a class variable of the same name that has a different value. Such a variable must be public and static, because it needs to override the constant declared here. Because this is an interface, all variables declared here are implicitly public, static and final. If the implementing class contains a variable which has the same name as the constant declared here, but is not public and static, the Framework will not find it.

 o canLoad
 public static final boolean canLoad
Indicates whether this class can load the data from disk or not. The default value, specified in this interface, is false. Data classes that implement this interface can supply a class variable of the same name that has a different value. Such a variable must be public and static, because it needs to override the constant declared here. Because this is an interface, all variables declared here are implicitly public, static and final. If the implementing class contains a variable which has the same name as the constant declared here, but is not public and static, the Framework will not find it.

 o canDisplay
 public static final boolean canDisplay
Indicates whether this class can display the Data or not. The default value, specified in this interface, is false. Data classes that implement this interface can supply a class variable of the same name that has a different value. Such a variable must be public and static, because it needs to override the constant declared here. Because this is an interface, all variables declared here are implicitly public, static and final. If the implementing class contains a variable which has the same name as the constant declared here, but is not public and static, the Framework will not find it.

Methods

 o load
 public abstract void load(String filename) throws FileNotFoundException, IOException
Load the contents of this data object from a specified file.

Parameters:
filename - the name of the file from which to load.
 o save
 public abstract void save(String filename) throws FileNotFoundException, IOException
Save the contents of this data object to a specified file.

Parameters:
filename - the name of the file in which to store the data.
 o display
 public abstract DataVisualisation display(String title,
                                           String filename)
Display the data of the object to the user of the Framework.

Parameters:
title - a text to use identify the Data when it is shown to the user of the Framework. For example, if a window is used to show the Data, this text can be used for the title of the window.
filename - a filename that will be used as a default in case the user of the Framework wants to save the Data while it is shown.
Returns:
an instance of a class that implements the DataVisualisation interface. The instance serves as a link to whatever representation, graphical or otherwise, the Data class has made to display the Data. The Framework uses these links to keep track of the windows that are displaying Data. With this information, it can close all these windows if the user of the Framework desires.
See Also:
DataVisualisation
 o loadFileAvailable
 public abstract File loadFileAvailable(String filename)
Checks whether the input file is available or not. The input file that is checked consists of the filename and extensions (tags) that are/must be defined in the data classes.

 o saveFileAvailable
 public abstract File saveFileAvailable(String filename) 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.

All Packages  Class Hierarchy  This Package  Previous  Next  Index