Search in sources :

Example 1 with VoidResult

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

the class DbProjectEditor method onEdit.

@Override
protected void onEdit(final ProjectDTO model) {
    final FormDialogImpl<ProjectForm> dialog = new FormDialogImpl<ProjectForm>(new ProjectForm());
    dialog.setWidth(450);
    dialog.setHeight(300);
    dialog.getForm().getBinding().bind(model);
    dialog.show(new FormDialogCallback() {

        @Override
        public void onValidated() {
            service.execute(RequestChange.update(model, "name", "description"), dialog, new AsyncCallback<VoidResult>() {

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

                @Override
                public void onSuccess(VoidResult result) {
                    dialog.hide();
                    eventBus.fireEvent(AppEvents.SCHEMA_CHANGED);
                    view.refresh();
                }
            });
        }
    });
}
Also used : ProjectForm(org.activityinfo.client.page.config.form.ProjectForm) FormDialogImpl(org.activityinfo.client.page.common.dialog.FormDialogImpl) FormDialogCallback(org.activityinfo.client.page.common.dialog.FormDialogCallback) VoidResult(org.activityinfo.shared.command.result.VoidResult) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback)

Example 2 with VoidResult

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

the class DbUserEditor method add.

private void add() {
    final UserForm form = new UserForm(db);
    final FormDialogImpl dlg = new FormDialogImpl(form);
    dlg.setHeading(I18N.CONSTANTS.newUser());
    dlg.setWidth(400);
    dlg.setHeight(300);
    final String host = Window.Location.getHostName();
    dlg.show(new FormDialogCallback() {

        @Override
        public void onValidated() {
            dispatcher.execute(new UpdateUserPermissions(db, form.getUser(), host), dlg, new AsyncCallback<VoidResult>() {

                @Override
                public void onFailure(Throwable caught) {
                }

                @Override
                public void onSuccess(VoidResult result) {
                    loader.load();
                    dlg.hide();
                }
            });
        }
    });
}
Also used : FormDialogImpl(org.activityinfo.client.page.common.dialog.FormDialogImpl) FormDialogCallback(org.activityinfo.client.page.common.dialog.FormDialogCallback) VoidResult(org.activityinfo.shared.command.result.VoidResult) UpdateUserPermissions(org.activityinfo.shared.command.UpdateUserPermissions) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) UserForm(org.activityinfo.client.page.config.form.UserForm)

Example 3 with VoidResult

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

the class BoundLocationSection method save.

@Override
public void save(final AsyncCallback<Void> callback) {
    if (isDirty()) {
        newLocation();
        dispatcher.execute(new CreateLocation(location), new AsyncCallback<VoidResult>() {

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

            @Override
            public void onSuccess(VoidResult result) {
                callback.onSuccess(null);
            }
        });
    } else {
        callback.onSuccess(null);
    }
}
Also used : CreateLocation(org.activityinfo.shared.command.CreateLocation) VoidResult(org.activityinfo.shared.command.result.VoidResult)

Example 4 with VoidResult

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

the class SiteDialog method updateSite.

private void updateSite() {
    final SiteDTO updated = new SiteDTO(site);
    updateModel(updated);
    dispatcher.execute(new UpdateSite(site, updated), new AsyncCallback<VoidResult>() {

        @Override
        public void onFailure(Throwable caught) {
            showError(caught);
        }

        @Override
        public void onSuccess(VoidResult result) {
            hide();
            callback.onSaved(updated);
        }
    });
}
Also used : VoidResult(org.activityinfo.shared.command.result.VoidResult) SiteDTO(org.activityinfo.shared.dto.SiteDTO) UpdateSite(org.activityinfo.shared.command.UpdateSite)

Example 5 with VoidResult

use of org.activityinfo.shared.command.result.VoidResult 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)

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