本文整理汇总了Java中org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative类的典型用法代码示例。如果您正苦于以下问题:Java GetLocationForStringAlternative类的具体用法?Java GetLocationForStringAlternative怎么用?Java GetLocationForStringAlternative使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GetLocationForStringAlternative类属于org.geomajas.plugin.geocoder.command.dto包,在下文中一共展示了GetLocationForStringAlternative类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: goToLocation
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
public void goToLocation(final CommandResponse commandResponse, final String location) {
if (commandResponse instanceof GetLocationForStringResponse) {
GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
if (response.isLocationFound()) {
removeAltWindow();
handlerManager.fireEvent(new SelectLocationEvent(map, response));
} else {
List<GetLocationForStringAlternative> alternatives = response.getAlternatives();
if (null != alternatives && alternatives.size() > 0) {
handlerManager.fireEvent(new SelectAlternativeEvent(map, alternatives));
} else {
SC.say(messages.locationNotFound(location));
}
}
}
}
示例2: GeocoderAlternativesGrid
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
/**
* Create a grid with the alternatives.
*
* @param widget geocoder widget
* @param alternatives list of alternatives
*/
@Api
public GeocoderAlternativesGrid(final GeocoderWidget widget, List<GetLocationForStringAlternative> alternatives) {
super();
this.setWidth(300);
this.setHeight(200);
this.setCanEdit(false);
this.setPadding(5);
ListGridField locationField = new ListGridField(LOCATION_FIELD);
locationField.setCanEdit(false);
locationField.setCanSort(false);
locationField.setCanGroupBy(false);
this.setFields(locationField);
this.addRecordClickHandler(new GeocoderRecordClickHandler(widget));
update(alternatives);
}
示例3: setAlternatives
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
@Override
public void setAlternatives(List<GetLocationForStringAlternative> alternatives) {
alternativesPanel.clear();
for (GetLocationForStringAlternative alternative : alternatives) {
final String altText = alternative.getCanonicalLocation();
Label altLabel = new Label(altText);
altLabel.setStyleName(resource.css().geocoderGadgetAltLabel());
altLabel.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
alternativesPresenter.findLocation(altText);
}
});
alternativesPanel.add(altLabel);
}
}
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:17,代码来源:GeocoderWidgetAlternativesViewImpl.java
示例4: alternativesTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
@Test
public void alternativesTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:4326");
request.setLocation("London, GB");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
Assert.assertFalse(response.isLocationFound());
Assert.assertNotNull(response.getAlternatives());
Assert.assertTrue(response.getAlternatives().size() > 0);
GetLocationForStringAlternative alt = response.getAlternatives().get(0);
Assert.assertEquals(-0.12574, alt.getCenter().getX(), DELTA);
Assert.assertEquals(51.50853, alt.getCenter().getY(), DELTA);
Assert.assertEquals("GeoNames", alt.getGeocoderName());
}
示例5: alternativesCrsTest
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
@Test
public void alternativesCrsTest() throws Exception {
GetLocationForStringRequest request = new GetLocationForStringRequest();
request.setCrs("EPSG:900913");
request.setLocation("London, GB");
CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
"en");
Assert.assertNotNull(commandResponse);
Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
GetLocationForStringResponse response = (GetLocationForStringResponse) commandResponse;
Assert.assertFalse(response.isLocationFound());
Assert.assertNotNull(response.getAlternatives());
Assert.assertTrue(response.getAlternatives().size() > 0);
GetLocationForStringAlternative alt = response.getAlternatives().get(0);
Assert.assertEquals(-13997.312772346217, alt.getCenter().getX(), DELTA);
Assert.assertEquals(6711744.580491004, alt.getCenter().getY(), DELTA);
Assert.assertEquals("GeoNames", alt.getGeocoderName());
}
示例6: update
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
/**
* Update alternatives grid with given alternatives.
*
* @param alternatives alternatives
*/
@Api
public void update(List<GetLocationForStringAlternative> alternatives) {
this.setData(toRecords(alternatives));
this.scrollTo(0, 0);
}
示例7: toRecords
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
private ListGridRecord[] toRecords(List<GetLocationForStringAlternative> alternatives) {
ListGridRecord[] records = new ListGridRecord[alternatives.size()];
for (int i = 0; i < records.length; i++) {
GetLocationForStringAlternative alt = alternatives.get(i);
ListGridRecord record = new ListGridRecord();
record.setAttribute(LOCATION_FIELD, alt.getCanonicalLocation());
record.setAttribute(LOCATION_OBJECT, alt);
records[i] = record;
}
return records;
}
示例8: SelectLocationEvent
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
public SelectLocationEvent(MapWidget mapWidget, GetLocationForStringAlternative alternative) {
super();
this.mapWidget = mapWidget;
canonicalLocation = alternative.getCanonicalLocation();
center = alternative.getCenter();
bbox = alternative.getBbox();
geocoderName = alternative.getGeocoderName();
userData = alternative.getUserData();
}
示例9: disableWidgets
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
@Before
public void disableWidgets() {
GWTMockUtilities.disarm();
matchedResponse = new GetLocationForStringResponse();
matchedResponse.setLocationFound(true);
alternativesResponse = new GetLocationForStringResponse();
List<GetLocationForStringAlternative> list = new ArrayList<GetLocationForStringAlternative>();
list.add(new GetLocationForStringAlternative());
list.add(new GetLocationForStringAlternative());
alternativesResponse.setAlternatives(list);
}
示例10: SelectLocationEvent
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
public SelectLocationEvent(MapPresenter mapPresenter, GetLocationForStringAlternative alternative) {
super();
this.mapPresenter = mapPresenter;
canonicalLocation = alternative.getCanonicalLocation();
center = alternative.getCenter();
bbox = alternative.getBbox();
geocoderName = alternative.getGeocoderName();
userData = alternative.getUserData();
}
示例11: goToLocation
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
@Override
public void goToLocation(final GetLocationForStringResponse response, final String location) {
if (response.isLocationFound()) {
fireGeocoderEvent(new SelectLocationEvent(mapPresenter, response));
} else {
List<GetLocationForStringAlternative> alternatives = response.getAlternatives();
if (null != alternatives && alternatives.size() > 0) {
fireGeocoderEvent(new SelectAlternativeEvent(mapPresenter, alternatives));
} else {
fireGeocoderEvent(new LocationNotFoundEvent(location));
}
}
}
示例12: SelectAlternativeEvent
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
/**
* Constructor which passes the map and alternatives.
*
* @param mapWidget map
* @param alternatives alternatives
*/
public SelectAlternativeEvent(MapWidget mapWidget, List<GetLocationForStringAlternative> alternatives) {
this.mapWidget = mapWidget;
this.alternatives = alternatives;
}
示例13: getAlternatives
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
/**
* Get alternatives.
*
* @return alternatives
* @since 1.0.0
*/
@Api
public List<GetLocationForStringAlternative> getAlternatives() {
return alternatives;
}
示例14: SelectAlternativeEvent
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
/**
* Constructor which passes the map and alternatives.
*
* @param mapPresenter map presenter
* @param alternatives alternatives
*/
public SelectAlternativeEvent(MapPresenter mapPresenter, List<GetLocationForStringAlternative> alternatives) {
this.mapPresenter = mapPresenter;
this.alternatives = alternatives;
}
示例15: getAlternatives
import org.geomajas.plugin.geocoder.command.dto.GetLocationForStringAlternative; //导入依赖的package包/类
/**
* Get alternatives.
*
* @return alternatives
*/
@Api
public List<GetLocationForStringAlternative> getAlternatives() {
return alternatives;
}