TableCellPainter trouble [message #1772861] |
Mon, 18 September 2017 03:02 |
Maximus X Messages: 6 Registered: March 2017 |
Junior Member |
|
|
Hi,
I'm wondering if anybody encountered this issue... I'm using TableCellPainter as configuration for specific columns, however not all rows under this column contain lists of values. Pretty standard configuration from documentation, as below:
private void registerColumnElevenTablePainter(IConfigRegistry configRegistry) {
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TableCellPainter(), DisplayMode.NORMAL, COLUMN_THREE_LABEL);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT, COLUMN_THREE_LABEL);
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TableCellEditor(), DisplayMode.NORMAL, COLUMN_THREE_LABEL);
}
The problem arises when I try to edit values for a row that does not contain lists of values, in that column that was configured for a cellpainter. It only contains a single value at that cell. Attempting to edit it gives me a nattable exception below:
java.lang.NullPointerException
at org.eclipse.nebula.widgets.nattable.edit.editor.TableCellEditor.getCanonicalValue(TableCellEditor.java:202)
at org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor.commit(AbstractCellEditor.java:364)
at org.eclipse.nebula.widgets.nattable.edit.editor.AbstractCellEditor.commit(AbstractCellEditor.java:356)
at org.eclipse.nebula.widgets.nattable.edit.editor.TableCellEditor$InternalFocusListener$1.run(TableCellEditor.java:785)
at org.eclipse.swt.widgets.Display.runTimer(Display.java:4329)
Looks like it happens because indeed it expects a list of editable values at that point. I wonder, is there a way to add TableCellPainter configuration on specific rows only, or perhaps disable it for rows where it is not needed? The other way I thought of is to have all rows contain lists of values (even if the list will contain only a single value), but it seems a little absurd to modify the data to work around this.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03879 seconds