Thursday, May 30, 2013

Re: Sharing styles between uibinders declarations



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

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 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment