如何在执行冗长的操作时关闭 Vaadin 8 确认对话框 [英] How to dismiss Vaadin 8 confirmation dialog while performing lengthy operation

查看:33
本文介绍了如何在执行冗长的操作时关闭 Vaadin 8 确认对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Vaadin 8 确认码,它可以执行长期任务.我想关闭对话框并显示进度条:-

I have Vaadin 8 confirmation code there it performs a long lasting task. I would like to dismiss the dialog and show a progress bar:-

        ConfirmDialog.show(UI.getCurrent(), "Dynamic Report warning caption",
                "More than " +rows+ " rows in this table. It will take long time to generate this report.\nDo you still want to continue? ",
                SalkkuTM.getI18N("PortfolioManagementMenuBar.deleteData.confirmDialog.yes.caption"),
                SalkkuTM.getI18N("PortfolioManagementMenuBar.deleteData.confirmDialog.no.caption"), new ConfirmDialog.Listener() {
                    public void onClose(ConfirmDialog dialog) {
                        ProgressBar bar = new ProgressBar();
                        bar.setIndeterminate(true);
                        if (dialog.isConfirmed()) {
                            layout.addComponent(bar);
                            // this method does a long lasting task.
                            dynamicReportParameterGenerator();
                            bar.setVisible(false);
                        }
                    }
                });

我想在用户选择是后立即关闭此对话框.我想显示一个不确定的进度条.我无法应付.怎么做?请让我知道我该怎么做?

I would like to dismiss this dialog as soon as user select yes. And I would like to show an Indeterminate progress bar. I couldn't manage it. How to do it? Please let me know how can I do it?

推荐答案

这是 FAQ 的东西,你需要使用 服务器推送 并在后台线程中更新进度条.这里有一篇关于它的博文和视频

This is FAQ stuff, you need to use Server Push and update progress bar in background thread. There is a blog post and video about it here

https://vaadin.com/blog/community-answer-processing-a-file-in-a-background-thread

这里也有关于这个话题的很好的讨论

There is a good discussion about the topic here too

使用异步推送更新 Vaadin 进度条

我想显示一个不确定的进度条.

And I would like to show an Indeterminate progress bar.

这意味着您可以稍微简化一些事情.如果您不想在操作过程中更新进度条,您只需将进度条置于 Indeterminate 模式的 UI 中,完成后重新更新 UI.

This means that you can simplify things a little. If you do not want to update progress bar during the operation, you just need to put progress bar in UI in Indeterminate mode and once complete, update the UI again.

这篇关于如何在执行冗长的操作时关闭 Vaadin 8 确认对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆