borland Packages  Class Hierarchy  dbswing Package 

DBTableModel component

java.lang.Object
   +----javax.swing.table.AbstractTableModel
           +----com.borland.dbswing.DBTableModel

About the DBTableModel component

Variables  Constructors  Properties  Methods  Event Listeners

Implements AccessListener, DataChangeListener, DataSetAware, Designable, Serializable, EventListener, TableModel

Note: This is a feature of JBuilder Professional and Enterprise.

DBTableModel is an implementation of the Swing TableModel. It obtains its model data from a DataExpress DataSet. DBTableModel is the default TableModel for a JdbTable that has a non-null DataSet.

DBTableModel ignores DataSet Columns that aren't visible in any column operations in the TableModel.

Example:

JTable jTable = new JTable();
DBTableModel DBTableModel = new DBTableModel();
TableDataSet tableDataSet = new TableDataSet();
DBTableModel.setDataSet(tableDataSet);
jTable.setModel(DBTableModel); 

See also: JdbTable


DBTableModel variables

Variables implemented in javax.swing.table.AbstractTableModel

DBTableModel constructors

DBTableModel properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

DBTableModel methods

Methods implemented in this class

Methods implemented in java.lang.Object

Methods implemented in javax.swing.table.AbstractTableModel

DBTableModel event listeners


DBTableModel constructors

DBTableModel()

  public DBTableModel()
Constructs a DBTableModel and with a null DataSet. Calls the constructor of this class that takes a DataSet as a parameter and passes it null.

DBTableModel(com.borland.dx.dataset.DataSet)

  public DBTableModel(DataSet dataSet)
Constructs a DBTableModel using the specified DataSet. Calls the null constructor of its superclass.

Parameters:

DataSet
The DataSet from which the DBTableModel obtains its data.

DBTableModel properties

columnCount

 public int getColumnCount()
Returns the number of columns in the model, which is equal to the number of visible Columns in the DataSet.

dataSet

 public DataSet getDataSet()
 public void setDataSet(DataSet dataSet)
Returns and sets the DataSet used to build this table model.

rowCount

 public int getRowCount()
Returns the number of rows in the model, which is equal to the number of rows in the DataSet.

DBTableModel methods

checkValue(java.lang.Object, int, int)

  protected void checkValue(Object aValue, int rowIndex, int columnIndex)
The checkValue() method checks whether the given value satisfies the column formatter for the specified cell (i.e. dataset row and column). That is to say, whether the value is valid for the corresponding type, or whether the value can be converted successfully to the data type of the target column. It also has the side effect of actually saving the value if the value can be converted to the proper type, or throwing an exception if not.

getColumn(int)

  public Column getColumn(int columnIndex)
Returns the DataSet Column for the specified columnIndex.

Parameters:

columnIndex
The location of the column in the DataSet.

isValidDataSetState()

  protected boolean isValidDataSetState()
Determines whether the DataSet is in a valid state. The DataSet is valid (isValidDataSetState() returns true) if the value of dataSetChanged is false, there is a specified dataSet value, and the specified DataSet is open.

isValidValue(java.lang.Object, int, int)

  public boolean isValidValue(Object aValue, int rowIndex, int columnIndex)
The isValidValue() method is just another entry point for checkValue() to see if a value can be converted to the proper dataset column type. The checkValue() method is called at two different times, once before a user tries to end edit on a cell (the user won't be allowed to leave the cell until the value is valid), and once before a value is actually written into a dataset via DBTableModel. Note that the first case only applies if an edit mask is defined for the column, but the second case happens all the time, including when an application tries to write to a dataset using the DBTableModel directly.

DBTableModel event listeners

This component is a source for the following event sets.

tableModel

 public void addTableModelListener(javax.swing.event.TableModelListener )
 public void removeTableModelListener(javax.swing.event.TableModelListener )