The Source for Java Technology Collaboration
User: Password:



Shannon Hickey

Shannon Hickey's Blog

Beans Binding 0.6 Release Available

Posted by shan_man on June 21, 2007 at 09:04 AM | Comments (7)

Just a short note to announce that I've posted the 0.6 release of the Beans Binding project at http://beansbinding.dev.java.net

In this release:

  • Improved JTable support
  • More default converters
  • Name your Bindings
  • Compile-time type safety for setting Parameters
  • A handful of method renames

Full details, straight from the release notes:

API Changes/Additions

  • Binding.addBinding/removeBinding/getBindings have been renamed to the more descriptive Binding.addChildBinding/removeChildBinding/getChildBindings

  • Binding.setSourcePath/getSourcePath have been renamed to the more appropriate Binding.setSourceExpression/getSourceExpression

  • To enforce compile-time type safety, the Object varargs parameter has been removed from all constructors and methods in Binding and BindingContext. You must now call setValue directly. To allow for method chaining, setValue now returns the Binding. As an example, replace this binding:

    
      Binding b = new Binding(source, "${property}", target, "property",
                              Parameter1, param1Value, Parameter2, param2Value);
    
    

    with this:

    
      Binding b = new Binding(source, "${property}", target, "property");
      b.setValue(Parameter1, param1Value).setValue(Parameter2, param2Value);
    
    

  • Some Binding and BindingContext methods were updated to throw the more appropriate IllegalArgumentException (rather than IllegalStateException) for certain conditions.

  • Binding now has a name property. The ability to name a binding assists in debugging. Its main goal, however, is to make it possible to fetch bindings by name. This will show its full utility with future changes making it easier to validate and then commit or revert bindings as a group.

    To support naming a binding, the following API additions have been made to Binding:

    • Constructors that take a String name parameter
    • void setName(String name)
    • String getName()
    • addChildBinding methods that take a String name parameter
    • Binding getChildBinding(String name)

    In addition, the following additions have been made to BindingContext:

    • addBinding methods that take a String name parameter
    • Binding getBinding(String name)

  • Added a Parameter to control the editability of a JTable when it is the target of a binding. A new EditableParameter has been added to SwingBindingSupport to control this. It can be used on a top-level binding to control the editability of the entire JTable, and/or on the binding's individual child bindings to control editability of individual columns. For example, to make all columns non-editable, except for the first:

    
      Binding b = new Binding(list, null, table, "elements");
      // whole table is non-editable
      b.setValue(SwingBindingSupport.EditableParameter, false);
      b.addChildBinding("${firstName}, null)
          .setValue(SwingBindingSupport.TableColumnParameter, 0)
          // this column IS editable
          .setValue(SwingBindingSupport.EditableParameter, true);
      b.addChildBinding("${lastName}, null)
          .setValue(SwingBindingSupport.TableColumnParameter, 1);
    
    

Issues Resolved

  • 2: Need converters between various types and String
  • 5: JTable binding support doesn't support sorting and filtering

Other

The JavaDoc in Binding and SwingBindingSupport has been updated to reflect the change to use EL for the source "property".


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment


  • hi Shannon,

    your second example doesn't seem to be valid according to the fact that
    addBind() was renamed to addChildBinding().

    I think setValue() is miss-named an can be renamed to setParameter().

    my two cents,

    Rémi

    Posted by: forax on June 21, 2007 at 01:16 PM

  • Rémi: Oops! Thanks for catching the typo. I've corrected the example. As for renaming setValue to setParameter, I'd actually started considering it and hadn't made up my mind yet. You've brought me back to the question, and I agree with you. I'm going to make this change. Thanks!

    Posted by: shan_man on June 21, 2007 at 01:44 PM

  • Thanks for support editable/not editable colunms in JTable!

    Posted by: filimono on June 22, 2007 at 08:12 AM

  • My pleasure filimono. Not having the support was driving me nuts!

    Posted by: shan_man on June 22, 2007 at 09:48 AM

  • Rémi, thanks again for the feedback! I've just released 0.6.1 with a handful of naming changes that'll make things more intuitive and easier to type. Please see today's blog.

    Posted by: shan_man on June 22, 2007 at 02:48 PM

  • Shannon,

    Using the expression ${firstName} syntax, does nested properties work?
    example:

    ${mailingAddress.zipCode}

    -Carl

    Posted by: carldea on June 30, 2007 at 11:12 PM

  • Carl, nested properties definitely work when using EL expressions. Thanks!

    Posted by: shan_man on July 05, 2007 at 10:32 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds