Search in sources :

Example 1 with MaskingAsyncMonitor

use of org.activityinfo.ui.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.ui.client.dispatch.monitor.MaskingAsyncMonitor) BaseMapResult(org.activityinfo.legacy.shared.command.result.BaseMapResult) GetBaseMaps(org.activityinfo.legacy.shared.command.GetBaseMaps) ArrayList(java.util.ArrayList) List(java.util.List) BaseMap(org.activityinfo.legacy.shared.model.BaseMap) TileBaseMap(org.activityinfo.legacy.shared.model.TileBaseMap) GoogleBaseMap(org.activityinfo.legacy.shared.reports.content.GoogleBaseMap)

Example 2 with MaskingAsyncMonitor

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

the class DbUserEditorActions method delete.

public void delete() {
    panel.setModified(true);
    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(panel, I18N.CONSTANTS.deleting()), new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(Throwable caught) {
            panel.setModified(false);
        }

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

Example 3 with MaskingAsyncMonitor

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

the class DbUserEditorActions method save.

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

        @Override
        public void onFailure(Throwable caught) {
            // handled by monitor
            if (callback != null) {
                callback.onDecided(false);
            }
        }

        @Override
        public void onSuccess(BatchResult result) {
            store.commitChanges();
            panel.setModified(false);
            if (callback != null) {
                callback.onDecided(true);
            }
        }
    });
}
Also used : UpdateUserPermissions(org.activityinfo.legacy.shared.command.UpdateUserPermissions) MaskingAsyncMonitor(org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor) BatchCommand(org.activityinfo.legacy.shared.command.BatchCommand) Record(com.extjs.gxt.ui.client.store.Record) BatchResult(org.activityinfo.legacy.shared.command.result.BatchResult) UserPermissionDTO(org.activityinfo.legacy.shared.model.UserPermissionDTO)

Example 4 with MaskingAsyncMonitor

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

the class DbEditor method deleteEntity.

private void deleteEntity(EntityDTO selectedEntity) {
    BatchCommand batchCommand = unsavedChanges();
    batchCommand.add(new Delete(selectedEntity));
    service.execute(batchCommand, new MaskingAsyncMonitor(container, I18N.CONSTANTS.saving()), new AsyncCallback<BatchResult>() {

        @Override
        public void onFailure(Throwable caught) {
        // Failure case handled by MaskingAsyncMonitor
        }

        @Override
        public void onSuccess(BatchResult result) {
            treeStore.commitChanges();
            treeStore.remove(selectedEntity);
            eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
        }
    });
}
Also used : MaskingAsyncMonitor(org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor) BatchResult(org.activityinfo.legacy.shared.command.result.BatchResult)

Example 5 with MaskingAsyncMonitor

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

the class MonthlyReportsPanel method loadSite.

private void loadSite(final SiteDTO site) {
    this.currentSiteId = site.getId();
    this.grid.getStore().removeAll();
    MaskingAsyncMonitor monitor = new MaskingAsyncMonitor(this, I18N.CONSTANTS.loading());
    service.execute(new GetSchema(), monitor).thenDo(schema -> {
        service.execute(new GetActivityForm(site.getActivityId()), monitor).thenDo(activity -> {
            currentActivity = activity;
            populateGrid(site, schema);
        });
    });
}
Also used : MaskingAsyncMonitor(org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor) GetSchema(org.activityinfo.legacy.shared.command.GetSchema) GetActivityForm(org.activityinfo.legacy.shared.command.GetActivityForm)

Aggregations

MaskingAsyncMonitor (org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor)11 VoidResult (org.activityinfo.legacy.shared.command.result.VoidResult)4 BatchResult (org.activityinfo.legacy.shared.command.result.BatchResult)3 Record (com.extjs.gxt.ui.client.store.Record)2 ArrayList (java.util.ArrayList)2 GetActivityForm (org.activityinfo.legacy.shared.command.GetActivityForm)2 UpdateUserPermissions (org.activityinfo.legacy.shared.command.UpdateUserPermissions)2 UserPermissionDTO (org.activityinfo.legacy.shared.model.UserPermissionDTO)2 BaseModelData (com.extjs.gxt.ui.client.data.BaseModelData)1 ModelData (com.extjs.gxt.ui.client.data.ModelData)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 List (java.util.List)1 BatchCommand (org.activityinfo.legacy.shared.command.BatchCommand)1 DeleteReport (org.activityinfo.legacy.shared.command.DeleteReport)1 GetBaseMaps (org.activityinfo.legacy.shared.command.GetBaseMaps)1 GetSchema (org.activityinfo.legacy.shared.command.GetSchema)1 UpdateMonthlyReports (org.activityinfo.legacy.shared.command.UpdateMonthlyReports)1 UpdateReportSubscription (org.activityinfo.legacy.shared.command.UpdateReportSubscription)1 BaseMapResult (org.activityinfo.legacy.shared.command.result.BaseMapResult)1 IndicatorResult (org.activityinfo.legacy.shared.command.result.IndicatorResult)1