Search in sources :

Example 6 with MaskingAsyncMonitor

use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.

the class BaseMapDialog method loadBaseMaps.

private void loadBaseMaps() {
    listView.getStore().removeAll();
    listView.getStore().add(googleThumb(GoogleBaseMap.ROADMAP, I18N.CONSTANTS.googleRoadmap()));
    listView.getStore().add(googleThumb(GoogleBaseMap.SATELLITE, I18N.CONSTANTS.googleSatelliteMap()));
    listView.getStore().add(googleThumb(GoogleBaseMap.HYBRID, I18N.CONSTANTS.googleHybrid()));
    listView.getStore().add(googleThumb(GoogleBaseMap.TERRAIN, I18N.CONSTANTS.googleTerrainMap()));
    updateSelection();
    service.execute(new GetBaseMaps(), new MaskingAsyncMonitor(listView, I18N.CONSTANTS.loading()), new AsyncCallback<BaseMapResult>() {

        @Override
        public void onFailure(Throwable caught) {
            failLoadingBaseMaps();
        }

        @Override
        public void onSuccess(BaseMapResult result) {
            List<ModelData> thumbnails = new ArrayList<ModelData>();
            for (BaseMap baseMap : result.getBaseMaps()) {
                thumbnails.add(tileThumb(baseMap));
            }
            listView.getStore().add(thumbnails);
            updateSelection();
        }
    });
}
Also used : ModelData(com.extjs.gxt.ui.client.data.ModelData) BaseModelData(com.extjs.gxt.ui.client.data.BaseModelData) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) BaseMapResult(org.activityinfo.shared.command.result.BaseMapResult) GetBaseMaps(org.activityinfo.shared.command.GetBaseMaps) ArrayList(java.util.ArrayList) List(java.util.List) TileBaseMap(org.activityinfo.shared.map.TileBaseMap) GoogleBaseMap(org.activityinfo.shared.map.GoogleBaseMap) BaseMap(org.activityinfo.shared.map.BaseMap)

Example 7 with MaskingAsyncMonitor

use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.

the class DimensionTree method onModelChanged.

private void onModelChanged() {
    if (needToReloadDimensions(model)) {
        clearIndicatorSpecificDimensions();
        dispatcher.execute(new GetSchema(), new MaskingAsyncMonitor(treePanel, I18N.CONSTANTS.loading()), new AsyncCallback<SchemaDTO>() {

            @Override
            public void onFailure(Throwable caught) {
            }

            @Override
            public void onSuccess(SchemaDTO result) {
                populateIndicatorSpecificDimensions(result);
                applyModelState(result);
            }
        });
    }
}
Also used : MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) GetSchema(org.activityinfo.shared.command.GetSchema) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO)

Example 8 with MaskingAsyncMonitor

use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.

the class DbUserEditor method delete.

private void delete() {
    final UserPermissionDTO model = grid.getSelectionModel().getSelectedItem();
    model.setAllowView(false);
    model.setAllowViewAll(false);
    model.setAllowEdit(false);
    model.setAllowEditAll(false);
    model.setAllowDesign(false);
    model.setAllowManageAllUsers(false);
    model.setAllowManageUsers(false);
    dispatcher.execute(new UpdateUserPermissions(db.getId(), model), new MaskingAsyncMonitor(this, I18N.CONSTANTS.deleting()), new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(VoidResult result) {
            store.remove(model);
        }
    });
}
Also used : VoidResult(org.activityinfo.shared.command.result.VoidResult) UpdateUserPermissions(org.activityinfo.shared.command.UpdateUserPermissions) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) UserPermissionDTO(org.activityinfo.shared.dto.UserPermissionDTO)

Example 9 with MaskingAsyncMonitor

use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.

the class DbUserEditor method save.

private void save() {
    BatchCommand batch = new BatchCommand();
    for (Record record : store.getModifiedRecords()) {
        batch.add(new UpdateUserPermissions(db.getId(), (UserPermissionDTO) record.getModel()));
    }
    dispatcher.execute(batch, new MaskingAsyncMonitor(this, I18N.CONSTANTS.saving()), new AsyncCallback<BatchResult>() {

        @Override
        public void onFailure(Throwable caught) {
        // handled by monitor
        }

        @Override
        public void onSuccess(BatchResult result) {
            store.commitChanges();
        }
    });
}
Also used : UpdateUserPermissions(org.activityinfo.shared.command.UpdateUserPermissions) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) BatchCommand(org.activityinfo.shared.command.BatchCommand) Record(com.extjs.gxt.ui.client.store.Record) BatchResult(org.activityinfo.shared.command.result.BatchResult) UserPermissionDTO(org.activityinfo.shared.dto.UserPermissionDTO)

Example 10 with MaskingAsyncMonitor

use of org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor in project activityinfo by bedatadriven.

the class MonthlyReportsPanel method save.

private void save() {
    ArrayList<UpdateMonthlyReports.Change> changes = new ArrayList<UpdateMonthlyReports.Change>();
    for (Record record : store.getModifiedRecords()) {
        IndicatorRowDTO report = (IndicatorRowDTO) record.getModel();
        for (String property : record.getChanges().keySet()) {
            UpdateMonthlyReports.Change change = new UpdateMonthlyReports.Change();
            change.setIndicatorId(report.getIndicatorId());
            change.setMonth(IndicatorRowDTO.monthForProperty(property));
            change.setValue((Double) report.get(property));
            changes.add(change);
        }
    }
    service.execute(new UpdateMonthlyReports(currentSiteId, changes), new MaskingAsyncMonitor(this, I18N.CONSTANTS.save()), new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(Throwable caught) {
        // handled by monitor
        }

        @Override
        public void onSuccess(VoidResult result) {
        }
    });
}
Also used : UpdateMonthlyReports(org.activityinfo.shared.command.UpdateMonthlyReports) VoidResult(org.activityinfo.shared.command.result.VoidResult) ArrayList(java.util.ArrayList) IndicatorRowDTO(org.activityinfo.shared.dto.IndicatorRowDTO) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) Record(com.extjs.gxt.ui.client.store.Record)

Aggregations

MaskingAsyncMonitor (org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)11 GetSchema (org.activityinfo.shared.command.GetSchema)4 VoidResult (org.activityinfo.shared.command.result.VoidResult)4 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)4 BatchCommand (org.activityinfo.shared.command.BatchCommand)3 BatchResult (org.activityinfo.shared.command.result.BatchResult)3 Record (com.extjs.gxt.ui.client.store.Record)2 ArrayList (java.util.ArrayList)2 GetReportVisibility (org.activityinfo.shared.command.GetReportVisibility)2 UpdateUserPermissions (org.activityinfo.shared.command.UpdateUserPermissions)2 ReportVisibilityResult (org.activityinfo.shared.command.result.ReportVisibilityResult)2 UserPermissionDTO (org.activityinfo.shared.dto.UserPermissionDTO)2 BaseModelData (com.extjs.gxt.ui.client.data.BaseModelData)1 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 MessageBoxEvent (com.extjs.gxt.ui.client.event.MessageBoxEvent)1 BorderLayout (com.extjs.gxt.ui.client.widget.layout.BorderLayout)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 List (java.util.List)1 DeleteReport (org.activityinfo.shared.command.DeleteReport)1 GetBaseMaps (org.activityinfo.shared.command.GetBaseMaps)1