public native void expOpenInfoWindowTabsHtml(GMarker self)/*-{
self.openInfoWindowTabsHtml([new $wnd.GInfoWindowTab("test","tab")]);
}-*/;
If you try and invoke a method on a JavaScriptObject which contains an
array as a parameter you'll get a null exception. In this case, the
above method takes an array of GInfoWindowTab objects.
All the other methods without array parameters work without any
problem, for example executes without problem:
public native void openInfoWindow(GMarker self, Element content)/*-{
self.openInfoWindow(content);
}-*/;
Thus, the issue appears to be stricly limited to when an array is
present in the parameters (even when the array is created in the JSNI
enviroment as in the previous example).
If the GWT could look into this issue, I'd greatly appreciate it.
Kind Regards,
Anthony L.
[ERROR] Unable to load module entry point class
com.mycompany.client.MyApplication
java.lang.NullPointerException: null
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNative(ModuleSpaceIE6.java:377)
at
com.google.gwt.dev.shell.ie.ModuleSpaceIE6.invokeNativeVoid(ModuleSpaceIE6.java:283)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:127)
at
com.mapitz.gwt.googleMaps.client.GMarkerImpl.openInfoWindowTabsHtml(GMarkerImpl.java:78)
at
com.mapitz.gwt.googleMaps.client.GMarker.openInfoWindowTabsHtml(GMarker.java:98)
at
com.mycompany.client.MyApplication.onModuleLoad(MyApplication.java:238)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:64)
at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:324)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$100(BrowserWidgetIE6.java:19)
at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6.java:45)
John Deck
I think some clarity is needed regarding moving array objects from
Javascript to GWT Java via JSNI (and vice versa). I have a feeling
there are workarounds to these issues but don't know one personally.
Any takers.... ?
Something like this:
static native JavaScriptObject createJavaScriptArray() /*-{
return [];
}-*/;
static native void setValue(JavaScriptObject array, int index, String
value) /*-{
array[index] = value;
}-*/;
static native String getValue(JavaScriptObject array, int index) /*-{
var result = array[index];
return (result == null) ? null : result;
}-*/;
static native int getLength(JavaScriptObject array) /*-{
return array.length;
}-*/;
You would need differently-typed accessor methods for all the major JS
types- String, double, boolean, JavaScriptObject, or even Object if you
needed to store Java objects in a JS array.
http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.JavaScriptNativeInterface.Marshaling.html
is a good reference.
Scott