From b75ad04ac7f084cbb9386583f5736bb7d4def08e Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Thu, 18 Mar 2010 05:18:02 +0000 Subject: [PATCH] Implementing new Summary flag in Report View - Replace use of context variable with API change to fixed that the summary flag value is global to all report windows. Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2011569 --- base/src/org/compiere/print/DataEngine.java | 16 +++++++++++++++- base/src/org/compiere/print/ReportEngine.java | 9 +++++++-- client/src/org/compiere/print/Viewer.java | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/base/src/org/compiere/print/DataEngine.java b/base/src/org/compiere/print/DataEngine.java index d92b1f49b8..1b17bfc693 100644 --- a/base/src/org/compiere/print/DataEngine.java +++ b/base/src/org/compiere/print/DataEngine.java @@ -118,10 +118,24 @@ public class DataEngine * @return PrintData or null */ public PrintData getPrintData (Properties ctx, MPrintFormat format, MQuery query) + { + return getPrintData(ctx, format, query, false); + } + + /************************************************************************** + * Load Data + * + * @param format print format + * @param query query + * @param ctx context + * @param summary + * @return PrintData or null + */ + public PrintData getPrintData (Properties ctx, MPrintFormat format, MQuery query, boolean summary) { /** Report Summary FR [ 2011569 ]**/ - m_summary = "Y".equals(Env.getContext(Env.getCtx(),0, "IsReportSummary")); + m_summary = summary; if (format == null) throw new IllegalStateException ("No print format"); diff --git a/base/src/org/compiere/print/ReportEngine.java b/base/src/org/compiere/print/ReportEngine.java index a5e720a1b0..a79516e4ab 100644 --- a/base/src/org/compiere/print/ReportEngine.java +++ b/base/src/org/compiere/print/ReportEngine.java @@ -165,6 +165,8 @@ public class ReportEngine implements PrintServiceAttributeListener /** Window */ private int m_windowNo = 0; + private boolean m_summary = false; + /** * Set PrintFormat. * If Layout was created, re-create layout @@ -221,7 +223,7 @@ public class ReportEngine implements PrintServiceAttributeListener return; DataEngine de = new DataEngine(m_printFormat.getLanguage(),m_trxName); - setPrintData(de.getPrintData (m_ctx, m_printFormat, m_query)); + setPrintData(de.getPrintData (m_ctx, m_printFormat, m_query, m_summary)); // m_printData.dump(); } // setPrintData @@ -1595,5 +1597,8 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) return m_windowNo; } - + public void setSummary(boolean summary) + { + m_summary = summary; + } } // ReportEngine diff --git a/client/src/org/compiere/print/Viewer.java b/client/src/org/compiere/print/Viewer.java index 45032dff67..7828e77485 100644 --- a/client/src/org/compiere/print/Viewer.java +++ b/client/src/org/compiere/print/Viewer.java @@ -662,7 +662,7 @@ public class Viewer extends CFrame cmd_drill(); else if (e.getSource() == summary) //FR 201156 { - Env.setContext(Env.getCtx(), 0, "IsReportSummary", (Boolean)summary.getValue() ? "Y" : "N" ); + m_reportEngine.setSummary(summary.isSelected()); cmd_report(); } else if (cmd.equals("First"))