Search in sources :

Example 11 with MaskingAsyncMonitor

use of org.activityinfo.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 : MessageBoxEvent(com.extjs.gxt.ui.client.event.MessageBoxEvent) VoidResult(org.activityinfo.shared.command.result.VoidResult) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) DeleteReport(org.activityinfo.shared.command.DeleteReport) ReportMetadataDTO(org.activityinfo.shared.dto.ReportMetadataDTO)

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