Search in sources :

Example 6 with AsyncMonitor

use of org.activityinfo.ui.client.dispatch.AsyncMonitor in project activityinfo by bedatadriven.

the class MonthlyReportsPanel method confirmUnsavedData.

private void confirmUnsavedData(final Function function) {
    if (isModified()) {
        final SavePromptMessageBox box = new SavePromptMessageBox();
        box.show(new SaveChangesCallback() {

            @Override
            public void save(AsyncMonitor monitor) {
                MonthlyReportsPanel.this.save().then(new AsyncCallback<Void>() {

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

                    @Override
                    public void onSuccess(Void result) {
                        box.hide();
                        function.apply(null);
                    }
                });
            }

            @Override
            public void cancel() {
                box.hide();
                function.apply(null);
            }

            @Override
            public void discard() {
                box.hide();
                function.apply(null);
            }
        });
    }
}
Also used : AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) SavePromptMessageBox(org.activityinfo.ui.client.page.common.dialog.SavePromptMessageBox) SaveChangesCallback(org.activityinfo.ui.client.page.common.dialog.SaveChangesCallback) MaskingAsyncMonitor(org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor) AsyncMonitor(org.activityinfo.ui.client.dispatch.AsyncMonitor)

Aggregations

AsyncMonitor (org.activityinfo.ui.client.dispatch.AsyncMonitor)6 SaveChangesCallback (org.activityinfo.ui.client.page.common.dialog.SaveChangesCallback)6 SavePromptMessageBox (org.activityinfo.ui.client.page.common.dialog.SavePromptMessageBox)6 MaskingAsyncMonitor (org.activityinfo.ui.client.dispatch.monitor.MaskingAsyncMonitor)3 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)2 SuccessCallback (org.activityinfo.ui.client.dispatch.callback.SuccessCallback)2 BatchResult (org.activityinfo.legacy.shared.command.result.BatchResult)1