Wednesday, February 26, 2014

Re: GWT and SVG, the 125th... :-)


ok, I used the GWT ScriptInjector, and now also the identifier "SVG" can be resolved.
This brought me one step further, but now I get another error message:

[ERROR] [wgp] - Failed to load module 'wgp' from user agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36' at localhost:34277 (TypeError) @wgp.client.lib.GraphicsPanel::test()([]): Cannot read property 'nodeName' of null

I cannot debug JS code, but by tracing ($wnd.alert) I can verify that it happens at the call to SVG("drawing").

The complete code is shown below. What next? :-)


public class Application implements EntryPoint
 public void onModuleLoad()
  SampleLoader l = new SampleLoader();
  final DrawBox dbx = new DrawBox ();
  dbx.setText ("Dialog Box"); ();

public class SampleLoader
 public void injectScript()
  String raw = SampleAssetsBundle.instance.myScript().getText();
  ScriptElement e = Document.get().createScriptElement();

public interface SampleAssetsBundle extends ClientBundleWithLookup {

 public static final SampleAssetsBundle instance =
GWT.create(SampleAssetsBundle .class);

 public TextResource myScript();

public class DrawBox extends DialogBox
 //private FlowPanel pnl = new FlowPanel ();
 private GraphicsPanel pnl = new GraphicsPanel ();
 public DrawBox ()
  super ();
  setText ("Dialog Box");
  pnl.setSize ("640px","480px");
  //add (pnl);
  setWidget (pnl);
  show ();
  center ();

public class GraphicsPanel extends ComplexPanel
 public GraphicsPanel()
  Element e = test();

 private static native Element test ()
 var draw = SVG('drawing')
 var text = draw.text('SVG.JS').move(300, 0)

          family: 'Source Sans Pro'
        , size: 180
        , anchor: 'middle'
        , leading: 1

 return (draw);  


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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment