This is really very unfortunate that there are no setters for cell editor and renderer in class JTableBinding.ColumnBinding.
This is typical usage:
JTableBinding scheduleBinding =
SwingBindings.createJTableBinding(UpdateStrategy.READ,
ctr.getSchedule(), scheduleTable);
scheduleBinding.addColumnBinding(BeanProperty.create(ScheduleEntryDTO.ORDINAL))
.setColumnName("no");
scheduleBinding.addColumnBinding(BeanProperty.create(ScheduleEntryDTO.PREMIUM_DUE))
.setColumnName("premium");
scheduleBinding.addColumnBinding(BeanProperty.create(ScheduleEntryDTO.BROKERAGE))
.setColumnName("brokerage");
...more to come...
Now the problem is I would like to apply custom renderers, but the only way to do it (I mean the only way excluding hacking) is to declare column class, like this:
scheduleBinding.addColumnBinding(BeanProperty.create(ScheduleEntryDTO.PREMIUM_DUE))
.setColumnName("premium")
.setColumnClass(XYZ);
and configure JTable like this:
scheduleTable.setDefaultEditor(XYZ, EDITOR);
scheduleTable.setDefaultRenderer(XYZ, RENDERER);
The problem is I have many columns with the values of the same class but I want different renderers/editors apply to them.
That would be extremely helpful if two methods:
#setRenderer
#setEditor
would be added to ColumnBinding class.
–
Witold Szczerba
Fix for