I'm trying to port a GWT 2.4 AbstractCell that uses SafeHtmlTemplates to a
GWT 2.5 AbstractCell that uses UiRenderer. My problem is that when I set
the CSS style directly on a div element, GWT logs the "CSS attribute
context" warning in my logs. Using a String, the Cell works fine albeit
with the warning, but my attempts to pass a SafeStyles have failed.
In my GWT 2.4 AbstractCell I had a template that used SafeStyles:
@SafeHtmlTemplates.Template("<div style=\"{0}\">{1}</div>")
SafeHtml cell(SafeStyles styles, SafeHtml value);
When I try passing a SafeStyles, I get the following error:
17:18:33.582 [ERROR] [my.widgets] java.lang.String required, but {styles}
returns com.google.gwt.safecss.shared.SafeStyles: <div
style='{styles}'> (:28)
When I use a String, everything works correctly, however I get the expected
"CSS attribute context" warning.
17:16:51.108 [WARN] [my.widgets] Template with variable in CSS attribute
context: The template code generator cannot guarantee HTML-safety of the
template -- please inspect manually or use SafeStyles to specify arguments
in a CSS attribute context
Incidentally, I had a similar issue passing an image URL. The logs warned
me to use SafeUri, which I did and it worked, so it appears that img
recognizes a SafeUri but div won't recognize a SafeStyles.
<div style="{styles}">
<img alt="{name}" src="{image}" />
</div>
Enrique
--
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 [email protected].
To post to this group, send email to [email protected].
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.