From 7fde2f26108478ef644902159446d9bae75d2240 Mon Sep 17 00:00:00 2001 From: hieplq Date: Sat, 14 Mar 2015 23:39:05 +0700 Subject: [PATCH] IDEMPIERE-2499:long task (ZkReportViewerProvider.openViewer) in process make GUI lock fix:NPE --- .../webui/window/ZkReportViewerProvider.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java index dbf363144d..a4d9175466 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewerProvider.java @@ -17,7 +17,9 @@ package org.adempiere.webui.window; import org.adempiere.util.ContextRunnable; +import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.apps.DesktopRunnable; import org.adempiere.webui.component.Window; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.session.SessionManager; @@ -49,13 +51,22 @@ public class ZkReportViewerProvider implements ReportViewerProvider { // IDEMPIERE-2499 // detect ui thread by value of Executions.getCurrent(), not office method but work if (Executions.getCurrent() != null){ - Adempiere.getThreadPoolExecutor().submit(new ContextRunnable(){ + + final DesktopRunnable getLayoutThread = new DesktopRunnable(new ContextRunnable(){ protected void doRun(){ // load layout, with big report it's heavy job, do in non ui thread to don't lock gui report.getLayout(); AEnv.executeAsyncDesktopTask(runnable); + } - }); + }, Executions.getCurrent().getDesktop()); + + Adempiere.getThreadPoolExecutor().submit(new ContextRunnable(){ + protected void doRun(){ + getLayoutThread.run(); + } + }); + }else{ // load layout in non ui thread before run into ui thread report.getLayout();