The Kaylee Binding Framework

Purpose

Kaylee builds upon the JGoodies Binding Framework and the Spring Framework to provide a powerful and easy way to connect Swing forms to business objects. The framework is designed to allow for rapid development of applications while cleanly abstracting away some of the messier details.

The latest release is available on the Files page.

Usage

Using Kaylee is as easy as 1-2-3:

  1. Write a class for your business object that allows the registration of property change listeners, and fires property change events. One easy way to do this is to extend the JGoodies Binding Model class. A future version of Kaylee will provide an even easier way.
  2. Create a Swing form using the graphical editor of your choice (the author highly recommends JFormDesigner). For each component that is to be bound to a bean property, set the "name" property of the component to the name of the bean property. For example, to bind a text field to a bean property named "firstName", you would set the text field's name to "firstName". If you are not using a graphical editor, you can manually call Component.setName() in your code, but this is the tedious way to do it!
  3. Write an XML metadata file that describes your bindings, as described in the documentation. Invoke the static method XmlBindings.bind() passing the Swing form, business object, and the name of this file - and Kaylee takes care of the rest!

History

In 2003 the author wrote a framework that allowed the developer to describe a Swing GUI in XML. It provided for data binding, logical statements, and most of the features that Kaylee aims to provide. However, creating GUIs in a non-interactive fashion soon proved to be tedious. The discovery of JGoodies Binding and JFormDesigner led to the creation of a new framework that carried these ideas forward in a faster, easier paradigm. This codebase, which has been used in production applications for several years, is now being migrated and open-sourced as the Kaylee Framework.

Development Status

The initial release of Kaylee will contain the bare framework necessary to parse the metadata and invoke the binding library. This is not super-exciting but it is enough to use the framework. Future releases will integrate the following features:

The last feature is the newest and most interesting. The current implementation uses OGNL, but now that SpEL exists it probably makes sense to migrate in that direction. In a nutshell this feature allows you to embed logical statements into the binding file which are evaluated and can change properties of the form at runtime (e.g. visible, enabled, etc). There will be more details once the feature development gets underway.

About the Name

Kaylee is the mechanic on Serenity, the ship at the heart of the TV series Firefly. She keeps the ship together and is generally cheerful. Apart from that there is no direct connection, unless you count the time that she was bound during the episode Objects in Space. I'm also told that actress Jewel Staite can drink almost anyone under the table, a fact that I am certain is somehow relevant.

FAQ

Q: Why not just use the JGoodies Binding Framework directly in code?

A: You could, but Kaylee makes it a lot easier. You can create a bean property, drop/name the component in your form editor, and update the metadata all in under a minute. Plus Kaylee offers powerful features (in development) above and beyond simple data binding.