The Artima Developer Community
Sponsored Link

Java Community News
BeansBinding 1.0 Defines Data Binding Standard for Swing

3 replies on 1 page. Most recent reply: Sep 14, 2007 2:55 AM by Achilleas Margaritis

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

BeansBinding 1.0 Defines Data Binding Standard for Swing Posted: Sep 6, 2007 11:30 AM
Reply to this message Reply
Summary
The java.net project released the 1.0 reference implementation of JSR 295, Beans Binding, a data binding framework for JavaBeans. The framework is especially useful in the context binding JavaBeans to Swing components.
Advertisement

A key feature of the JavaBeans specification is the ability to register listeners for bean property changes. In many Swing applications, such listeners notify UI components of changes in bean property states and, conversely, update bean properties based on user input. Indeed, large amounts of Swing application code is often dedicated to managing just such property listeners in support of data binding.

Several solutions to the data binding problem emerged in recent years, such as the open-source JGoodies binding framework. To unify the various data binding approaches, a JCP expert group started work on JSR 295, Beans Binding, in early 2006. The reference implementation for JSR 295 is being developed in the BeansBinding java.net project that recently made its 1.0 release available.

In releasing BeansBinding 1.0, spec lead Shannon Hickey noted that:

Developers who write applications that compose Java Bean components often find themselves writing boilerplate that keeps pairs of properties in sync. PropertyChangeListeners are used to detect changes in the source and target properties and to convert and validate data as it moves between the source and target...

In essence, Beans Binding (JSR 295) is about keeping two properties (typically of two objects) in sync. An additional emphasis is placed on the ability to bind to Swing components, and easy integration with IDEs such as NetBeans...

1.0 represents a major re-architecture of the Beans Binding API, based on the extremely valuable feedback from members of the expert group and the community... While the work on this project continues through the JCP process, with feature additions and possible API changes to come, the current state represents the core API that is expected, for the most part, to persist...

The BeansBinding 1.0 release notes list the main changes from earlier versions:

  • The concept of a property has been factored out into an abstract Property class with two concrete implementations of interest: BeanProperty and ELProperty.
  • Binding is now an abstract class representing a binding between two Property instances (typically associated with two objects).
  • Binding with automatic syncing is implemented by a new concrete AutoBinding subclass.
  • Bindings to complex Swing components (such as JTable, JList and JComboBox) are now handled by custom Binding subclasses.
  • For those synthetic Swing properties that we expose via adapters, those with multiple possible behaviors are exposed as multiple synthetic properties. For example: "text", "text_ON_FOCUS_LOST" and "text_ON_ACTION_OR_FOCUS_LOST" for JTextField; "selectedElement" and "selectedElement_IGNORE_ADJUSTING" for JList and JTable.
  • Everything has been repackaged into org.jdesktop packages

What do you think of the JCP Beans Binding spec, especially in relation to other Java data binding efforts?


Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: BeansBinding 1.0 Defines Data Binding Standard for Swing Posted: Sep 7, 2007 3:19 AM
Reply to this message Reply
The right solution to the wrong problem. What happened to the model-view-controller paradigm? why properties do not have change events?

Morgan Conrad

Posts: 307
Nickname: miata71
Registered: Mar, 2006

Re: BeansBinding 1.0 Defines Data Binding Standard for Swing Posted: Sep 10, 2007 12:34 PM
Reply to this message Reply
Not everything should be MVC. MVC is not a goal in itself, it is an implementation.

Achilleas Margaritis

Posts: 674
Nickname: achilleas
Registered: Feb, 2005

Re: BeansBinding 1.0 Defines Data Binding Standard for Swing Posted: Sep 14, 2007 2:55 AM
Reply to this message Reply
I've read the docs for 1.0 so I can see they use the standard listener mechanism for changing values of properties.

But why the complexity? the library contains over 100 classes. Furthermore, the examples provided are quite complex. For example, in order to bind two properties, 4 lines of code are required, whereas a simpler form could be something like:


bind(textfield1.text, textfield2.text)

Flat View: This topic has 3 replies on 1 page
Topic: Choosing Dual or Quad Core Previous Topic   Next Topic Topic: Mike Stonebraker on Domain-Specific Databases

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use