types[0] = AutocompleteType.ESTABLISHMENT;
types[1] = AutocompleteType.GEOCODE;
AutocompleteOptions options = AutocompleteOptions.newInstance();
options.setTypes(types);
LatLng sw = LatLng.newInstance(extent.getLowerLeftX(), extent.getLowerLeftY());
LatLng ne = LatLng.newInstance(extent.getUpperRightX(), extent.getUpperRightY());
options.setBounds(LatLngBounds.newInstance(sw, ne));
final Autocomplete autoComplete = Autocomplete.newInstance(locationSearchBox.getElement(), options);
autoComplete.addPlaceChangeHandler(new PlaceChangeMapHandler() {
@Override
public void onEvent(PlaceChangeMapEvent event) {
PlaceResult result = autoComplete.getPlace();
PlaceGeometry geometry = result.getGeometry();
LatLng center = geometry.getLocation();
Store store = storeBinder.getModel();
store.setName(result.getName());
store.setAddress(result.getFormatted_Address());
store.setLatitude(center.getLatitude());
store.setLongitude(center.getLongitude());
store.setRadius(DEFAULT_RADIUS);
placeMarkerAtStoreLocation(map);
}
});