A few months ago, a tutorial for NetBeans 6.5 called "Building a Java Desktop Database Application" piqued my interest. It also linked to another tutorial called "Binding Beans & Data in a Desktop Application". While I've seen "build a GUI for your SQL database" demos a few dozen times already, this was different.
What was new to me was the Beans Binding library, a subset of the Swing Application Framework. While I've read about attempts to increase desktop integration with Swing before, I've never seen anything like Beans Binding. What it does is synchronize bean property values with Swing components or other bean properties. It does so by making use of bean events that are generated by Swing components.
The implication of this is that rather than having the Swing components contain some values that are loaded or saved into the "model" from time to time, the Model and the View (in the "Model-View-Controller" design) are always synchronized automatically. As such, the Controller only needs to bind the View and the Model together. This is similar to the Spring Web MVC framework. Also, this means that you can have multiple Views on the same Model, and they will all be synchronized in real time.
There are a few things missing from Beans Binding though. It doesn't have a "generic" PropertyStateListener that updates a target bean's property when propertyStateChanged is called (that is, when the source property changed). I wrote one that, given the target bean and target property name, uses java.beans.Introspector and calls its write method automatically. Also, it lacks a binding mechanism that can automatically discover which properties to bind based on the introspection of property names and types. If it had that, binding two objects could be done in a single step in the Controller ("bind those two objects together").
Published on January 5, 2009 at 17:06 EST
Older post: Geek resolutions for 2009
Newer post: Web Tools I Actually Use