Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Color of the text in the cell changes while scrolling the table(Cell text color)
Color of the text in the cell changes while scrolling the table [message #1732062] Thu, 12 May 2016 11:04 Go to next message
Shashi D M is currently offline Shashi D MFriend
Messages: 27
Registered: August 2011
Junior Member
Hello All,

I have an use case where I need to populate the data in the nat table with red color on some condition.
And the data is displaying with the color in the table but when I scroll it horizontally or vertically the color of the text in the cell disappears.

I want to keep the color of the text same even though when user scroll it.

so please suggest me how to fix it.

I am adding the color to the label in the data layer like below

DataLayer dataLayer = new DataLayer(bodyDataProvider){
@Override
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) {
LabelStack configLabels = super.getConfigLabelsByPosition(columnPosition, rowPosition);

if (someCondition(columnPosition, rowPosition)) {
configLabels.addLabel(style1);
}
return configLabels;
}
};

ColumnOverrideLabelAccumulator columnLabelAccumulater = new ColumnOverrideLabelAccumulator(columnHeaderDataLayer)
dataLayer.setConfigLabelAccumulator(columnLabelAccumulater);

gridLayer.getBodyLayer().setConfigLabelAccumulator(columnLabelAccumulater);
Re: Color of the text in the cell changes while scrolling the table [message #1732066 is a reply to message #1732062] Thu, 12 May 2016 11:35 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2624
Registered: July 2012
Senior Member
I hope you are showing three different ways that you tried to do it and not that you use all three possibilities. Otherwise I'm speechless.

Typically if some condition does not apply anymore on scrolling there is something wrong in the position-index transformation on your side, e.g. you register the configlabelaccumulator on a layer that transforms and rely on the position rather than to the index.

You could try to set a breakpoint in your accumulator and see why your condition fails.

Please check the getting started tutorial and our documentation on how to use the label mechanism:

http://www.vogella.com/tutorials/NatTable/article.html#architecture_labels
https://www.eclipse.org/nattable/documentation.php?page=styling
Previous Topic:240 dpi not supported?
Next Topic:Save with F10
Goto Forum:
  


Current Time: Sat Nov 17 03:22:20 GMT 2018

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

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

Back to the top