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
This commit is contained in:
Heng Sin Low 2010-03-31 07:38:11 +00:00
parent 62ebd70936
commit 16afab193b
1 changed files with 6 additions and 4 deletions

View File

@ -56,6 +56,7 @@ import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.zkoss.util.media.AMedia; import org.zkoss.util.media.AMedia;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; 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) if (item != null && item.getValue() != null && item.toString().trim().length() > 0)
{ {
query.setTableName(item.getValue().toString()); 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; DrillEvent de = (DrillEvent) event;
if (de.getData() != null && de.getData() instanceof MQuery) { if (de.getData() != null && de.getData() instanceof MQuery) {
MQuery query = (MQuery) de.getData(); 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 * Execute Drill to Query
* @param query 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()); int AD_Table_ID = AReport.getAD_Table_ID(query.getTableName());
if (!MRole.getDefault().isCanReport(AD_Table_ID)) if (!MRole.getDefault().isCanReport(AD_Table_ID))
@ -584,7 +586,7 @@ public class ZkReportViewer extends Window implements EventListener {
return; return;
} }
if (AD_Table_ID != 0) if (AD_Table_ID != 0)
new WReport (AD_Table_ID, query); new WReport (AD_Table_ID, query, component, 0);
else else
log.warning("No Table found for " + query.getWhereClause(true)); log.warning("No Table found for " + query.getWhereClause(true));
} // executeDrill } // executeDrill