borland Packages  Class Hierarchy  dbswing Package 

DBListModel component

java.lang.Object
   +----javax.swing.AbstractListModel
           +----com.borland.dbswing.DBListModel

About the DBListModel component

Variables  Constructors  Properties  Methods  Event Listeners

Implements AccessListener, ColumnAware, DataChangeListener, DataSetAware, Designable, Serializable, EventListener, ListModel

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

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.

Example:

// 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.

See also: DBListDataBinder, DBTableModel


DBListModel variables

Variables implemented in javax.swing.AbstractListModel

DBListModel constructors

DBListModel properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

DBListModel methods

Methods implemented in this class

Methods implemented in java.lang.Object

Methods implemented in javax.swing.AbstractListModel

DBListModel event listeners


DBListModel constructors

DBListModel()

  public DBListModel()
Creates a DBListModel by calling the null constructor of its superclass.

DBListModel(com.borland.dx.dataset.DataSet, java.lang.String)

  public DBListModel(DataSet dataSet, String columnName)
Creates a DBListModel with a specified DataSet and column name. Calls the null constructor of its superclass.

Parameters:

dataSet
The DataSet from which the model obtains its data.
columnName
The column name of the DataSet from which the model obtains its data.

DBListModel properties

columnName

 public String getColumnName()
 public void setColumnName(String columnName)
Returns and sets the column name of the DataSet from which this model obtains its data.

See also: DataSet

dataSet

 public DataSet getDataSet()
 public void setDataSet(DataSet dataSet)
Returns and sets the DataSet from which this model obtains its data.

See also: columnName

size

 public int getSize()
Returns the length of the list.

DBListModel event listeners

This component is a source for the following event sets.

listData

 public void addListDataListener(javax.swing.event.ListDataListener )
 public void removeListDataListener(javax.swing.event.ListDataListener )