You need to make of copy of the 'this' reference, and refer to the copy in your method.
Thomas Broyer explained this to me (very kindly and patiently!) when I got hung up on this same detail: http://groups.google.com/group/google-web-toolkit/browse_thread/thread/b367a7725669ea62/e67ecf6853fed904 You should also wrap your function in $entry(), as explained here: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html#calling On Jun 1, 11:27 am, malibubu <[email protected]> wrote: > Sorry, I forgot to say, that I'm calling the Java Methode from an > inner JavaScript function: > > public native void addNode() { > var node = new $wnd.Node(); > alert("Pre JSNI"); > node.onDragend = function() { > this.setProperty("oldY", this.getY()); > > [email protected]::sendMoveWFNode(Ljav > a/ > lang/String;Ljava/lang/Integer;Ljava/lang/Integer) > (this.getProperty("uId"), @java.lang.Integer::new(I)(this.getX()), > @java.lang.Integer::new(I)(this.getY())); > } > alert("Post JSNI"); > > } > > On 1 Jun., 09:13, Olivier Monaco <[email protected]> wrote: > > > > > And autoboxing does not works in JSNI. > > > [email protected]::sendNode(Ljava/lang/String;Ljava/lang/ > > Integer)("TEST",@java.lang.Integer::new(I)(100)); > > > Or change your sendNode method to take an int. > > > Olivier > > > On 1 juin, 04:25, Jim Douglas <[email protected]> wrote: > > > > You should start by carefully reading the JSNI documentation: > > > >http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI...... > > > > A simple JSNI method looks like this (note the specially formatted > > > braces, which Java sees as a comment block, and therefore ignores): > > > > public static native void alert(String msg) /*-{ > > > $wnd.alert(msg); > > > > }-*/; > > > > On May 31, 3:25 pm, malibubu <[email protected]> wrote: > > > > > Sorry, this was a typo. > > > > > I also tried the signature > > > > > [email protected]::sendNode(Ljava/lang/String;I)("TEST",100); > > > > > with methode sendNode(String id, int x) > > > > > Same problem :( > > > > > On 31 Mai, 23:48, kozura <[email protected]> wrote: > > > > > > Maybe try with int x and use I instead of the Integer class. Also > > > > > even as is, your Integer method signature isn't quite right: land- > > > > > > >lang. > > > > > > On May 31, 3:15 pm, malibubu <[email protected]> wrote: > > > > > > > Hi, > > > > > > > I've the following class: > > > > > > > package de.test; > > > > > > public class Designer { > > > > > > > public native void addNode() { > > > > > > alert("Pre JSNI"); > > > > > > [email protected]::sendNode(Ljava/lang/String;Ljava/land/ > > > > > > Integer)("TEST",100); > > > > > > alert("Post JSNI"); > > > > > > > } > > > > > > > void sendNode(String id, Integer x) { > > > > > > GWT.log("It Works!"); > > > > > > > } > > > > > > } > > > > > > > If addNode() is called, the first Alert is shown. Then, the > > > > > > following > > > > > > JS-Error occurs (IE8): > > > > > > > Details zum Fehler auf der Webseite > > > > > > Benutzer-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; > > > > > > Trident/4.0) > > > > > > Zeitstempel: Mon, 31 May 2010 21:15:12 UTC > > > > > > Meldung: Das Objekt unterstützt diese Eigenschaft oder Methode > > > > > > nicht. > > > > > > Zeile: 11460 > > > > > > Zeichen: 7 > > > > > > Code: 0 > > > > > > URI:http://localhost:8080/test/test/DDB7CB660FDE7BAFEE5000321CF27CD1.cach... > > > > > > > Any ideas what I'm doing wrong? > > > > > > > Thank you!- Zitierten Text ausblenden - > > > > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden - > > > - Zitierten Text anzeigen - -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
