Search in sources :

Example 1 with UpdateReportSubscription

use of org.activityinfo.shared.command.UpdateReportSubscription in project activityinfo by bedatadriven.

the class EmailDialog method onButtonPressed.

@Override
protected void onButtonPressed(Button button) {
    if (button.getItemId().equals(OK)) {
        final UpdateReportSubscription update = new UpdateReportSubscription();
        update.setReportId(reportMetadata.getId());
        if (weekly.getValue()) {
            update.setEmailDelivery(EmailDelivery.WEEKLY);
            update.setEmailDay(dayOfWeek.getMappedValue());
        } else if (monthly.getValue()) {
            update.setEmailDelivery(EmailDelivery.MONTHLY);
            update.setEmailDay(dayOfMonth.getMappedValue());
        } else {
            update.setEmailDelivery(EmailDelivery.NONE);
        }
        dispatcher.execute(update, new MaskingAsyncMonitor(this, I18N.CONSTANTS.saving()), new AsyncCallback<VoidResult>() {

            @Override
            public void onFailure(Throwable caught) {
            }

            @Override
            public void onSuccess(VoidResult result) {
                hide();
                reportMetadata.setEmailDelivery(update.getEmailDelivery());
                reportMetadata.setDay(update.getEmailDay());
                callback.onUpdated();
            }
        });
    } else if (button.getItemId().equals(CANCEL)) {
        hide();
    }
}
Also used : UpdateReportSubscription(org.activityinfo.shared.command.UpdateReportSubscription) VoidResult(org.activityinfo.shared.command.result.VoidResult) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)

Example 2 with UpdateReportSubscription

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

UpdateReportSubscription (org.activityinfo.shared.command.UpdateReportSubscription)2 VoidResult (org.activityinfo.shared.command.result.VoidResult)2 MaskingAsyncMonitor (org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)1