Wednesday, June 25, 2014

Re: Best way to style a web app in diffrent ways



On Wednesday, June 25, 2014 2:12:16 PM UTC+2, Dominic Warzok wrote:
Hi Guys. 

I try to writa a web app where it is possible to give diffrent styles to them.

Is the "theming" dynamic? (switchable by the user, dynamically) or static? (at deployment and/or compilation time)
 
Whart is the best way to do this. 
At the moment I'm trying to do this with CSSResource. But this don't work so good.

It can work. Obfuscated names directly come from the CssResource interface name and its methods' names, independently of the ClientBundle interface or method that creates them; but the @Source is attached to the ClientBundle method. That means you could have some code that chooses which method to call among methods that all return the same CssResource interface (if you have other resources, such as ImageResource, you'd rather select the appropriate ClientBundle).
It becomes harder if you want to be able to dynamically switch the theme without reloading the app, as you'd have to "uninstall" the current theme and "install" the new one; this should be doable using CssResource#getText() and StyleInjector, keeping track of the StyleElement (be careful within Internet Explorer though).
 
I would do it with a normal css but I have no idea how to style default GWT Styles like a CellTable ?

That would work too. To style widgets that don't have default "style names" but only depend on CssResource (like CellTable), you'd create a CellTable.Style with a custom *.css file that declares all class names as @external so they're not obfuscated and can be styled "externally", from a static CSS file.

Any hints ?

I never had to do it, so I can only tell what would work, I can't comment what's easier, or other best practices. 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment