Thanks for the suggestions.
The first does not really work for me as I use setDataSource to apply data to the table. I would like to keep it so that the representation of the data is quite separate from the data itself. For me the data should be Objects such as Strings, Booleans, Integers etc. My view should then determine the presentation.
I tried your second suggestion, overriding the DefaultFieldFactory with a custom one, but found that this was only looked at during the initial construction of the table and so was not responsive to changes in edit / not-edit modes.
I could improve this some by adding table.requestRepaint(), but my other columns show up as ugly disabled editable TextFields. This ends up not looking very nice.
So then I thought I would just override
Table.createField(Container container, Object itemId, Object propertyId, Component uiContext)
and render Boolean as Checkbox. But this does not work either because of code in
Table.paintContent(PaintTarget target) throws PaintException
thus
[code]
if ((iscomponent[currentColumn]
|| iseditable)
&& Component.class.isInstance(cells[CELL_FIRSTCOL + currentColumn]
[i]
)) {
final Component c = (Component) cells[CELL_FIRSTCOL + currentColumn]
[i]
;
if (c == null) {
target.addText(“”);
} else {
c.paint(target);
}
} else {
target.addText((String) cells[CELL_FIRSTCOL + currentColumn]
[i]
);
}
[/code]
If I am understanding this correctly, it seems that Table is insisting that any Component that is not editable should be rendered as text, so I guess that Boolean comes out as true. There seems no opportunity to toggle Enabled/disabled as this is not considered in PaintContent.
I think that what I am really after is that Table should always call c.paint(target) whatever the edit mode. The actual Component could then decide how to render itself using its attribs ‘readOnly’ and/or ‘enabled’. The decision to use a String representation could be made by the Component if it could not come up with anything better??? Combinations of the two attributes could allow four presentations?
I see no quick and easy Override that could do this. I would have to change Table itself.
This seems to be getting complicated.
Are there any simpler suggestions??