Thursday, February 18, 2016

Re: GSS for a instance of Widget

Hi Jens

The problem with the example is that 

1) you need to programmatically add(change) your style instead of use only one style in uibinder

--> i'd like to only programmatically change the variables that are used for eval in GSS and that changes
- all widgets in the dom (delete the stylesheet generated by the ensureinjected)
- OR only affect to the future widgets injected  (adding a new style sheet with new generated classnames of style interface methods)

2) you need to compile your project each time you're adding a theme ( moreover multiple gss files is difficult to maintain).
--> It would much easier to load a map of variables from server in endpoint and use them in eval of GSS and the change the variables on the fly.

In project the goal is to create a formbuilder (to create form declaration  that are sent to render engine written in gwt to render it) which permit to overrride the default variables for a instance of a widget only (without to change manually each time  the classname !)

To resume, i only need to search how to change on the fly the name of classname generated by the style methods !

What about rewriting a custom GssResourceGenerator to do that ?



Le mercredi 17 février 2016 11:13:20 UTC+1, Jens a écrit :
Normally you would add a classname to your widget and then inject a stylesheet that makes use of that additional class name.

For example if you have a widget whose root CSS class is .myWidget and you want to make one instance of that widget red then you can add the class .makeRed and inject stylesheet that looks like .myWidget.makeRed { background-color:red; }

If you need to change all widget in a container to be a little different then you would apply a css class to the container and use CSS to override the widgets inside that container, e.g. 

.myRedContainer .myWidget,
.myRedContainer .myOtherWidget { background-color:red; }

As you use GSS and ClientBundle/CssResource you can use @Import and @ImportedWithPrefix to make one CssResource accessible in a different one: http://www.gwtproject.org/javadoc/latest/com/google/gwt/resources/client/CssResource.Import.html

-- J.

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment