I don't think that GWT is currently well suited for doing this dynamically.
It is however well suited to do this statically through a refresh of the 
page.
I do it statically by using @eval in my css files that reference preference 
classes. Preference classes are selected through a theme and the theme is 
loaded through deferred binding in the gwt.xml file.
See also: 
http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#Runtime_substitution
This mechanism works well.

However, doing it dynamically might be tricky as CssResource contains a 
method ensureInjected() method to inject the css in the DOM, but there 
doesn't exists a method to remove it (as far as I know).

The generated style names are unique per CssResource sub class type (see 
above link). So calling ensureInjected() on the same CssResource  class 
with another Css file  from another ClientBundle will override the previous 
injected names (I noticed this behavior due to some bugs in a app I was 
building). 
You could do it in this way: that is a ClientBundle per theme that contains 
the smae CssResource with another css file, but it would be more elegant to 
be able to remove the first injected css. I can do this probably, but have 
to digg in the gwt code and write some Js code called from GWT.

- Ed

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Z-Rf-ZgScKYJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to