Skip to main content

First enhancements on BetterBeansBinding

Posted by fabriziogiudici on June 15, 2009 at 10:55 AM PDT

After the May pause, I've resumed working on BBB. As anticipated, the focus now is on test coverage, but I've also started working on some enhancements / bugs submitted by people. For instance, BETTERBEANSBINDING-32, "JTableBinding.ColumnBinding: cell renderer/editor" is about adding the capability of specifying a cell renderer and / or editor for any column of a JTableBinding:

final List<MockBean> beans = new ArrayList<MockBean>();
beans.add(new MockBean(1, 11.1, "First row"));
beans.add(new MockBean(2, 22.2, "Second row"));
beans.add(new MockBean(3, 33.3, "Third row"));
beans.add(new MockBean(4, 44.4, "Fourth row"));

final IntegerTableCellRenderer integerTableCellRenderer = new IntegerTableCellRenderer();
final DoubleTableCellRenderer doubleTableCellRenderer = new DoubleTableCellRenderer();
final SpinnerTableCellEditor spinnerTableCellEditor = new SpinnerTableCellEditor();

final JTable table = new JTable();
final JTableBinding binding = SwingBindings.createJTableBinding(UpdateStrategy.READ, beans, table);

binding.addColumnBinding(BeanProperty.create(MockBean.PROP_PROPERTY1)).
        setColumnName("property1").
        setEditable(true).
        setEditor(spinnerTableCellEditor).
        setRenderer(integerTableCellRenderer);

binding.addColumnBinding(BeanProperty.create(MockBean.PROP_PROPERTY2)).
        setColumnName("property2").
        setRenderer(doubleTableCellRenderer);

binding.addColumnBinding(BeanProperty.create(MockBean.PROP_PROPERTY3)).
        setColumnName("property3");

binding.bind();

The priority I'll give to issues is the result of a "cost function" involving different variables:
  1. Whether you've submitted a patch (some issues have got it)
  2. Whether you've submitted a reasonable good test case
  3. How much I've got acquainted to the related part of the code

I've given up, for now, with automatically copying the issues from the old BB tracker at java.net - I've spent a considerable effort in setting up the software factory, but now I'd like to focus on the code. So, if you have urgent issues pending in BB, please open them again to BBB (maybe adding a reference to the old issue tracker).

Recall that it's possible to vote for issues, and I would take it into account together with the other criteria.