"Undefined expected int" exception when using SVG in a custom DataGrid cell
I want to include an SVG in a cell of a datagrid table. I created a test class which shows a blue square. The square displays just fine but when I click on it an exception shows up in eclipse (see below). If I change the <svg> to be a string, a span or an img, clicking on that works without error. Could someone tell me what am i doing wrong? In the debugger the target of the click event shows as [object SVGRectElement] whereas when I flip the comments to, say, show an image instead of svg, the target is '<img src='foo.png'>.
-----
private class CustomCell extends AbstractCell<String> {
@Override
public void render(Cell.Context context, String value, SafeHtmlBuilder sb) {
if (value == null) return;
// sb.append(SafeHtmlUtils.fromTrustedString(value.toString()));
// sb.append(SafeHtmlUtils.fromTrustedString("<span>"));
// sb.appendEscaped(value);
// sb.append(SafeHtmlUtils.fromTrustedString("</span>"));
// sb.append(SafeHtmlUtils.fromTrustedString("<img src=\"foo.png\"/>"));
sb.append(SafeHtmlUtils.fromTrustedString("<svg><rect height='8px' width='8px' fill='blue'/>"));
}
}
-----
21:40:45.436 [ERROR] [... Uncaught exception escaped
com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.dom.client.DOMImpl::getTabIndex(Lcom/google/gwt/dom/client/Element;)': JS value of type undefined, expected int
at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:262)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
at com.google.gwt.dom.client.DOMImpl.getTabIndex(DOMImpl.java)
at com.google.gwt.dom.client.Element$.getTabIndex$(Element.java:474)
at com.google.gwt.user.cellview.client.CellBasedWidgetImpl.isFocusable(CellBasedWidgetImpl.java:74)
at com.google.gwt.user.cellview.client.AbstractHasData.onBrowserEvent(AbstractHasData.java:731)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1467)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1406)
at com.google.gwt.user.client.impl.DOMImplStandard.dispatchEvent(DOMImplStandard.java:256)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:576)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:284)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:324)
at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:613)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
at java.lang.Thread.run(Thread.java:780)
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home