Thursday, May 30, 2013

Re: Sharing styles between uibinders declarations

Thanks Thomas,

I gather that it is not possible then. I will follow your advice.

Still I think it could be a nice to have feature. Do you think it is worth to put a request for that?

On Thursday, 30 May 2013 13:42:39 UTC+2, Thomas Broyer wrote:

On Thursday, May 30, 2013 1:29:46 PM UTC+2, Thomas Lefort wrote:

I am trying to do something that I believe should be possible.

I am defining in one widget a number of css rules which I would like to share with another widget. I could make those rules available using @external but I'd rather not. What I would like to do is to export those rules to my widget class (using a MyStyle) and then import those rules into my second widget using the <ui:with field="styleSearch" type="xxx.MyStyle" /> uibinder tag.

I tried teh above but I am getting a "Deferred binding result type xxx.MyStyle should not be abstract". I tried forcing it using a GWT.create, although I am pretty convinced that it is not needed. But it still fails.

If anybody can provide me some directions as to why this is not working? can it work or should I do it differently?

If you want to share a CssResource between UiBinder templates, then don't use the implicit one created by <ui:style>. Use an explicit one within an explicit ClientBundle that you'll be able to reference with <ui:with> (make sure you call ensureInjected() in your Java code though!)

If you don't mind duplicated code in the generated output, you can also just use the src="" attribute of <ui:style> to reference a shared CSS file (this works best for @defs, when nothing will actually be duplicated).

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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment