| net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.IDataTypeComponent
All known Subclasses: net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeUnknown, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeFloat, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeTimestamp, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBinary, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeByte, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeDouble, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeInteger, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeJavaObject, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBigDecimal, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBlob, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeOther, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeShort, net.sourceforge.squirrel_sql.plugins.oracle.types.OracleXmlTypeDataTypeComponent, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeLong, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeString, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeTime, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeBoolean, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeClob, net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeDate,
IDataTypeComponent | public interface IDataTypeComponent (Code) | | author: gwg author: These are the calls needed to support the various ways of displaying and author: editing data for each data type. |
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) Read a file and construct a valid object from its contents. | public String | getClassName() Return the name of the Java class used to store this data type in the
application. | 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) Get the JTextArea component for this data type to be used in the
CellPopupDialog and fill in the initial value in the appropriate
representation. | public JTextField | getJTextField() Get the JTextField component for this data type to be used 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.
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. | public String | importObject(FileInputStream inStream) Read a file and construct a valid object from its contents. | public boolean | isEditableInCell(Object originalValue) Returns true if data type may be edited within a table cell, false if
not. | 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 object) Convert the given object into its printable String value for use in Text
output and the in-cell representations (CellRenderer and CellEditor). | public void | setColumnDisplayDefinition(ColumnDisplayDefinition def) Sets the display definition of the Column being operated upon. | 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 void | setTable(JTable table) Sets the JTable of which holds data rendered by this DataTypeComponent. | public boolean | useBinaryEditingPanel() If true, this tells the PopupEditableIOPanel to use the binary editing
panel rather than a pure text panel. | public Object | validateAndConvert(String value, Object originalValue, StringBuffer messageBuffer) Validate that the contents of a cell is in the right form for this data
type and convert that text into an object of the correct (Java) type for
the column Ideally this should be a static function, but the mechanics of
using CellComponentFactory and the constraints of the Java language make
that difficult. | public Object | validateAndConvertInPopup(String value, Object originalValue, StringBuffer messageBuffer) Validate that the contents of a cell is in the right form for this data
type and convert that text into an object of the correct (Java) type for
the column Ideally this should be a static function, but the mechanics of
using CellComponentFactory and the constraints of the Java language make
that difficult. |
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) | | 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 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.
|
getClassName | public String getClassName()(Code) | | Return the name of the Java class used to store this data type in the
application.
|
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.
|
getJTextArea | public JTextArea getJTextArea(Object value)(Code) | | Get the JTextArea component for this data type to be used in the
CellPopupDialog and fill in the initial value in the appropriate
representation. That representation may be the same as is renderObject(),
or it may be different (e.g. a BLOB may have renderObject=>"" but
fill in the actual value in the Popup TextArea).
|
getJTextField | public JTextField getJTextField()(Code) | | Get the JTextField component for this data type to be used in a
CellEditor. The value of the text field is set by the JTable mechanism
using the same mechanism as the renderer. The Assumption here is that the
CellEditor uses the same string representation as the CellRenderer.
|
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.
|
isEditableInCell | public boolean isEditableInCell(Object originalValue)(Code) | | Returns true if data type may be edited within a table cell, false if
not.
|
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 object)(Code) | | Convert the given object into its printable String value for use in Text
output and the in-cell representations (CellRenderer and CellEditor).
|
setColumnDisplayDefinition | public void setColumnDisplayDefinition(ColumnDisplayDefinition def)(Code) | | Sets the display definition of the Column being operated upon.
Parameters: def - the ColumnDisplayDefinition that describes the column in the db table. |
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.
|
setTable | public void setTable(JTable table)(Code) | | Sets the JTable of which holds data rendered by this DataTypeComponent.
Parameters: table - a JTable component |
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) | | Validate that the contents of a cell is in the right form for this data
type and convert that text into an object of the correct (Java) type for
the column Ideally this should be a static function, but the mechanics of
using CellComponentFactory and the constraints of the Java language make
that difficult.
|
validateAndConvertInPopup | public Object validateAndConvertInPopup(String value, Object originalValue, StringBuffer messageBuffer)(Code) | | Validate that the contents of a cell is in the right form for this data
type and convert that text into an object of the correct (Java) type for
the column Ideally this should be a static function, but the mechanics of
using CellComponentFactory and the constraints of the Java language make
that difficult.
|
|
|