// Check if selection and deselection are really necessary, to avoid useless events.
if (event.getState()) {
// Only select a feature if it is not yet selected:
if (!layer.isFeatureSelected(featureId)) {
layer.getFeatureStore().getFeature(featureId, GeomajasConstant.FEATURE_INCLUDE_ALL,
new LazyLoadCallback() {
public void execute(List<Feature> response) {
layer.selectFeature(response.get(0));
}
});
}
} else {
// Only deselect a feature if it is not yet deselected:
if (layer.isFeatureSelected(featureId)) {
layer.getFeatureStore().getFeature(featureId, GeomajasConstant.FEATURE_INCLUDE_ALL,
new LazyLoadCallback() {
public void execute(List<Feature> response) {
layer.deselectFeature(response.get(0));
}
});