The Ultimate Business Machine - Archives
List of Categories : Commentary * Database * Singapore * Technology * Travel *
Tue 28 Dec 2004
Doing Cocoa Bindings in Java
Category : Technology
We've found a way to stop our Java-Cocoa demo of Cocoa Bindings from crashing - comment out the call to "super.windowControllerDidLoadNib". Of course, why this should be so remains a mystery, since "[super windowControllerDidLoadNib:aController]" works okay on the Objective-C side?
But, with this out of the way (for the moment), I've converted the project we use for our Java-Cocoa course to Cocoa Bindings :
What does this show?
One, there are places in the framework where you can step in and make a call to an existing database. The resulting data will get picked up by the Table View.
Then, Cocoa Bindings takes over to synchronise the display of the detail view with the table view. This is where we save a lot of writing of Controller-type code. All the notification-related code can disappear. In fact, some of the things handled automatically by Cocoa Bindings work better than the code we write.
Then, at the end of the cycle, we should be able to find a convenient place to push the changes back to the database.
The things left are to figure out how and when to do data validation, how to open the detail window by double-clicking on a selection in the table view, and how to have more than one detail window open (because it's possible that a user may want to compare two detail records side by side). Also, I still don't yet know how to do handle check-boxes (though I've just had an idea).
In summary, this is seriously useful technology, though quite a few kinks remain. I keep watching out for when I'm going to fall off the deep end.
Database access is so good on the Java side - we have an embarrassment of riches using JDBC to connect to a wide range of databases, remotely as well as locally. The down-side is that you get more problems using Java with Cocoa than with Objective-C. But then, there is none of the database capability we've come to expect on the Objective-C side (though Tiger promises to correct this - but is the database access there only going to be single-user/single-machine, and only via SQLite?).