| java.lang.Object net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.BaseDataTypeComponent net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeTimestamp
DataTypeTimestamp | public class DataTypeTimestamp extends BaseDataTypeComponent implements IDataTypeComponent(Code) | | author: gwg author: This class provides the display components for handling Timestamp data types, author: specifically SQL type TIMESTAMP. author: The display components are for: author: author: - read-only display within a table cell
author: - editing within a table cell
author: - read-only or editing display within a separate window
author:
author: The class also contains author: author: - a function to compare two display values
author: to see if they are equal. This is needed because the display format author: may not be the same as the internal format, and all internal object author: types may not provide an appropriate equals() function. author: - a function to return a printable text form of the cell contents,
author: which is used in the text version of the table. author:
author: author: The components returned from this class extend RestorableJTextField author: and RestorableJTextArea for use in editing table cells that author: contain values of this data type. It provides the special behavior for null author: handling and resetting the cell to the original value.
|
Inner Class :public static class DateFormatTypeCombo extends JComboBox | |
Method Summary | |
public boolean | areEqual(Object obj1, Object obj2) Determine if two objects of this data type contain the same value. | public boolean | canDoFileIO() Say whether or not object can be exported to and imported from
a file. | public void | exportObject(FileOutputStream outStream, String text) 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.
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.
The DataType object must flush and close the output stream before returning.
Typically it will create another object (e.g. | public String | getClassName() Return the name of the java class used to hold this data type. | public static OkJPanel | getControlPanel() Generate a JPanel containing controls that allow the user
to adjust the properties for this DataType. | public Object | getDefaultValue(String dbDefaultValue) Get a default value for the table used to input data for a new row
to be inserted into the DB. | public JTextArea | getJTextArea(Object value) | public JTextField | getJTextField() Return a JTextField usable in a CellEditor. | public String | getWhereClauseValue(Object value, ISQLDatabaseMetaData md) When updating the database, generate a string form of this object value
that can be used in the WHERE clause to match the value in the database. | public String | importObject(FileInputStream inStream) Read a file and construct a valid object from its contents. | public boolean | isEditableInCell(Object originalValue) This Data Type can be edited in a table cell. | public boolean | isEditableInPopup(Object originalValue) Returns true if data type may be edited in the popup,
false if not. | public boolean | needToReRead(Object originalValue) See if a value in a column has been limited in some way and
needs to be re-read before being used for editing. | public Object | readResultSet(ResultSet rs, int index, boolean limitDataRead) On input from the DB, read the data from the ResultSet into the appropriate
type of object to be stored in the table cell. | public String | renderObject(Object value) Render a value into text for this DataType. | public void | setPreparedStatementValue(PreparedStatement pstmt, Object value, int position) When updating the database, insert the appropriate datatype into the
prepared statment at the given variable position. | public boolean | useBinaryEditingPanel() If true, this tells the PopupEditableIOPanel to use the
binary editing panel rather than a pure text panel.
The binary editing panel assumes the data is an array of bytes,
converts it into text form, allows the user to change how that
data is displayed (e.g. | public Object | validateAndConvert(String value, Object originalValue, StringBuffer messageBuffer) Implement the interface for validating and converting to internal object. | public Object | validateAndConvertInPopup(String value, Object originalValue, StringBuffer messageBuffer) Validating and converting in Popup is identical to cell-related operation. |
DO_NOT_USE | final public static int DO_NOT_USE(Code) | | |
USE_JDBC_ESCAPE_FORMAT | final public static int USE_JDBC_ESCAPE_FORMAT(Code) | | |
USE_STRING_FORMAT | final public static int USE_STRING_FORMAT(Code) | | |
WHERE_CLAUSE_USAGE_KEY | public static String WHERE_CLAUSE_USAGE_KEY(Code) | | The DTProperties key that is used to store and get the mode that
determines how timestamps are used in where clauses
|
areEqual | public boolean areEqual(Object obj1, Object obj2)(Code) | | Determine if two objects of this data type contain the same value.
Neither of the objects is null
|
canDoFileIO | public boolean canDoFileIO()(Code) | | 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.
|
exportObject | public void exportObject(FileOutputStream outStream, String text) throws IOException(Code) | | 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.
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.
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.
File is assumed to be and ASCII string of digits
representing a value of this data type.
|
getClassName | public String getClassName()(Code) | | Return the name of the java class used to hold this data type.
|
getControlPanel | public static OkJPanel getControlPanel()(Code) | | 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.
This is called ONLY if there is at least one property entered into the DTProperties
for this class.
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.
|
getDefaultValue | public Object getDefaultValue(String dbDefaultValue)(Code) | | Get a default value for the table used to input data for a new row
to be inserted into the DB.
|
getJTextField | public JTextField getJTextField()(Code) | | Return a JTextField usable in a CellEditor.
|
getWhereClauseValue | public String getWhereClauseValue(Object value, ISQLDatabaseMetaData md)(Code) | | When updating the database, generate a string form of this object value
that can be used in the WHERE clause to match the value in the database.
A return value of null means that this column cannot be used in the WHERE
clause, while a return of "null" (or "is null", etc) means that the column
can be used in the WHERE clause and the value is actually a null value.
This function must also include the column label so that its output
is of the form:
"columnName = value"
or
"columnName is null"
or whatever is appropriate for this column in the database.
|
importObject | public String importObject(FileInputStream inStream) throws IOException(Code) | | 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.
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.
File is assumed to be and ASCII string of digits
representing a value of this data type.
|
isEditableInCell | public boolean isEditableInCell(Object originalValue)(Code) | | This Data Type can be edited in a table cell.
|
isEditableInPopup | public boolean isEditableInPopup(Object originalValue)(Code) | | Returns true if data type may be edited in the popup,
false if not.
|
needToReRead | public boolean needToReRead(Object originalValue)(Code) | | See if a value in a column has been limited in some way and
needs to be re-read before being used for editing.
For read-only tables this may actually return true since we want
to be able to view the entire contents of the cell even if it was not
completely loaded during the initial table setup.
|
readResultSet | public Object readResultSet(ResultSet rs, int index, boolean limitDataRead) throws java.sql.SQLException(Code) | | On input from the DB, read the data from the ResultSet into the appropriate
type of object to be stored in the table cell.
|
renderObject | public String renderObject(Object value)(Code) | | Render a value into text for this DataType.
|
setPreparedStatementValue | public void setPreparedStatementValue(PreparedStatement pstmt, Object value, int position) throws java.sql.SQLException(Code) | | When updating the database, insert the appropriate datatype into the
prepared statment at the given variable position.
|
useBinaryEditingPanel | public boolean useBinaryEditingPanel()(Code) | | If true, this tells the PopupEditableIOPanel to use the
binary editing panel rather than a pure text panel.
The binary editing panel assumes the data is an array of bytes,
converts it into text form, allows the user to change how that
data is displayed (e.g. Hex, Decimal, etc.), and converts
the data back from text to bytes when the user editing is completed.
If this returns false, this DataType class must
convert the internal data into a text string that
can be displayed (and edited, if allowed) in a TextField
or TextArea, and must handle all
user key strokes related to editing of that data.
|
validateAndConvert | public Object validateAndConvert(String value, Object originalValue, StringBuffer messageBuffer)(Code) | | Implement the interface for validating and converting to internal object.
Null is a valid successful return, so errors are indicated only by
existance or not of a message in the messageBuffer.
|
validateAndConvertInPopup | public Object validateAndConvertInPopup(String value, Object originalValue, StringBuffer messageBuffer)(Code) | | Validating and converting in Popup is identical to cell-related operation.
|
|
|