Article: Binding JTree to a database
Light Development has published a new article "Binding JTree to a database". It is available from the Light Development tech section at http://www.lightdev.com/page/37.htm or directly at http://articles.lightdev.com/boundtree/boundtree_article.pdf
The article is accompanied by a complete example application including a simple and reusable persistence framework available at http://articles.lightdev.com/boundtree/PersistentRegionEditor.zip
The article covers:
- how to implement a framework that stores hierarchical data persistently and loads such data dynamically,
- a way to transform hierarchical data to a database table and vice versa,
- how to extend JTree to bind it to a database using the new framework and how to use JDBC and a database server.
Using JPersistentTree and the small persistence framework from this article it is easy to establish and use a transparent and automatically acting connection between JTree and a database. Different databases, other store types, existing persistence solutions as well as other data types can be connected easily by adjusting the data store adapter accordingly. The design approach leaves room for additional features such as a remote connection and is a simple example for how to bind other UI components to data stores too.