Saturday, August 13, 2011

Re: Image from resource in SafeHtmlTemplate

I figured it out.  A bit more unwieldy than I would like but it gets the job done.  In short, I create a DOM element out of the resource, add an id to it, then assure my SafeHtmlTemplates that it is already SafeHtml so it doesn't try to parse it.
final ImagePrototypeElement imageElement = AbstractImagePrototype.create(Resources.sSingleton.getMyImage()).createElement();
imageElement.setId("delete_button");
final String imageUnsafeHtml = imageElement.getString();
final SafeHtml imageSafeHtml = new OnlyToBeUsedInGeneratedCodeStringBlessedAsSafeHtml(imageUnsafeHtml);
GWT.create(MyTemplates.class).generateCellHtml(imageSafeHtml);

--
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/-/hK3zh7CSMwkJ.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate