final MapWidget map = new MapWidget("mapOsm", "gwt-samples");
final Toolbar toolbar = new Toolbar(map);
toolbar.setButtonSize(Toolbar.BUTTON_SIZE_BIG);
final GeocoderWidget geocoderWidget = new GeocoderWidget(map, "description", "Geocoder");
toolbar.addMember(geocoderWidget);
SelectItem geocoderSource = new SelectItem("geocoderSource", "");
geocoderSource.setDefaultToFirstOption(true);
geocoderSource.setOptionDataSource(getGeocoderSelectDataSource());
geocoderSource.setDisplayField(FIELD_LABEL);
geocoderSource.setValueField(FIELD_REGEX);
geocoderSource.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
geocoderWidget.setServicePattern((String) event.getValue());
}
});
DynamicForm geocoderSourceForm = new DynamicForm();
geocoderSourceForm.setFields(geocoderSource);
toolbar.addMember(geocoderSourceForm);