Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Theme style configurations
Theme style configurations [message #1234211] Tue, 21 January 2014 13:10 Go to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2751
Registered: July 2012
Senior Member
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:
Re: Theme style configurations [message #1251455 is a reply to message #1234211] Thu, 20 February 2014 08:30 Go to previous message
Arjan Kok is currently offline Arjan KokFriend
Messages: 39
Registered: July 2009

I've create my own Theme Configuration, and it works smoothly. Also theme switching at runtime works fine - the fonts in my theme can now be set by the user via an eclipse preference.

Thanks & Regards,

Arjan Kok.
Previous Topic:grid scrollbar issue
Next Topic:resize row header width
Goto Forum:

Current Time: Thu Dec 05 16:57:47 GMT 2019

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

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

Back to the top