Friday, August 12, 2011

Image from resource in SafeHtmlTemplate

I have an image from a ClientBundle resource:
final String myImageUrl = new Image(Resources.sSingleton.GetMyImage()).getUrl();

I also have a SafeHtmlTemplates interface:
public interface MyTemplates extends SafeHtmlTemplates {
@Template("<img src='{1}'/>")
SafeHtml GenerateCellHtml(String imageUrl);
}

When I call MyTemplates.GenerateCellHtml an exception is thrown because the URL output by Image.getUrl(), when the image comes from a resource, does not have one of the supported protocols (http, https, ftp, etc.).

Is it possible to use SafeHtmlTemplates with an Image sourced from a ClientBundle?  Am I stuck manually building the HTML string in the middle of my Java code using SafeHTMLBuilder?

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