Hi,
if I understand the js fragment you posted at the beginning of this thread
var draw = SVG('drawing').size(300, 300)
if I understand the js fragment you posted at the beginning of this thread
var draw = SVG('drawing').size(300, 300)
means create an object SVG using as a parent element the element with the id 'drawing'
(cause 'drawing' is a string, you can pass an element instead, i checked the code) so the error seems to indicate
that in your html there is not an element with id 'drawing'.
that in your html there is not an element with id 'drawing'.
Hope it helps.
Alberto.
On Thu, Feb 27, 2014 at 6:22 AM, Magnus <alpineblaster@gmail.com> wrote:
Hi,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:34277com.google.gwt.core.client.JavaScriptException: (TypeError) @wgp.client.lib.GraphicsPanel::test1()([]): Cannot read property 'nodeName' of nullI 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? :-)MagnusApplication.java:public class Application implements EntryPoint{public void onModuleLoad(){SampleLoader l = new SampleLoader();l.injectScript();final DrawBox dbx = new DrawBox ();dbx.setText ("Dialog Box");dbx.show ();}}SampleLoader.java:public class SampleLoader{public void injectScript(){String raw = SampleAssetsBundle.instance.myScript().getText();/*ScriptElement e = Document.get().createScriptElement();e.setText(raw);Document.get().getBody().appendChild(e);*/ScriptInjector.fromString(raw).inject();}}SampleAssetBundle.java:public interface SampleAssetsBundle extends ClientBundleWithLookup {public static final SampleAssetsBundle instance =GWT.create(SampleAssetsBundle .class);@Source("svg.min.js")public TextResource myScript();}DrawBox.java: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 ();}}GraphicsPanel.javapublic class GraphicsPanel extends ComplexPanel{public GraphicsPanel(){Element e = test();setElement(e);
}private static native Element test ()
/*-{var draw = SVG('drawing')var text = draw.text('SVG.JS').move(300, 0)
text.font({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 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.
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.
No comments:
Post a Comment