Java Data Sources > Java Data Source Adapters > Using IlsTreeDS2JTreeAdapter
 
Using IlsTreeDS2JTreeAdapter
An instance of IlsTreeDS2JTreeAdapter object is connected both to an IlsTreeDataSource object and to a TreeModel object through the methods setTreeDataSource/ setTreeDataSourceEditor and setModel). Then, the adapter subscribes to all the events sent from the data source and from the tree model.
The method treeItemChange is called for creating, updating, and deleting items in the tree. The updates on the tree properties are notified through a call to the method treeChange. The attached JTree shows a graphical tree object corresponding to the tree model updated by the adapter.
Thus, the adapter that listens to the tree model can use the data source API available from the interface IlTreeDataSourceEditor (methods dsAddItem, dsRemoveItem, etc.) to add, remove, or update tree representation objects through the data source to reflect the changes that occurred on the tree model.
A correspondence map between representation objects and data model objects is maintained. It can be accessed by the methods getDSItem and getMutableTreeNode.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.