Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Setting cell background color
Setting cell background color [message #1396588] Tue, 08 July 2014 14:17 Go to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 29
Registered: April 2014
Junior Member
Hi,

I would like to customize the background color of the cells in the NatTable. The example program shows this pretty well for the default grid (code here).

In my case though, I use a custom body data provider which does not support the methods used in that code (no getBodyLayer() or selection layer).

In the example doc, I found this easy method to change cell contents :
Style cellStyle = new Style();
cellStyle.setAttributeValue(
	CellStyleAttributes.BACKGROUND_COLOR, bgColor);
cellStyle.setAttributeValue(
	CellStyleAttributes.FOREGROUND_COLOR, fgColor);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle);


But with this, I can only change the font color, right?

I would appreciate any comments, if you know any advice for me. Thanks!
Re: Setting cell background color [message #1396602 is a reply to message #1396588] Tue, 08 July 2014 14:36 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Sorry, maybe I'm too deep in the NatTable code, but I don't understand your issue.

The example code you posted sets a value for CellStyleAttributes.BACKGROUND_COLOR. Why should that only apply for the font color?
Re: Setting cell background color [message #1396646 is a reply to message #1396602] Tue, 08 July 2014 15:43 Go to previous messageGo to next message
Alexander Klatt is currently offline Alexander KlattFriend
Messages: 29
Registered: April 2014
Junior Member
I don't know why it did not work. Only the font color was changed. But on the other hand I just started with NatTable and might do smth stupid Smile. I will probably go with the sample code from the example program. This required less changes to the code than I thought.
Re: Setting cell background color [message #1396654 is a reply to message #1396646] Tue, 08 July 2014 15:56 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1434
Registered: July 2012
Senior Member
Maybe some other configuration registered that overrides your setting.
Previous Topic:Nattable navigation using up/down/left/right arrows
Next Topic:Discussion: NatTable Roadmap
Goto Forum:
  


Current Time: Sat Dec 20 16:37:15 GMT 2014

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

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