How to configure the Selection Style to not override the text foreground color of a selected cell [message #1799155] |
Fri, 30 November 2018 10:17  |
Eclipse User |
|
|
|
Like shown in example _423_ThemeStylingExample in the case of using the ModernNatTableThemeConfiguration during selection the cell foreground color is changed to white. I my use case I want to leave the foreground color unchanged or at least try to mix the colors.
Unfortunately I didn't manage to configure NatTable in the wanted way via using a modified DefaultSelectionStyleConfiguration and/or via a theme modification. Any comments you have would be appreciated.
|
|
|
|
Re: How to configure the Selection Style to not override the text foreground color of a selected cel [message #1799295 is a reply to message #1799181] |
Tue, 04 December 2018 05:49   |
Eclipse User |
|
|
|
Thank you for pointing to a typical problem. My first mistake was that I forgot to configure the cell foreground color for the DisplayMode.SELECT mode:
Style style = new Style();
style.setAttributeValue(
CellStyleAttributes.FOREGROUND_COLOR,
MYCOLOR);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE,
style,
DisplayMode.NORMAL,
MYLABEL);
configRegistry.registerConfigAttribute(
CellConfigAttributes.CELL_STYLE,
style,
DisplayMode.SELECT,
MYLABEL);
Actually the selection anchor overrides the cell foreground color and uses always a white color (instead of the configured MYCOLOR color).
I tried to set a painter in the theme but I didn't succeed. Here's the snippet of what I have tried out:
this.selectionAnchorCellPainter =
new BackgroundPainter(
new PaddingDecorator(
new TextPainter(false, false),
1,
5,
0,
5,
false));
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04063 seconds