簡體   English   中英

如何在執行冗長的操作時關閉Vaadin 8確認對話框

[英]How to dismiss Vaadin 8 confirmation dialog while performing lengthy operation

我有Vaadin 8確認代碼,該代碼執行很長的任務。 我想關閉對話框並顯示進度欄:-

        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);
                        }
                    }
                });

在此處輸入圖片說明

我想在用戶選擇“是”后立即​​關閉此對話框。 我想展示一個不確定的進度欄。 我無法處理。 怎么做? 請讓我知道我該怎么做?

這是常見問題,您需要在后台線程中使用服務器推送和更新進度欄。 這里有一篇博客文章和有關它的視頻

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

這里也有關於該主題的很好的討論

使用異步推送更新Vaadin Progressbar

我想展示一個不確定的進度欄。

這意味着您可以簡化一些事情。 如果您不想在操作過程中更新進度條,只需將進度條置於不確定模式下的UI中,一旦完成,請再次更新UI。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM