Search in sources :

Example 11 with MaskingAsyncMonitor

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

the class ReportGridPanel method delete.

private void delete() {
    final ReportMetadataDTO report = grid.getSelectionModel().getSelectedItem();
    MessageBox.confirm(I18N.CONSTANTS.delete(), I18N.MESSAGES.confirmDeleteReport(report.getTitle()), new Listener<MessageBoxEvent>() {

        @Override
        public void handleEvent(MessageBoxEvent be) {
            if (be.getButtonClicked().getItemId().equals(Dialog.YES)) {
                dispatcher.execute(new DeleteReport(report.getId()), new MaskingAsyncMonitor(ReportGridPanel.this, I18N.CONSTANTS.delete()), new AsyncCallback<VoidResult>() {

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

                    @Override
                    public void onSuccess(VoidResult result) {
                        grid.getStore().remove(report);
                    }
                });
            }
        }
    });
}
Also used : VoidResult(org.activityinfo.legacy.shared.command.result.VoidResult) MaskingAsyncMonitor(org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) DeleteReport(org.activityinfo.legacy.shared.command.DeleteReport) ReportMetadataDTO(org.activityinfo.legacy.shared.model.ReportMetadataDTO)

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