IDEMPIERE-2499:long task (ZkReportViewerProvider.openViewer) in process make GUI lock
fix:NPE
This commit is contained in:
parent
4050bd6819
commit
7fde2f2610
|
@ -17,7 +17,9 @@
|
||||||
package org.adempiere.webui.window;
|
package org.adempiere.webui.window;
|
||||||
|
|
||||||
import org.adempiere.util.ContextRunnable;
|
import org.adempiere.util.ContextRunnable;
|
||||||
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
|
import org.adempiere.webui.apps.DesktopRunnable;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.part.WindowContainer;
|
import org.adempiere.webui.part.WindowContainer;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
|
@ -49,13 +51,22 @@ public class ZkReportViewerProvider implements ReportViewerProvider {
|
||||||
// IDEMPIERE-2499
|
// IDEMPIERE-2499
|
||||||
// detect ui thread by value of Executions.getCurrent(), not office method but work
|
// detect ui thread by value of Executions.getCurrent(), not office method but work
|
||||||
if (Executions.getCurrent() != null){
|
if (Executions.getCurrent() != null){
|
||||||
Adempiere.getThreadPoolExecutor().submit(new ContextRunnable(){
|
|
||||||
|
final DesktopRunnable getLayoutThread = new DesktopRunnable(new ContextRunnable(){
|
||||||
protected void doRun(){
|
protected void doRun(){
|
||||||
// load layout, with big report it's heavy job, do in non ui thread to don't lock gui
|
// load layout, with big report it's heavy job, do in non ui thread to don't lock gui
|
||||||
report.getLayout();
|
report.getLayout();
|
||||||
AEnv.executeAsyncDesktopTask(runnable);
|
AEnv.executeAsyncDesktopTask(runnable);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
}, Executions.getCurrent().getDesktop());
|
||||||
|
|
||||||
|
Adempiere.getThreadPoolExecutor().submit(new ContextRunnable(){
|
||||||
|
protected void doRun(){
|
||||||
|
getLayoutThread.run();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
// load layout in non ui thread before run into ui thread
|
// load layout in non ui thread before run into ui thread
|
||||||
report.getLayout();
|
report.getLayout();
|
||||||
|
|
Loading…
Reference in New Issue