At first glance it seems like: "PreviewPane::imageSelected(Ljava/lang/String;Ljava/lang/String;))"
takes two arguments, in this case two Strings. The JSNI error seems to indicate that you are not passing the two arguments as per the method signature. I would think that you would end up with something like this: PreviewPane::imageSelected(Ljava/lang/String;Ljava/lang/String;))(string1, string2); Best regards, Alfredo On Mon, Apr 2, 2012 at 4:26 PM, Geoffrey Wiseman <[email protected] > wrote: > I have a piece of GWT code that I wanted to invoke from outside > handwritten JavaScript. There's an example shown here under "Calling a Java > method from Handwritten JavaScript": > > https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI > > That example uses a static method; I can make that work, but my first > instinct was that i'd rather use an instance, so using the syntax shown > under JSNI invocations, I tried: > > /* package */ native void exportJavascriptMethods( PreviewPane x ) /*-{ > $wnd.imageSelected = > $entry(this > @ca.cpp.spike.gwtapplet.client.PreviewPane::imageSelected > (Ljava/lang/String;Ljava/lang/String;)); > }-*/; > > That doesn't work. Eclipse (and the GWT compiler) complain: > "JavaScript parsing: Missing ) after argument list PreviewPane.java" > > If I replace 'this' with 'x', same problem. If I take 'this' out and leave > it binding to the static method: > > /* package */ native void exportJavascriptMethods( PreviewPane x ) /*-{ > $wnd.imageSelected = > $entry(@ca.cpp.spike.gwtapplet.client.PreviewPane::imageSelected > (Ljava/lang/String;Ljava/lang/String;)); > }-*/; > > > All is well in the world. > > So -- is that just not an option, exporting an instance method like that? > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-web-toolkit/-/mC9EADg67lcJ. > 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. > -- Alfredo Quiroga-Villamil AOL/Yahoo/Gmail/MSN IM: lawwton -- 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.
