Search in sources :

Example 16 with VoidResult

use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.

the class AttachmentsPresenter method onDelete.

public void onDelete() {
    DeleteSiteAttachment attachment = new DeleteSiteAttachment();
    attachment.setBlobId(view.getSelectedItem());
    dispatcher.execute(attachment, new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(Throwable caught) {
        // callback.onFailure(caught);
        }

        @Override
        public void onSuccess(VoidResult result) {
            view.setActionEnabled(UIActions.DELETE, false);
            view.setAttachmentStore(currentSite.getId());
        }
    });
}
Also used : DeleteSiteAttachment(org.activityinfo.shared.command.DeleteSiteAttachment) VoidResult(org.activityinfo.shared.command.result.VoidResult)

Example 17 with VoidResult

use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.

the class EmbedDialog method publishActivity.

protected void publishActivity(ActivityDTO activity, final String url) {
    Map<String, Object> changes = Maps.newHashMap();
    changes.put("published", Published.ALL_ARE_PUBLISHED.getIndex());
    UpdateEntity update = new UpdateEntity(activity, changes);
    dispatcher.execute(update, new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(Throwable caught) {
            MessageBox.alert(I18N.CONSTANTS.embed(), "There was an error encounted on the server while trying to publish the activity", null);
        }

        @Override
        public void onSuccess(VoidResult result) {
            show(url);
        }
    });
}
Also used : UpdateEntity(org.activityinfo.shared.command.UpdateEntity) VoidResult(org.activityinfo.shared.command.result.VoidResult)

Example 18 with VoidResult

use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.

the class MonthlyReportsPanel method save.

private void save() {
    ArrayList<UpdateMonthlyReports.Change> changes = new ArrayList<UpdateMonthlyReports.Change>();
    for (Record record : store.getModifiedRecords()) {
        IndicatorRowDTO report = (IndicatorRowDTO) record.getModel();
        for (String property : record.getChanges().keySet()) {
            UpdateMonthlyReports.Change change = new UpdateMonthlyReports.Change();
            change.setIndicatorId(report.getIndicatorId());
            change.setMonth(IndicatorRowDTO.monthForProperty(property));
            change.setValue((Double) report.get(property));
            changes.add(change);
        }
    }
    service.execute(new UpdateMonthlyReports(currentSiteId, changes), new MaskingAsyncMonitor(this, I18N.CONSTANTS.save()), new AsyncCallback<VoidResult>() {

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

        @Override
        public void onSuccess(VoidResult result) {
        }
    });
}
Also used : UpdateMonthlyReports(org.activityinfo.shared.command.UpdateMonthlyReports) VoidResult(org.activityinfo.shared.command.result.VoidResult) ArrayList(java.util.ArrayList) IndicatorRowDTO(org.activityinfo.shared.dto.IndicatorRowDTO) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) Record(com.extjs.gxt.ui.client.store.Record)

Example 19 with VoidResult

use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.

the class ReportDesignPage method performUpdate.

private void performUpdate(final AsyncMonitor monitor, final AsyncCallback<VoidResult> callback) {
    UpdateReportModel updateReport = new UpdateReportModel();
    updateReport.setModel(currentModel);
    dispatcher.execute(updateReport, monitor, new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(final Throwable caught) {
            callback.onFailure(caught);
        }

        @Override
        public void onSuccess(final VoidResult result) {
            dirty = false;
            callback.onSuccess(result);
        }
    });
}
Also used : VoidResult(org.activityinfo.shared.command.result.VoidResult) UpdateReportModel(org.activityinfo.shared.command.UpdateReportModel)

Example 20 with VoidResult

use of org.activityinfo.shared.command.result.VoidResult in project activityinfo by bedatadriven.

the class ReportGridPanel method onDashboardClicked.

private void onDashboardClicked(final ReportMetadataDTO model) {
    model.setDashboard(!model.isDashboard());
    store.update(model);
    UpdateReportSubscription update = new UpdateReportSubscription();
    update.setReportId(model.getId());
    update.setPinnedToDashboard(model.isDashboard());
    dispatcher.execute(update, new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(Throwable caught) {
        // TODO Auto-generated method stub
        }

        @Override
        public void onSuccess(VoidResult result) {
            Info.display(I18N.CONSTANTS.saved(), model.isDashboard() ? I18N.MESSAGES.addedToDashboard(model.getTitle()) : I18N.MESSAGES.removedFromDashboard(model.getTitle()));
        }
    });
}
Also used : UpdateReportSubscription(org.activityinfo.shared.command.UpdateReportSubscription) VoidResult(org.activityinfo.shared.command.result.VoidResult)

Aggregations

VoidResult (org.activityinfo.shared.command.result.VoidResult)26 Record (com.extjs.gxt.ui.client.store.Record)4 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)4 MockEventBus (org.activityinfo.client.MockEventBus)4 DispatcherStub (org.activityinfo.client.dispatch.DispatcherStub)4 MaskingAsyncMonitor (org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)4 UIConstants (org.activityinfo.client.i18n.UIConstants)4 StateManagerStub (org.activityinfo.client.mock.StateManagerStub)4 UpdateEntity (org.activityinfo.shared.command.UpdateEntity)4 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)4 Test (org.junit.Test)4 FormDialogCallback (org.activityinfo.client.page.common.dialog.FormDialogCallback)3 TreeStore (com.extjs.gxt.ui.client.store.TreeStore)2 FormDialogImpl (org.activityinfo.client.page.common.dialog.FormDialogImpl)2 Delete (org.activityinfo.shared.command.Delete)2 UpdateMonthlyReports (org.activityinfo.shared.command.UpdateMonthlyReports)2 UpdateReportSubscription (org.activityinfo.shared.command.UpdateReportSubscription)2 UpdateUserPermissions (org.activityinfo.shared.command.UpdateUserPermissions)2 ActivityDTO (org.activityinfo.shared.dto.ActivityDTO)2 CommandException (org.activityinfo.shared.exception.CommandException)2