Using TextResources in UiBinder

127 views
Skip to first unread message

Isaac Truett

unread,
Jul 14, 2011, 7:52:26 PM7/14/11
to Google Web Toolkit
I want to include a block of text from a ClientBundle's TextResource in a UiBinder template.

Logically, I want this:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
<ui:with field="res" type="foo.resources.ClientResources"/>
<div>
{res.myTextResource.getText}
</div>
</ui:UiBinder>

But this just prints the literal "{res.myTextResource.getText}". And yet this:

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
<ui:with field="res" type="foo.resources.ClientResources"/>
<div id="{res.myTextResource.getText}">
</div>
</ui:UiBinder>

... yields the content of myTextResource in the ID of the div.

So, is there some voodoo hidden somewhere that allows me to use {res.foo} notation outside of an attribute? All of the examples shown in "Declarative Layout with UiBinder" are for setting attributes. If this isn't currently possible, is there a reason not to allow what I'm trying to do? Or is there a better approach that is equally or more concise?

Thanks,
Isaac

Thomas Broyer

unread,
Jul 15, 2011, 4:40:38 AM7/15/11
to google-we...@googlegroups.com, Google Web Toolkit
<ui:text from="{res.myTextResource.getText" /> ?

Isaac Truett

unread,
Jul 15, 2011, 8:33:33 AM7/15/11
to google-we...@googlegroups.com
Interesting. Thanks, Thomas. That does appear to work, although I need to find a way to keep it from escaping HTML. Is ui:text documented somewhere?



On Fri, Jul 15, 2011 at 4:40 AM, Thomas Broyer <t.br...@gmail.com> wrote:
<ui:text from="{res.myTextResource.getText" /> ?

--
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/-/-PZ3Xd1zRNoJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Isaac Truett

unread,
Jul 15, 2011, 10:06:58 AM7/15/11
to Google Web Toolkit, David Chandler
Looks like ui:text was added last year. There's also a ui:safehtml a few months ago, but that doesn't appear to have made it into a release yet (?).

@David Is there documentation for UiBinder beyond Declarative Layout with UiBinder that I'm just not finding? I still can't find mention of ui:text outside of Group discussion which, unfortunately, I haven't been following as closely as I used to. It would be helpful to have a complete listing of supported elements.
Reply all
Reply to author
Forward
0 new messages