You can use <ui:safehtml from='{...}'/> in your uiRenderer template.
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"> <ui:with field='name' type='java.lang.String' /> <ui:with field='itemsHtml' type='com.google.gwt.safehtml.shared.SafeHtml'/> <div id="main"> <h2><ui:text from='{name}' /></h2> <div><ui:safehtml from='{itemsHtml}'/></div> </div> </ui:UiBinder> public void render(Context context, EntityProxy e, SafeHtmlBuilder sb) { SafeHtmlBuilder itemsShb = new SafeHtmlBuilder(); for (Item item : e.getItems()) { itemsShb.appendHtmlConstant("<span>").appendEscaped(item.getName()).appendHtmlConstant("</span>"); } SafeHtml itemsHtml = itemsShb.toSafeHtml(); renderer.render(sb, e.getName(), itemsHtml); } Alexandre
2012/7/18 Piotr Janik <piotrjanik@nautilia.pl>
Hi there,I know that gwt templates don't support loops.However, I'd like to have a loop in a render() method.Let's say I have this simple UiRenderer template:<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"><ui:with field='name' type='java.lang.String' /><div id="main"><h2><ui:text from='{name}' /></h2><div id="HERE"></div></div></ui:UiBinder>What I need to do is put some new code into div#HERE from render method. Something like:public void render(Context context, EntityProxy e, SafeHtmlBuilder sb) {renderer.render(sb, e.getName());for(Item item : e.getItems()) {String s = "<span>"+item.getName()+"</span>";//How to put every s from this loop into div#HERE ?}}Obviously, this can be done in traditional way without templates. I'm just wondering if it is possible with new UiRenderer.
Thanks,Peter--
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/-/fYwMtC7YrCQJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment