javaswtnattablenebula

Nattable Display converter shifts columns when the table is scrolled horizontally


I have used a custom DisplayConverter on some columns of my Nattable.This displayconverter shows long values as hex strings. Whenever I scroll my Nattable horizontally, this converter shifts one/mulitple columns. This results in columns which show hex values to be shown in default numeral format. On the other hand, columns which should be showing numerals show hex values. In the following images, the first image shows how it should be displayed, that is column number 2 and 7 should show hex values (these are just long values with my custom converter applied). When I scroll my table to the right, this converter is then applied to column number 3 and 8.

Default (as it should be)

Scrolled right

I have applied my CustomDisplayConverter ( column override HEX_FORMAT) to certain columns. LinkerMapHexAddressDisplayConverter is the custom display converter which converts long values to hex strings for display.

'columnLabelAccumulator.registerColumnOverrides(
            pnames.indexOf(ILinkerMapConstants.PROP_KEY_SECTION_SIZE), NUMBER_FORMAT);//column 3
    columnLabelAccumulator.registerColumnOverrides(
            pnames.indexOf(ILinkerMapConstants.PROP_KEY_OBJECT_SIZE), NUMBER_FORMAT);//column 8

    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
            new DefaultLongDisplayConverter(), DisplayMode.NORMAL, NUMBER_FORMAT);

    columnLabelAccumulator.registerColumnOverrides(
            pnames.indexOf(ILinkerMapConstants.PROP_KEY_SECTION_ADDRESS), HEX_FORMAT);//column 2
    columnLabelAccumulator.registerColumnOverrides(
            pnames.indexOf(ILinkerMapConstants.PROP_KEY_OBJECT_MODULE_ADDRESS),
            HEX_FORMAT);//column 7

    configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER,
            new LinkerMapHexAddressDisplayConverter(), DisplayMode.NORMAL,
            HEX_FORMAT);'

Solution

  • This happens if you apply your custom labels (HEX_FORMAT in your case) on the ViewportLayer or above. If you have a strong relation on the structure, you should apply the labels on the DataLayer as there is no index-position conversion.