Java Data Sources > Java Data Source Adapters > Using IlsTableDS2JTableAdapter
 
Using IlsTableDS2JTableAdapter
An instance of IlsTableDS2JTableAdapter is connected both to an IlsTableDataSource object and to an DefaultTableModel object through the methods setTableDataSource/setTableDataSourceEditor and setModel). Then, the adapter subscribes to all the events sent from the data source and from the table model.
When a view is opened and a data source is connected, the adapter is first notified of the table model by the data source through the method modelCreated, so that it can add all the necessary columns to build the data model. Then, each time an IlsRpRow object is instantiated, a row is created in the table model through the method rowChange. The updates on the table properties are notified through the method tableChange.
If a JTable object is attached to the table model, the end-user can see the result in graphical form. The end-user can manipulate the JTable object to modify cell values, and add or delete rows. These changes are notified to the table model. Thus, the adapter that listens to the table model can use the data source API available from the interface IlTableDataSourceEditor (methods dsAddRow, dsDeleteRow, dsUpdateCell, etc.) to add, remove, or update the row representation objects through the data source to reflect the changes that occurred on the table model.
In the class IlsTableDS2JTableAdapter, the method getDSRow enables IlsRpRow objects to access the line indexes in the data model while, conversely, the method getRowNumber lets the data model access the row number to match the line indexes. This correspondence offers the capability to manage representation objects directly.

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.