GLatLng latLng)
{
if (status == GeocoderException.G_GEO_SUCCESS)
{
bottomMap.getInfoWindow().open(latLng,
new GInfoWindowTab(address, new Label(address, address)));
}
else
{
error("Unable to geocode (" + status + ")");
target.addComponent(feedback);
}
};
});
geocodeForm.add(button);
// Using ServerGeocoder the geocoding request
// is performed on the server using Googles HTTP interface.
// http://www.google.com/apis/maps/documentation/services.html#Geocoding_Direct
geocodeForm.add(new AjaxButton("server", geocodeForm)
{
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form)
{
try
{
String address = addressTextField.getDefaultModelObjectAsString();
GLatLng latLng = GeoCodeGMapApplication.get().getServerGeocoder().findAddress(address);
bottomMap.getInfoWindow().open(latLng,
new GInfoWindowTab(address, new Label(address, address)));
}
catch (IOException e)
{
target.appendJavaScript("Unable to geocode (" + e.getMessage() + ")");
}