Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Scrolling changing style
Scrolling changing style [message #1832072] Tue, 08 September 2020 06:22 Go to next message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 31
Registered: March 2020

I'm facing an issue when scrolling in a custom styled table.

In the first picture attached, the first two lines of the table have the strikethrough style, but after scrolling once, the style is 'moved' to the next two lines (the second picture attached). So, while I'm scrolling, the style keeps 'moving' up/down.

The relevant code snippets:
BodyLayerStack bodyLayerStack = new BodyLayerStack(this.attributes, columnPropertyAccessor);
bodyLayerStack.setConfigLabelAccumulator(new ColumnLabelAccumulator());

IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());

SortHeaderLayer sortHeaderLayer = new SortHeaderLayer<>(columnHeaderLayer, new GlazedListsSortModel<>(bodyLayerStack.getSortedList(), columnPropertyAccessor, configRegistry, columnHeaderDataLayer));

FilterRowHeaderComposite filterRowHeaderLayer = new FilterRowHeaderComposite<>(
	new DefaultGlazedListsFilterStrategy<>(bodyLayerStack.getFilterList(), columnPropertyAccessor,configRegistry),
	sortHeaderLayer, columnHeaderDataLayer.getDataProvider(), configRegistry);

IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyLayerStack.getBodyDataProvider());
DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayerStack, bodyLayerStack.getSelectionLayer());

IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider,
DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, filterRowHeaderLayer);

GridLayer gridLayer = new GridLayer(bodyLayerStack, filterRowHeaderLayer, rowHeaderLayer, cornerLayer);

NatTable natTable = new NatTable(gridPanel, gridLayer, false);

natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new FilterRowConfiguration());
natTable.addConfiguration(new SingleClickSortConfiguration());
natTable.addConfiguration(new EditableCellsConfiguration(bodyLayerStack.bodyDataProvider));

AggregateConfigLabelAccumulator labelAccumulator = new AggregateConfigLabelAccumulator();
labelAccumulator.add(new ColumnLabelAccumulator());
labelAccumulator.add(new IConfigLabelAccumulator() {
    public void accumulateConfigLabels( LabelStack configLabels, int columnPosition, int rowPosition) {
		Object rowObject = ((ListDataProvider) bodyLayerStack.bodyDataProvider).getRowObject(rowPosition);
		int indexOfCorrespondingAttribute = DataDictionaryGridProvider.this.attributes.indexOf(rowObject);
		DataDictionaryGridModelPOJO correspondingAttribute = (DataDictionaryGridModelPOJO) DataDictionaryGridProvider.this.attributes.get(indexOfCorrespondingAttribute);
		configLabels.addLabel(dataDictionaryGridService.attributeIsDeprecated(correspondingAttribute, context) ? DEPRECATED_LABEL : UNDEPRECATED_LABEL);

final ThemeConfiguration deprecationTheme = new DefaultNatTableThemeConfiguration();
deprecationTheme.addThemeExtension(new DeprecatedStylingThemeExtension());

class DeprecatedStylingThemeExtension implements IThemeExtension {

	public void registerStyles(IConfigRegistry configRegistry) {
		IStyle deprecatedStyle = new Style();

	public void unregisterStyles(IConfigRegistry configRegistry) {

What can be the cause of this behavior? Did I configured something incorrectly?

Thank you!

Kind Regards,


  • Attachment: Capture1.PNG
    (Size: 45.33KB, Downloaded 23 times)
  • Attachment: Capture2.PNG
    (Size: 43.94KB, Downloaded 14 times)
Re: Scrolling changing style [message #1832074 is a reply to message #1832072] Tue, 08 September 2020 06:48 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 30
Registered: March 2020
The problem is that you are setting your custom label accumulator on the body layer stack. That one contains the ViewportLayer. So you face the index-position-transformation topic. You get the position based on the viewport and then get the object from the underlying data collection by index. Those two do not match.

Either you need to do the index-position-transformation in advance or set the custom label accumulator on the body DataLayer.
Re: Scrolling changing style [message #1832075 is a reply to message #1832074] Tue, 08 September 2020 07:07 Go to previous message
Alexandra Tritean is currently offline Alexandra TriteanFriend
Messages: 31
Registered: March 2020
Thank you for the fast response!

Setting the custom label accumulator on the body DataLayer is working like a charm, I'm really grateful.

Kind Regards,

Previous Topic:How to change the color of the only some part of the string in the cell
Next Topic:How to get the selected object from the tree table
Goto Forum:

Current Time: Wed Aug 04 14:11:46 GMT 2021

Powered by FUDForum. Page generated in 0.01716 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top