Some more info: I was able to get this Google Maps specific code running.
Code:
public native void updateMap(String locationAddress, JavaScriptObject llp, MainModule thisModule) /*-{
var geo = new $wnd.GClientGeocoder();
geo.getLocations(locationAddress,
function(response) // callback method to be executed when result arrives from server
{
if (!response || response.Status.code != 200)
{
alert("Unable to geocode that address");
}
else
{
var place = response.Placemark[0];
llp.lat = place.Point.coordinates[1];
llp.lon = place.Point.coordinates[0];
thisModule.@com.maharana.gwtextmaps.client.MainModule::renderMap(Lcom/google/gwt/core/client/JavaScriptObject;)(llp);
}
}
);
}-*/;
public void renderMap(JavaScriptObject jsObj)
{
double lat = Double.parseDouble(JavaScriptObjectHelper.getAttribute(jsObj, "lat"));
double lon = Double.parseDouble(JavaScriptObjectHelper.getAttribute(jsObj, "lon"));
LatLonPoint latLonPoint = new LatLonPoint(lat, lon);
mapPanel.setCenterAndZoom(latLonPoint, 12);
mapPanel.addMarker(new Marker(latLonPoint));
}
And the call to updateMap():
Code:
updateMap("mumbai", JavaScriptObjectHelper.createObject(), this);
I want to eliminate the JSNI method. Any suggestions?
-- Abhijeet Maharana.