use of org.activityinfo.legacy.shared.reports.model.layers.MapLayer in project activityinfo by bedatadriven.
the class LayersWidget method updateStore.
private void updateStore() {
// Save the selecteditem, because removing all items from the store
// triggers
// a selecteditem change
int selectedItemIndex = store.indexOf(view.getSelectionModel().getSelectedItem());
store.removeAll();
if (mapElement != null) {
for (MapLayer layer : mapElement.getLayers()) {
LayerModel model = new LayerModel();
model.setName(layer.getName());
model.setVisible(layer.isVisible());
model.setMapLayer(layer);
model.setLayerType(layer.getTypeName());
store.add(model);
}
}
// Place selection back at original selection
if ((selectedItemIndex != -1) && (selectedItemIndex < store.getCount())) {
List<LayerModel> selectedItem = new ArrayList<LayerModel>();
selectedItem.add(store.getAt(selectedItemIndex));
view.getSelectionModel().setSelection(selectedItem);
}
}
use of org.activityinfo.legacy.shared.reports.model.layers.MapLayer in project activityinfo by bedatadriven.
the class NewLayerWizard method createLayer.
public MapLayer createLayer() {
MapLayer layer = layerTypePage.newLayer();
layer.setName(composeName());
for (Integer indicatorId : indicatorPage.getSelectedIds()) {
layer.addIndicatorId(indicatorId);
}
if (layer instanceof PolygonMapLayer) {
((PolygonMapLayer) layer).setAdminLevelId(adminLevelPage.getSelectedLevelId());
}
return layer;
}
use of org.activityinfo.legacy.shared.reports.model.layers.MapLayer in project activityinfo by bedatadriven.
the class MapEditor method createLayersOptionsPanel.
protected void createLayersOptionsPanel() {
optionsPanel = new LayerOptionsPanel(dispatcher);
optionsPanel.setVisible(false);
optionsPanel.addListener(Events.Hide, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
mapPanel.setZoomControlOffsetX(ZOOM_CONTROL_LEFT_MARGIN);
}
});
optionsPanel.addListener(Events.Show, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
mapPanel.setZoomControlOffsetX(LayerOptionsPanel.WIDTH + ZOOM_CONTROL_LEFT_MARGIN);
}
});
optionsPanel.addValueChangeHandler(new ValueChangeHandler<MapLayer>() {
@Override
public void onValueChange(ValueChangeEvent<MapLayer> event) {
MapEditor.this.mapReportElement.setFilter(event.getValue().getFilter());
reportEventBus.fireChange();
}
});
add(optionsPanel, new AbsoluteData(0, CONTROL_TOP_MARGIN));
}
Aggregations