Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » When selecting in NatTable only Rowheaders should change the background color
When selecting in NatTable only Rowheaders should change the background color [message #1129327] Tue, 08 October 2013 14:17 Go to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
Howdy,

first I wnat to say hello to this forum.

I am very new to NatTable. I want to implement a selection, that does only change the background color of the RowHeaders of the selected rows. I got the change of the RowHeaders' color in case of selection. My question is, how to could I draw a transparent SelectionRectangle over the cell? Has anyone an idea?
Re: When selecting in NatTable only Rowheaders should change the background color [message #1129433 is a reply to message #1129327] Tue, 08 October 2013 16:19 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I think you simple need to remove the selection style that is registered in the DefaultSelectionStyleConfiguration
Re: When selecting in NatTable only Rowheaders should change the background color [message #1129973 is a reply to message #1129433] Wed, 09 October 2013 05:40 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
I don't have any DefaultSelectionStyleConfiguration. I have only my own configuration where I configure that the rowheader should be change the background color when selecting. But the rectangle on the cells is grey.

[Updated on: Wed, 09 October 2013 06:20]

Report message to a moderator

Re: When selecting in NatTable only Rowheaders should change the background color [message #1129977 is a reply to message #1129433] Wed, 09 October 2013 05:41 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
Edit: Double post

[Updated on: Wed, 09 October 2013 05:42]

Report message to a moderator

Re: When selecting in NatTable only Rowheaders should change the background color [message #1130027 is a reply to message #1129977] Wed, 09 October 2013 06:51 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
The DefaultSelectionStyleConfiguration is added by default when creating the SelectionLayer with default configuration. Or did you create the SelectionLayer with useDefaulConfiguration false?
As you are new to NatTable and selection is still working I suppose you didn't, which means the default style for selected cells is added.

So you have two ways to solve your issue:
1. unregister the value for CellConfigAttribute.CELL_STYLE for DisplayMode.SELECT (haven't tried that before)
2. register a style that is the same as the style for DisplayMode.NORMAL. But in that case it might override conditional stylings.
Re: When selecting in NatTable only Rowheaders should change the background color [message #1130144 is a reply to message #1130027] Wed, 09 October 2013 09:00 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
I created the SelectionLayer with useDefaulConfiguration=false in the hope the selection rectangle would be transparent...
I try both of your suggestions. Both leads to the result that the rectangle isn't transparent but has the background color white. I configure that the rows have the background color white and grey alternately. This is then overwritten and all selected cells have the background color white.
Re: When selecting in NatTable only Rowheaders should change the background color [message #1130188 is a reply to message #1130144] Wed, 09 October 2013 09:50 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Try to register a style for the selection anchor and the selection that does not set a value for the background color.
Re: When selecting in NatTable only Rowheaders should change the background color [message #1130212 is a reply to message #1130188] Wed, 09 October 2013 10:20 Go to previous messageGo to next message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
That was it! Too simple to think in that way...Laughing

[Updated on: Wed, 09 October 2013 10:26]

Report message to a moderator

Re: When selecting in NatTable only Rowheaders should change the background color [message #1130220 is a reply to message #1130212] Wed, 09 October 2013 10:26 Go to previous message
Leo Pap is currently offline Leo PapFriend
Messages: 25
Registered: October 2013
Junior Member
Thank you very much for the help Smile
Previous Topic:8.7 millions LinkedList$Node after 1 night
Next Topic:How to listen for RowReorderEvents?
Goto Forum:
  


Current Time: Tue Apr 16 09:25:23 GMT 2024

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

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

Back to the top