Search in sources :

Example 1 with DeleteReport

use of org.activityinfo.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 : 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

MessageBoxEvent (com.extjs.gxt.ui.client.event.MessageBoxEvent)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 MaskingAsyncMonitor (org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)1 DeleteReport (org.activityinfo.shared.command.DeleteReport)1 VoidResult (org.activityinfo.shared.command.result.VoidResult)1 ReportMetadataDTO (org.activityinfo.shared.dto.ReportMetadataDTO)1