diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DashboardRunnable.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DashboardRunnable.java index 781c2c6b0f..d9cb2b0b3e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DashboardRunnable.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DashboardRunnable.java @@ -20,9 +20,12 @@ import java.util.List; import java.util.Locale; import java.util.Properties; +import org.adempiere.util.ContextRunnable; import org.adempiere.util.ServerContext; +import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.session.SessionContextListener; import org.adempiere.webui.util.ServerPushTemplate; +import org.compiere.Adempiere; import org.compiere.util.CLogger; import org.zkoss.util.Locales; import org.zkoss.zk.ui.Desktop; @@ -132,7 +135,20 @@ public class DashboardRunnable implements Runnable, Serializable if (pooling && !dashboardPanels.get(i).isPooling()) continue; - dashboardPanels.get(i).refresh(template); + final DashboardPanel dpanel = dashboardPanels.get(i); + BusyDialog busyDialog = new BusyDialog(); + busyDialog.setShadow(false); + dpanel.getParent().insertBefore(busyDialog, dpanel.getParent().getFirstChild()); + ContextRunnable cr = new ContextRunnable() { + @Override + protected void doRun() { + dpanel.refresh(template); + template.execute(() -> { + busyDialog.detach(); + }); + } + }; + Adempiere.getThreadPoolExecutor().submit(cr); } } finally diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java index be1545a648..cfac711f50 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DashboardController.java @@ -434,7 +434,7 @@ public class DashboardController implements EventListener { private void asyncRenderGadgetPanel(ServerPushTemplate spt, MDashboardContent dashboardContent, Panel panel, IDesktop appDesktop, String contextPath, Panelchildren panelChildren, Component zulComponent) throws Exception { List components = new ArrayList<>(); - asyncRenderComponents(dashboardContent, dashboardRunnable, appDesktop, contextPath, panelChildren, components, zulComponent); + asyncRenderComponents(dashboardContent, dashboardRunnable, appDesktop, contextPath, panelChildren, components, zulComponent, spt); if (components.size() > 0) { for(Component c : components) { if (c.getParent() != panelChildren) { @@ -686,10 +686,11 @@ public class DashboardController implements EventListener { * @param parentComponent * @param components * @param zulComponent + * @param spt * @throws Exception */ private void asyncRenderComponents(MDashboardContent dashboardContent, DashboardRunnable dashboardRunnable, IDesktop appDesktop, String contextPath, - HtmlBasedComponent parentComponent, List components, Component zulComponent) throws Exception { + HtmlBasedComponent parentComponent, List components, Component zulComponent, ServerPushTemplate spt) throws Exception { // HTML content String htmlContent = dashboardContent.get_ID() > 0 ? dashboardContent.get_Translation(MDashboardContent.COLUMNNAME_HTML) : null; if(htmlContent != null) @@ -810,7 +811,7 @@ public class DashboardController implements EventListener { options.colorMap.put(WPerformanceIndicator.DIAL_BACKGROUND, new Color(224, 224, 224, 1)); WPAWidget paWidget = new WPAWidget(goal, options, dashboardContent.isShowTitle()); components.add(paWidget); - LayoutUtils.addSclass("performance-gadget", parentComponent); + spt.executeAsync(() -> LayoutUtils.addSclass("performance-gadget", parentComponent)); } else { //link to open performance detail Div div = new Div(); @@ -896,7 +897,7 @@ public class DashboardController implements EventListener { div.appendChild(statusLineHtml); div.setSclass("statusline-gadget"); components.add(div); - LayoutUtils.addSclass("statusline-wrapper", ((HtmlBasedComponent) parentComponent.getParent())); + spt.executeAsync(() -> LayoutUtils.addSclass("statusline-wrapper", ((HtmlBasedComponent) parentComponent.getParent()))); } } @@ -918,10 +919,11 @@ public class DashboardController implements EventListener { throw new AdempiereException(e); } } - HtmlBasedComponent parentComponent = (HtmlBasedComponent) content; - asyncRenderComponents(dashboardContent, dashboardRunnable, SessionManager.getAppDesktop(), Executions.getCurrent().getContextPath(), parentComponent, components, zulComponent); - boolean empty = components.isEmpty(); ServerPushTemplate spt = new ServerPushTemplate(content.getDesktop()); + HtmlBasedComponent parentComponent = (HtmlBasedComponent) content; + asyncRenderComponents(dashboardContent, dashboardRunnable, SessionManager.getAppDesktop(), Executions.getCurrent().getContextPath(), parentComponent, components, + zulComponent, spt); + boolean empty = components.isEmpty(); for(Component c : components) { if (c.getParent() != parentComponent) { parentComponent.appendChild(c);