BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Beans Binding Update: Scott Violet on JSR 295

Beans Binding Update: Scott Violet on JSR 295

Bookmarks

Scott Violet has written an update on the status of JSR 295 (Beans Binding). While externally, there has been little happening since last summer, the expert group has made substantial progress and he posts a small demo and some code.

Violet warns that they are not done and his example will likely change before they finish, but he posts some code showing how to bind a List of Bugs to a JTable. Here is an example of the binding code:

context = new BindingContext();

List bugs = ...;
Binding tableBinding = context.addBinding(
bugs, // Source for the binding, the List of bugs in this case.
null, // Expression, relative to the source, used in obtaining the property.
// For this example it's null, meaning use bugs as is.
bugTable, // Target of the binding, a JTable in this case.
"elements"); // The property of the target to bind to.

tableBinding.addBinding(
  "${ID}", // Expression evaluated relative to each Bug.
// In this case, it's treated as bug.getID().
null, // Target value (I'm not going to get into this parameter now)
TableColumnParameter, 0); // Specifies the binding applies to the first column

One of the features of binding which has drawn numerous questions in the comments of his post is the use of the JSP Expresion Language to specify the source of a binding. Violet describes why they chose EL:

Until java has first class support for properties, some syntax will need to be adopted. EL was created for needs similar to beans binding and is a natural fit. No point in inventing a new duplicate syntax.

Violet says he is working on making the source available, and some of the commenters hope that he will open a JSR project on java.net to get more feedback from the community.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Cooperation between Sun and eclipse.org

    by Ulrich Weber,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    There's something awfully wrong within the Java-community It seems that one only person is working on JSR 295. Microsoft has databinding since 2000 for .NET. Why does Sun's Scott Violett not cooperate with the Eclipse-team doing almost the same technology? Look at the API-proposition from eclipse.org and the one from Sun. That's essentially the same thing.

    How many years do we have to wait until JSR 295 ships? Another 2 or 3 years? The Eclipse-databinding is ready to ship right now. You should make another interview with the Eclipse-team. And off-course you should ask why there's no cooperation betwen Sun and the Eclipse-team.

  • Re: Cooperation between Sun and eclipse.org

    by Catalin Strimbei,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Java world already has many binding frameworks (JGoodies bindings, Oracle ADF with or without BC, Eclipse JFace has its own binding mechanism). The problem reside in standardization and general IDE declarative support.

  • Wow still using Strings

    by Jeppe Cramon,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    It's beyond me that they still use strings to represent the property binding, when you have a stongly typed language where the compiler and IDE tools (code completion, refactoring) can help. String are too fragile, in 2007 we should be able to do it smarter...

  • Re: Wow still using Strings

    by Rafael de F. Ferreira,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Carlos Villela's "static reflection" suggestion would be a big help in this regard.

  • Re: Wow still using Strings

    by Gerald Loeffler,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    It's beyond me that they still use strings to represent the property binding


    so what would you suggest, apart from extending the language?

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT