Issue Details (XML | Word | Printable)

Key: BETTERBEANSBINDING-32
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: fabriziogiudici
Reporter: Witold_Szczerba
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
BetterBeansBinding

JTableBinding.ColumnBinding: cell renderer/editor

Created: 05/Jun/09 11:31 AM   Updated: 12/Jun/09 10:23 PM   Resolved: 12/Jun/09 08:55 PM
Component/s: SwingBinding
Affects Version/s: None
Fix Version/s: 1.3.0

Time Tracking:
Original Estimate: Not Specified
Remaining Estimate: 0 minutes
Remaining Estimate - 0 minutes
Time Spent: 2 hours, 30 minutes
Time Spent - 2 hours, 30 minutes

Tags: jtable table editor renderer


 Description  « Hide

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



fabriziogiudici added a comment - 12/Jun/09 10:23 PM