Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Application-defined themes(How can I modify the theme.css file (on a property level) at runtime?)
Application-defined themes [message #1791633] Tue, 03 July 2018 08:16 Go to next message
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
Hi,
our application is three-tier client server, i.e. on top of our backend-server we have a client implemented in RAP. The RAP client isn't our only client platform (e.g. we also have a client implemented as a native Windows application). Thus, we would like to determine the look of the application (which should look the same on all client platforms) at a single location in the backend server.
With RAP, only certain aspects like the foreground/background color of input fields/composites can be changed at runtime. Not so, e.g., the borders of an input field, which are defined in the theme.css file.
Where would I need to start, if I want to modify certain CSS properties from the theme.css file dynamically at runtime.
I would be prepared to make major modifications to the RAP/RWT framework if required. Preferably on the Java side.

Thanks for your thoughts on this.

Gunnar
Re: Application-defined themes [message #1791672 is a reply to message #1791633] Tue, 03 July 2018 21:44 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
Why do you need to dynamically change the theming?
If you want it to look like you native Windows app, then change the theme to suit.

You can have a different theme for each entrypoint if you want.

There doesn't appear to be any change detection in the RAP theme code, so you'd need to implement that or have some other way of triggering a complete re-render of your entire widget tree when ever something in the theme changes.
Re: Application-defined themes [message #1791726 is a reply to message #1791672] Wed, 04 July 2018 13:34 Go to previous messageGo to next message
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
Hi,
thanks for your response.
You raise a good question, which I will try to answer:

I know about entrypoints and different theme files for each one of them and we are already using this to support the different products my company offers to different target audiences (e.g. corporates and banks). Each of those products has a slightly different look & feel and we have used the theme.css files with different entry points to cater for all products with a single client.

So, we have an exact idea how our application should look like by default.
But what, if a customer wants to have a special look because of some corporate identity guidelines. For instance, a company wants to use their own fonts in the user interface (input fields and such). For those kinds of customization it would be nice to define them in our backend application server once (valid for a customer on all client platforms) and not to have to manage a larger number of theme.css files (one for each customer). A larger number of theme.css files would also mean, that we have to package a slightly different client WAR for each customer, which we don't want to do.
Some of the customers want to do those kinds of adjustments on their own. Thus, it should be easier than editing a theme.css, where, if you make a mistake, the whole application may not work. On top of that, not all of our customer's IT departments are fit to integrate a modified theme.css file into the standard package which we deliver.

I am thinking about some kind of manipulation to the ThemeManager which allows to

    modify (some) properties from the css file (after it has been read). Usually this would only have be done for the first application session established on a newly deployed application or after a restart of the web application container. The problem is, that the client application connects to the backend application server only AFTER the theme has been fully initialized.

or

    modify the theme.css file before it is loaded by the ThemeManager. The data for the modification should come from some external resource.


or

    load the theme.css from an external resource entirely. The fact that it currently is an essential part of the WAR file we deploy is part of the problem. If it could be read from, e.g. , a web service, located with the backend server, which generates a theme.css from easier to maintain style data, then that would be a solution.


Any further ideas?

Kind regards,
Gunnar
Re: Application-defined themes [message #1791845 is a reply to message #1791726] Fri, 06 July 2018 07:58 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
you can change themeing properties at runtime with custom variant. org.eclipse.rap.rwt.RWT.CUSTOM_VARIANT is supported on most widgets. Define the needed themeing for every custom variant and add/remove it at runtime:

button.setData( RWT.CUSTOM_VARIANT, "mybutton" );

HTH,
Ivan
Previous Topic:File upload issue with RAP 3.5.0 (Photon)
Next Topic:Removing messages from MessageManager may throw Exception
Goto Forum:
  


Current Time: Fri Apr 19 23:49:40 GMT 2024

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

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

Back to the top