*
* @param event
* The {@link MenuItemClickEvent} from clicking the action.
*/
public void onClick(MenuItemClickEvent event) {
final FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction();
if (ft != null && index != null) {
List<Feature> features = new ArrayList<Feature>();
features.add(ft.getNewFeatures()[index.getFeatureIndex()]);
LazyLoader.lazyLoad(features, GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, new LazyLoadCallback() {
public void execute(List<Feature> response) {
controller.setEditMode(EditMode.INSERT_MODE);
Geometry geometry = response.get(0).getGeometry();
if (geometry instanceof Polygon) {
geometry = addRing((Polygon) geometry);
} else if (geometry instanceof MultiPolygon) {
geometry = addRing((MultiPolygon) geometry);
}
ft.getNewFeatures()[index.getFeatureIndex()].setGeometry(geometry);
controller.setGeometryIndex(index);
controller.hideGeometricInfo();
}
});
}