borland Packages Class Hierarchy dbswing Package
java.lang.Object +----javax.swing.AbstractListModel +----com.borland.dbswing.DBListModel
Variables Constructors Properties Methods Event Listeners
Implements AccessListener, ColumnAware, DataChangeListener, DataSetAware, Designable, Serializable, EventListener, ListModel
DBListModel
is an implementation of the swing ListModel
. It provides data for a list from a DataExpress DataSet
and Column
. A DBListModel
updates itself automatically to changes in its
corresponding DataSet
, such as row filtering, row sorting, the
addition and removal of rows, and so on. Also, if the columnName
property value refers to an invisible DataSet
Column
, or if the value of either the columnName
or dataSet
property is invalid, DBListModel
behaves as if the DataSet
is empty.
DBListModel
is used by JdbList
as its default model. Note that
dbSwing components automatically open or close their attached
DataSets
as necessary. If you are using a DBListModel
independently of any dbSwing components, you are responsible
for explicitly opening or closing the DataSet
before any
requests are made for data from the model.
// Shows the correct way to assign a DBListModel to a // non-dbSwing component. JList jList = new JList(); DBListModel dBListModel = new DBListModel(); dBListModel.setDataSet(dataSet); dBListModel.setColumnName("last name"); try { dataSet.open(); } catch (DataSetException e) { // unable to open the dataset e.printStackTrace(); } jList.setModel(dBListModel);
If you wish to make a JList
data-aware, consider the use of the DBListDataBinder
as an alternative to specifying DBListModel
as its model directly. DBListDataBinder
automatically opens and closes the DataSet
for you. While a DBListModel
fills a list from a DataSet
and keeps the list up-to-date, a DBListDataBinder
synchronizes a list with navigation in a DataSet
and writes list selections to the DataSet
. The two are complementary; you'll often want to use both if you have a custom list component in a data-oriented application.
DBListDataBinder
, DBTableModel
public DBListModel()Creates a
DBListModel
by calling the null
constructor of its superclass.
public DBListModel(DataSet dataSet, String columnName)Creates a
DBListModel
with a specified DataSet
and column name. Calls the null
constructor of its superclass.
dataSet
DataSet
from which the model obtains its data.
columnName
DataSet
from which the model obtains its data.
public String getColumnName() public void setColumnName(String columnName)Returns and sets the column name of the
DataSet
from which this model obtains its data.
DataSet
public DataSet getDataSet() public void setDataSet(DataSet dataSet)Returns and sets the
DataSet
from which this model obtains its data.
columnName
public int getSize()Returns the length of the list.
public void addListDataListener(javax.swing.event.ListDataListener ) public void removeListDataListener(javax.swing.event.ListDataListener )