Search in sources :

Example 1 with DeleteReport

use of org.activityinfo.legacy.shared.command.DeleteReport 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

AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 DeleteReport (org.activityinfo.legacy.shared.command.DeleteReport)1 VoidResult (org.activityinfo.legacy.shared.command.result.VoidResult)1 ReportMetadataDTO (org.activityinfo.legacy.shared.model.ReportMetadataDTO)1 MaskingAsyncMonitor (org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor)1