|Theme style configurations [message #1234211]
||Tue, 21 January 2014 08:10
| Dirk Fauth
Registered: July 2012
As part of finishing NatTable 1.1 we added theme style configurations to NatTable Core. Technically they are of type AbstractRegistryConfiguration and can be registered to a NatTable like any other configuration.|
I created the DefaultNatTableThemeConfiguration which contains AFAIK all possible default style attributes that can be set. So using this as a starting point should give you as much help as possible to be able to create your custom theme. You could simply extend and override the values or override the methods to specify the styles.
To support theme switching at runtime, I introduced the ThemeManager. It is tight connected to the NatTable and the IConfigRegistry of that NatTable instance, so it is able to perform configuration modifications. By calling NatTable.setTheme(ThemeConfiguration) you can switch the theme at runtime.
In the repository you will find a new example _423_ThemeStylingExample, that shows some simple themes and the ability to switch between them. Note that it is not yet contained in the NatTable examples app, but it is planned to add it to the new examples version in the future.
Note that there are some attributes that can not be set via ThemeConfiguration. Most important might be row height and column width, which are no style informations in the current architecture. Compared to CSS this might be confusing.
Also the ILayerPainter can not be changed via themes. Usually you don't need this, but there are use cases where you might want to change the grid line color or even avoid rendering grid lines. This need to be done in another way, as they are tight connected to the ILayer in the current architecture.
It would be great if someone else could step up to test this so we can be sure this feature is ready to be released.
Please report any issues in this ticket: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382863
Powered by FUDForum
. Page generated in 0.01611 seconds