Tuesday, March 1, 2016

Using events but keeping styles out of UiBinder??

Hi, I have imported a full template. I added the HTMLs as UiBinder and referenced the js and css from the main HTML page. So far it works great.

I am trying to keep the styles outside of UiBinder as most as I can to avoid a hardcoded maintenance. However, I need to handle some events on some components, for example buttons.

PROBLEM: The fact of handling events has the side effect to force me to import the styles in UiBinder when I think they should be separated roles.

My button as it comes from the template is:

                                   <button type="button" class="btn btn-default get">

In order to use the events, I need to create some kind of component, e.g.:

                                   <g:Button text="Submit" ui:field="submit" addStyleNames="{style.btn} {style.btn-default} {style.get}" />

However, this will make me add the styles, as shown bolded above, and therefore use some of the mechanisms available in UiBinder to import them.

I tried a kind of workaround embedding my button in a dummy div defined as DiVElement in my View class but them I wont have a component anymore but a JavascriptObject in the View.

                                    <div ui:field="getItNow"><button type="button" class="btn btn-default get">Get it now</button></div>

I would expect an attribute in the components to allow style definitions being ignored by UiBinder and loaded somewhere else, but it does exist as far as I know.

So, is there any way to work with the events of a component without having to import the styles in UiBinder??

Thanks

--
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