From 16afab193b74ada87341c636bf5245f717fdaa4f Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 31 Mar 2010 07:38:11 +0000 Subject: [PATCH] The current drilldown and drillacross in report viewer implementation can caused NPE as it create WReport without a parent component which is needed in the showPopup method. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2979808 --- .../src/org/adempiere/webui/window/ZkReportViewer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java index 70484e0a71..1f6ad0ad85 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java @@ -56,6 +56,7 @@ import org.compiere.util.Env; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; import org.zkoss.util.media.AMedia; +import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; @@ -302,7 +303,7 @@ public class ZkReportViewer extends Window implements EventListener { if (item != null && item.getValue() != null && item.toString().trim().length() > 0) { query.setTableName(item.getValue().toString()); - executeDrill(query); + executeDrill(query, event.getTarget()); } } } @@ -317,7 +318,7 @@ public class ZkReportViewer extends Window implements EventListener { DrillEvent de = (DrillEvent) event; if (de.getData() != null && de.getData() instanceof MQuery) { MQuery query = (MQuery) de.getData(); - executeDrill(query); + executeDrill(query, event.getTarget()); } } @@ -574,8 +575,9 @@ public class ZkReportViewer extends Window implements EventListener { /** * Execute Drill to Query * @param query query + * @param component */ - private void executeDrill (MQuery query) + private void executeDrill (MQuery query, Component component) { int AD_Table_ID = AReport.getAD_Table_ID(query.getTableName()); if (!MRole.getDefault().isCanReport(AD_Table_ID)) @@ -584,7 +586,7 @@ public class ZkReportViewer extends Window implements EventListener { return; } if (AD_Table_ID != 0) - new WReport (AD_Table_ID, query); + new WReport (AD_Table_ID, query, component, 0); else log.warning("No Table found for " + query.getWhereClause(true)); } // executeDrill