@Override
    public void onHideRequest(final HidePopupRequestEvent e) {
        if (e.isOk()) {
            final String expression = editorPresenter.getText();
            if (Objects.equals(expression, column.getExpression())) {
                e.hide();
            } else {
                if (expression == null) {
                    columnChangeConsumer.accept(column, column.copy().expression(null).build());
                    e.hide();
                } else {
                    // Check the validity of the expression.
                    restFactory
                            .create(DASHBOARD_RESOURCE)
                            .method(res -> res.validateExpression(expression))
                            .onSuccess(result -> {
                                if (result.isOk()) {
                                    columnChangeConsumer.accept(column, column
                                            .copy()
                                            .expression(expression)
                                            .build());
                                    e.hide();
                                } else {
                                    AlertEvent.fireError(tablePresenter, result.getString(), e::reset);
                                }
                            })
                            .onFailure(RestErrorHandler.forPopup(this, e))
                            .taskMonitorFactory(this)
                            .exec();
                }
            }
        } else {
            // Cancel/Close
            if (editorPresenter.isClean()) {
                // User not change anything so allow the close
                e.hide();
            } else {
                final String msg = "Expression has unsaved changes.\n"
                                   + "Are you sure you want to close this window?";
                ConfirmEvent.fire(ColumnFunctionEditorPresenter.this, msg, confirm -> {
                    if (confirm) {
                        e.hide();
                    } else {
                        // Don't hide
                        e.reset();
                    }
                });
            }
        }
    }
This is the presenter for editing the function expression in a dashboard column
stroom-core-client/src/main/java/stroom/dashboard/client/table/ColumnFunctionEditorPresenter.java