/*
* File IO related functions
*/
/**
* Say whether or not object can be exported to and imported from
* a file. We put both export and import together in one test
* on the assumption that all conversions can be done both ways.
* Since we do not understand data of type Unknown, we cannot safely
* export or import it.
*/
/**
* Say whether or not object can be exported to and imported from
* a file. We put both export and import together in one test
* on the assumption that all conversions can be done both ways.
*/
public boolean canDoFileIO() {
return false;
}
/**
* Read a file and construct a valid object from its contents.
* Errors are returned by throwing an IOException containing the
* cause of the problem as its message.
* <P>
* DataType is responsible for validating that the imported
* data can be converted to an object, and then must return
* a text string that can be used in the Popup window text area.
* This object-to-text conversion is the same as is done by
* the DataType object internally in the getJTextArea() method.
*
* <P>
* File is assumed to be and ASCII string of digits
* representing a value of this data type.
*/
/**
* Read a file and construct a valid object from its contents.
* Errors are returned by throwing an IOException containing the
* cause of the problem as its message.
* <P>
* DataType is responsible for validating that the imported
* data can be converted to an object, and then must return
* a text string that can be used in the Popup window text area.
* This object-to-text conversion is the same as is done by
* the DataType object internally in the getJTextArea() method.
*
* <P>
* File is assumed to be printable text characters,
* possibly including newlines and tabs but not characters
* that would require a binary representation to display
* to user.
*/
/**
* Read a file and construct a valid object from its contents.
* Errors are returned by throwing an IOException containing the
* cause of the problem as its message.
* <P>
* DataType is responsible for validating that the imported
* data can be converted to an object, and then must return
* a text string that can be used in the Popup window text area.
* This object-to-text conversion is the same as is done by
* the DataType object internally in the getJTextArea() method.
*
* <P>
* File is assumed to be printable text characters,
* possibly including newlines and tabs but not characters
* that would require a binary representation to display
* to user.
*/
public String importObject(FileInputStream inStream) throws IOException {
/* You can try those code:
java.io.ObjectInputStream objectInputStream = null;
try {
objectInputStream = new java.io.ObjectInputStream(inStream);
return objectInputStream.readObject()+"";
}catch (ClassNotFoundException cnfe) {
// throw new IOException("Class not found: "+ cnfe.toString()+" while reading serialized object");
throw new IOException("Can not import data type JAVA_OBJECT");
}catch (IOException ioe) {
// throw new IOException( ioe.toString() +" while reading serialized object");
throw new IOException("Can not import data type JAVA_OBJECT");
} */
throw new IOException( [[#variable1aff3200]]);
}
/**
* Construct an appropriate external representation of the object
* and write it to a file.
* Errors are returned by throwing an IOException containing the
* cause of the problem as its message.
* <P>
* DataType is responsible for validating that the given text
* text from a Popup JTextArea can be converted to an object.
* This text-to-object conversion is the same as validateAndConvertInPopup,
* which may be used internally by the object to do the validation.
* <P>
* The DataType object must flush and close the output stream before returning.
* Typically it will create another object (e.g. an OutputWriter), and
* that is the object that must be flushed and closed.
*
* <P>
* File is assumed to be and ASCII string of digits
* representing a value of this data type.
*/
/**
* Construct an appropriate external representation of the object
* and write it to a file.
* Errors are returned by throwing an IOException containing the
* cause of the problem as its message.
* <P>
* DataType is responsible for validating that the given text
* text from a Popup JTextArea can be converted to an object.
* This text-to-object conversion is the same as validateAndConvertInPopup,
* which may be used internally by the object to do the validation.
* <P>
* The DataType object must flush and close the output stream before returning.
* Typically it will create another object (e.g. an OutputWriter), and
* that is the object that must be flushed and closed.
*
* <P>
* File is assumed to be printable text characters,
* possibly including newlines and tabs but not characters
* that would require a binary representation to display
* to user.
*/
/**
* Construct an appropriate external representation of the object
* and write it to a file.
* Errors are returned by throwing an IOException containing the
* cause of the problem as its message.
* <P>
* DataType is responsible for validating that the given text
* text from a Popup JTextArea can be converted to an object.
* This text-to-object conversion is the same as validateAndConvertInPopup,
* which may be used internally by the object to do the validation.
* <P>
* The DataType object must flush and close the output stream before returning.
* Typically it will create another object (e.g. an OutputWriter), and
* that is the object that must be flushed and closed.
*
* <P>
* File is assumed to be printable text characters,
* possibly including newlines and tabs but not characters
* that would require a binary representation to display
* to user.
*/
public void exportObject(FileOutputStream outStream, String text) throws IOException {
/* You can try those code:
java.io.ObjectOutputStream objectOutputStream=null;
try {
objectOutputStream = new java.io.ObjectOutputStream(outStream);
objectOutputStream.writeObject(text);
objectOutputStream.flush();
}catch (IOException e) {
throw new IOException("Can not export data type JAVA_OBJECT");
} */
throw new IOException( [[#variable1aff3fa0]]);
}
/*
* Property change control panel
*/
/**
* Generate a JPanel containing controls that allow the user
* to adjust the properties for this DataType.
* All properties are static accross all instances of this DataType.
* However, the class may choose to apply the information differentially,
* such as keeping a list (also entered by the user) of table/column names
* for which certain properties should be used.
* <P>
* This is called ONLY if there is at least one property entered into the DTProperties
* for this class.
* <P>
* Since this method is called by reflection on the Method object derived from this class,
* it does not need to be included in the Interface.
* It would be nice to include this in the Interface for consistancy, documentation, etc,
* but the Interface does not seem to like static methods.
*/
/**
* Generate a JPanel containing controls that allow the user
* to adjust the properties for this DataType.
* All properties are static accross all instances of this DataType.
* However, the class may choose to apply the information differentially,
* such as keeping a list (also entered by the user) of table/column names
* for which certain properties should be used.
* <P>
* This is called ONLY if there is at least one property entered into the DTProperties
* for this class.
* <P>
* Since this method is called by reflection on the Method object derived from this class,
* it does not need to be included in the Interface.
* It would be nice to include this in the Interface for consistancy, documentation, etc,
* but the Interface does not seem to like static methods.
*/
public static OkJPanel getControlPanel() {
/*
* If you add this method to one of the standard DataTypes in the
* fw/datasetviewer/cellcomponent directory, you must also add the name
* of that DataType class to the list in CellComponentFactory, method
* getControlPanels, variable named initialClassNameList.
* If the class is being registered with the factory using registerDataType,
* then you should not include the class name in the list (it will be found
* automatically), but if the DataType is part of the case statement in the
* factory method getDataTypeObject, then it does need to be explicitly listed
* in the getControlPanels method also.
*/
// if this panel is called before any instances of the class have been
// created, we need to load the properties from the DTProperties.
loadProperties();
return new [[#variable1afe81a0]]();
}
|