[ 1676086 ] JasperReport Printengine for normal Reports

This commit is contained in:
deathmeat 2007-03-20 16:44:33 +00:00
parent 03ae86128f
commit a9a2996718
2 changed files with 49 additions and 7 deletions

View File

@ -1667,7 +1667,7 @@ public final class APanel extends CPanel
infoName, infoDisplay);
}
new AReport (m_curTab.getAD_Table_ID(), aReport.getButton(), query);
new AReport (m_curTab.getAD_Table_ID(), aReport.getButton(), query, this, m_curWindowNo);
} // cmd_report

View File

@ -24,6 +24,7 @@ import java.util.logging.*;
import javax.swing.*;
import org.compiere.apps.*;
import org.compiere.model.*;
import org.compiere.process.ProcessInfo;
import org.compiere.util.*;
/**
@ -46,6 +47,20 @@ public class AReport implements ActionListener
* @param query query
*/
public AReport (int AD_Table_ID, JComponent invoker, MQuery query)
{
new AReport(AD_Table_ID, invoker, query, null, 0);
}
/**
* Constructor
*
* @param AD_Table_ID table
* @param invoker component to display popup (optional)
* @param query query
* @param parent The invoking parent window
* @param WindowNo The invoking parent window number
*/
public AReport (int AD_Table_ID, JComponent invoker, MQuery query, ASyncProcess parent, int WindowNo)
{
log.config("AD_Table_ID=" + AD_Table_ID + " " + query);
if (!MRole.getDefault().isCanReport(AD_Table_ID))
@ -55,6 +70,8 @@ public class AReport implements ActionListener
}
m_query = query;
this.parent = parent;
this.WindowNo = WindowNo;
// See What is there
getPrintFormats (AD_Table_ID, invoker);
@ -68,6 +85,10 @@ public class AReport implements ActionListener
private ArrayList<KeyNamePair> m_list = new ArrayList<KeyNamePair>();
/** Logger */
private static CLogger log = CLogger.getCLogger(AReport.class);
/** The parent window for locking/unlocking during process execution */
ASyncProcess parent;
/** The parent window number */
int WindowNo;
/**
* Get the Print Formats for the table.
@ -169,8 +190,29 @@ public class AReport implements ActionListener
pf.getAD_Table_ID(),
Record_ID);
info.setDescription(m_query.getInfo());
if(pf != null && pf.getJasperProcess_ID() > 0)
{
// It's a report using the JasperReports engine
ProcessInfo pi = new ProcessInfo ("", pf.getJasperProcess_ID());
// Execute Process
ProcessCtl worker = ProcessCtl.process(parent, WindowNo, pi, null);
if(worker == null) // Process has been canceled
return;
try {
worker.start();
} catch(java.lang.IllegalThreadStateException itse) {
// Do nothing
}
}
else
{
// It's a default report using the standard printing engine
ReportEngine re = new ReportEngine (Env.getCtx(), pf, m_query, info);
new Viewer(re);
}
// if (m_popup.isVisible())
// m_popup.setVisible(false);
} // launchReport