@Override public GetLocationForStringRequest getEmptyCommandRequest() { return new GetLocationForStringRequest(); }
@Override public void findLocation(final String location) { showAlternativesView(false); GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND); GetLocationForStringRequest request = new GetLocationForStringRequest(); request.setCrs(mapPresenter.getViewPort().getCrs()); request.setLocation(location); request.setServicePattern(servicePattern); command.setCommandRequest(request); GeomajasServerExtension.getInstance().getCommandService().execute(command, new AbstractCommandCallback<GetLocationForStringResponse>() { public void execute(GetLocationForStringResponse response) { goToLocation(response, location); } }); }
@Override public void execute(GetLocationForStringRequest request, GetLocationForStringResponse response) throws Exception { String location = request.getLocation(); if (null == location) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "location"); String crsString = request.getCrs(); if (null == crsString) { throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs"); if (null != request.getLocale()) { locale = new Locale(request.getLocale()); int maxAlternatives = request.getMaxAlternatives(); Pattern namePattern = getShouldUsePattern(request.getServicePattern()); for (GeocoderService geocoderService : geocoderInfo.getGeocoderServices()) { if (shouldUse(namePattern, geocoderService.getName())) {
public void goToLocation(final String location) { GwtCommand command = new GwtCommand(GetLocationForStringRequest.COMMAND); GetLocationForStringRequest request = new GetLocationForStringRequest(); request.setCrs(map.getMapModel().getCrs()); request.setLocation(location); request.setServicePattern(servicePattern); if (GWT.isClient()) { // causes NPE when run as junit test String locale = LocaleInfo.getCurrentLocale().getLocaleName(); if (!"default".equals(locale)) { request.setLocale(locale); } } command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<GetLocationForStringResponse>() { public void execute(GetLocationForStringResponse response) { goToLocation(response, location); } }); }