hg merge release-7.1 (merge release7.1 into default)
This commit is contained in:
commit
703ce023f9
|
@ -806,6 +806,12 @@ public class MColumn extends X_AD_Column
|
||||||
foreignTable = rt.getAD_Table().getTableName();
|
foreignTable = rt.getAD_Table().getTableName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (DisplayType.Button == refid) {
|
||||||
|
// C_BPartner.AD_OrgBP_ID and C_Project.C_ProjectType_ID are defined as buttons
|
||||||
|
if ("AD_OrgBP_ID".equalsIgnoreCase(getColumnName()))
|
||||||
|
foreignTable = "AD_Org";
|
||||||
|
else if ("C_ProjectType_ID".equalsIgnoreCase(getColumnName()))
|
||||||
|
foreignTable = "C_ProjectType";
|
||||||
} else if (DisplayType.List == refid || DisplayType.Payment == refid) {
|
} else if (DisplayType.List == refid || DisplayType.Payment == refid) {
|
||||||
foreignTable = "AD_Ref_List";
|
foreignTable = "AD_Ref_List";
|
||||||
} else if (DisplayType.Location == refid) {
|
} else if (DisplayType.Location == refid) {
|
||||||
|
|
|
@ -367,10 +367,13 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
//
|
//
|
||||||
setM_Warehouse_ID (order.getM_Warehouse_ID());
|
setM_Warehouse_ID (order.getM_Warehouse_ID());
|
||||||
setIsSOTrx (order.isSOTrx());
|
setIsSOTrx (order.isSOTrx());
|
||||||
if (C_DocTypeShipment_ID == 0)
|
if (C_DocTypeShipment_ID == 0) {
|
||||||
C_DocTypeShipment_ID = DB.getSQLValue(null,
|
MDocType dto = MDocType.get(getCtx(), order.getC_DocType_ID());
|
||||||
"SELECT C_DocTypeShipment_ID FROM C_DocType WHERE C_DocType_ID=?",
|
C_DocTypeShipment_ID = dto.getC_DocTypeShipment_ID();
|
||||||
order.getC_DocType_ID());
|
if (C_DocTypeShipment_ID <= 0)
|
||||||
|
throw new AdempiereException("@NotFound@ @C_DocTypeShipment_ID@ - @C_DocType_ID@:"
|
||||||
|
+dto.get_Translation(MDocType.COLUMNNAME_Name));
|
||||||
|
}
|
||||||
setC_DocType_ID (C_DocTypeShipment_ID);
|
setC_DocType_ID (C_DocTypeShipment_ID);
|
||||||
|
|
||||||
// patch suggested by Armen
|
// patch suggested by Armen
|
||||||
|
|
|
@ -305,6 +305,9 @@ public class MJournalLine extends X_GL_JournalLine
|
||||||
fillDimensionsFromCombination();
|
fillDimensionsFromCombination();
|
||||||
// end idempiere 344 - nmicoud
|
// end idempiere 344 - nmicoud
|
||||||
|
|
||||||
|
if (getLine() == 0)
|
||||||
|
setLine(DB.getSQLValueEx(get_TrxName(), "SELECT COALESCE(MAX(Line), 0) + 10 FROM GL_JournalLine WHERE GL_Journal_ID = ?", getGL_Journal_ID()));
|
||||||
|
|
||||||
// Acct Amts
|
// Acct Amts
|
||||||
BigDecimal rate = getCurrencyRate();
|
BigDecimal rate = getCurrencyRate();
|
||||||
BigDecimal amt = rate.multiply(getAmtSourceDr());
|
BigDecimal amt = rate.multiply(getAmtSourceDr());
|
||||||
|
|
|
@ -687,8 +687,20 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
|
|
||||||
if (doc != null)
|
if (doc != null)
|
||||||
{
|
{
|
||||||
appendInlineCss(doc);
|
//IDEMPIERE-4113
|
||||||
mapCssInfo.clear();
|
mapCssInfo.clear();
|
||||||
|
MPrintFormatItem item = null;
|
||||||
|
int printColIndex = -1;
|
||||||
|
for(int col = 0; col < m_printFormat.getItemCount(); col++)
|
||||||
|
{
|
||||||
|
item = m_printFormat.getItem(col);
|
||||||
|
if(item.isPrinted())
|
||||||
|
{
|
||||||
|
printColIndex++;
|
||||||
|
addCssInfo(item, printColIndex);
|
||||||
|
}
|
||||||
|
}//IDEMPIERE-4113
|
||||||
|
appendInlineCss(doc);
|
||||||
|
|
||||||
StringBuilder styleBuild = new StringBuilder();
|
StringBuilder styleBuild = new StringBuilder();
|
||||||
MPrintTableFormat tf = m_printFormat.getTableFormat();
|
MPrintTableFormat tf = m_printFormat.getTableFormat();
|
||||||
|
@ -921,10 +933,6 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
else
|
else
|
||||||
td.setClass(cssPrefix + "-text");
|
td.setClass(cssPrefix + "-text");
|
||||||
}
|
}
|
||||||
//just run with on record
|
|
||||||
if (row == 0)
|
|
||||||
addCssInfo(item, printColIndex);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (obj instanceof PrintData)
|
else if (obj instanceof PrintData)
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,11 +183,25 @@ public class PoFiller{
|
||||||
}
|
}
|
||||||
if (po.get_ColumnIndex(columnName) >= 0) {
|
if (po.get_ColumnIndex(columnName) >= 0) {
|
||||||
MColumn col = MColumn.get(ctx.ctx, po.get_TableName(), columnName);
|
MColumn col = MColumn.get(ctx.ctx, po.get_TableName(), columnName);
|
||||||
|
MTable foreignTable = null;
|
||||||
String refTableName = col.getReferenceTableName();
|
String refTableName = col.getReferenceTableName();
|
||||||
if (id > 0) {
|
if (refTableName != null) {
|
||||||
MTable foreignTable = MTable.get(Env.getCtx(), refTableName);
|
foreignTable = MTable.get(Env.getCtx(), refTableName);
|
||||||
|
} else {
|
||||||
|
if ("Record_ID".equalsIgnoreCase(columnName)) {
|
||||||
|
// special case - get the foreign table using column AD_Table_ID
|
||||||
|
int idxTableID = po.get_ColumnIndex("AD_Table_ID");
|
||||||
|
if (idxTableID >= 0) {
|
||||||
|
int tableID = po.get_ValueAsInt(idxTableID);
|
||||||
|
foreignTable = MTable.get(Env.getCtx(), tableID);
|
||||||
|
refTableName = foreignTable.getTableName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (id > 0 && refTableName != null) {
|
||||||
|
if (foreignTable != null) {
|
||||||
PO subPo = foreignTable.getPO(id, po.get_TrxName());
|
PO subPo = foreignTable.getPO(id, po.get_TrxName());
|
||||||
if (subPo.getAD_Client_ID() != Env.getAD_Client_ID(ctx.ctx)) {
|
if (subPo != null && subPo.getAD_Client_ID() != Env.getAD_Client_ID(ctx.ctx)) {
|
||||||
String accessLevel = foreignTable.getAccessLevel();
|
String accessLevel = foreignTable.getAccessLevel();
|
||||||
if ((MTable.ACCESSLEVEL_All.equals(accessLevel)
|
if ((MTable.ACCESSLEVEL_All.equals(accessLevel)
|
||||||
|| MTable.ACCESSLEVEL_SystemOnly.equals(accessLevel)
|
|| MTable.ACCESSLEVEL_SystemOnly.equals(accessLevel)
|
||||||
|
@ -195,6 +209,7 @@ public class PoFiller{
|
||||||
subPo.getAD_Client_ID() != 0)
|
subPo.getAD_Client_ID() != 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (po.get_ValueAsInt(columnName) != id) {
|
if (po.get_ValueAsInt(columnName) != id) {
|
||||||
po.set_ValueNoCheck(columnName, id);
|
po.set_ValueNoCheck(columnName, id);
|
||||||
|
|
|
@ -18,13 +18,14 @@ import net.sf.jasperreports.engine.JasperPrint;
|
||||||
import net.sf.jasperreports.engine.JasperReport;
|
import net.sf.jasperreports.engine.JasperReport;
|
||||||
|
|
||||||
import org.compiere.db.CConnection;
|
import org.compiere.db.CConnection;
|
||||||
|
import org.compiere.model.PrintInfo;
|
||||||
|
|
||||||
public class JasperViewer extends javax.swing.JFrame {
|
public class JasperViewer extends javax.swing.JFrame {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1192807883081180999L;
|
private static final long serialVersionUID = 1192807883081180999L;
|
||||||
|
|
||||||
private String m_title;
|
private String m_title;
|
||||||
|
private PrintInfo m_printInfo;
|
||||||
|
|
||||||
/** Creates new form JasperViewer */
|
/** Creates new form JasperViewer */
|
||||||
/**
|
/**
|
||||||
|
@ -32,11 +33,12 @@ public class JasperViewer extends javax.swing.JFrame {
|
||||||
* @param frameTitle Title to be displayed
|
* @param frameTitle Title to be displayed
|
||||||
* @throws JRException
|
* @throws JRException
|
||||||
*/
|
*/
|
||||||
protected JasperViewer(JasperPrint jasperPrint,String frameTitle) throws JRException {
|
protected JasperViewer(JasperPrint jasperPrint,String frameTitle, PrintInfo printInfo) throws JRException {
|
||||||
this.m_title = frameTitle;
|
this.m_title = frameTitle;
|
||||||
initComponents();
|
initComponents();
|
||||||
JasperReportViewer viewer = new JasperReportViewer(this, jasperPrint);
|
JasperReportViewer viewer = new JasperReportViewer(this, jasperPrint);
|
||||||
this.pnlMain.add(viewer, BorderLayout.CENTER);
|
this.pnlMain.add(viewer, BorderLayout.CENTER);
|
||||||
|
m_printInfo = printInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,12 +87,12 @@ public class JasperViewer extends javax.swing.JFrame {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static void viewReport(JasperPrint jasperPrint) throws JRException {
|
public static void viewReport(JasperPrint jasperPrint, PrintInfo printInfo) throws JRException {
|
||||||
JasperViewer jasperViewer = new JasperViewer(jasperPrint,"JasperReport");
|
JasperViewer jasperViewer = new JasperViewer(jasperPrint,"JasperReport", printInfo);
|
||||||
jasperViewer.setVisible(true);
|
jasperViewer.setVisible(true);
|
||||||
}
|
}
|
||||||
public static void viewReport(JasperPrint jasperPrint,String frameTitle) throws JRException {
|
public static void viewReport(JasperPrint jasperPrint,String frameTitle, PrintInfo printInfo) throws JRException {
|
||||||
JasperViewer jasperViewer = new JasperViewer(jasperPrint,frameTitle);
|
JasperViewer jasperViewer = new JasperViewer(jasperPrint,frameTitle, printInfo);
|
||||||
jasperViewer.setVisible(true);
|
jasperViewer.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +107,7 @@ public class JasperViewer extends javax.swing.JFrame {
|
||||||
try {
|
try {
|
||||||
JasperReport myjasperReport = (JasperReport) JasperCompileManager.compileReport(args[0] );
|
JasperReport myjasperReport = (JasperReport) JasperCompileManager.compileReport(args[0] );
|
||||||
JasperPrint myjasperPrint = JasperFillManager.fillReport( myjasperReport, new HashMap<String,Object>(), getConnection());
|
JasperPrint myjasperPrint = JasperFillManager.fillReport( myjasperReport, new HashMap<String,Object>(), getConnection());
|
||||||
JasperViewer.viewReport(myjasperPrint);
|
JasperViewer.viewReport(myjasperPrint, null);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package org.compiere.report;
|
package org.compiere.report;
|
||||||
|
|
||||||
import org.adempiere.report.jasper.JRViewerProvider;
|
import org.adempiere.report.jasper.JRViewerProvider;
|
||||||
|
import org.compiere.model.PrintInfo;
|
||||||
|
|
||||||
import net.sf.jasperreports.engine.JRException;
|
import net.sf.jasperreports.engine.JRException;
|
||||||
import net.sf.jasperreports.engine.JasperPrint;
|
import net.sf.jasperreports.engine.JasperPrint;
|
||||||
|
|
||||||
public class SwingJRViewerProvider implements JRViewerProvider {
|
public class SwingJRViewerProvider implements JRViewerProvider {
|
||||||
|
|
||||||
public void openViewer(JasperPrint jasperPrint, String title) throws JRException {
|
public void openViewer(JasperPrint jasperPrint, String title, PrintInfo printInfo) throws JRException {
|
||||||
JasperViewer jasperViewer = new JasperViewer( jasperPrint, title);
|
JasperViewer jasperViewer = new JasperViewer( jasperPrint, title, printInfo);
|
||||||
jasperViewer.setExtendedState(jasperViewer.getExtendedState() | javax.swing.JFrame.MAXIMIZED_BOTH);
|
jasperViewer.setExtendedState(jasperViewer.getExtendedState() | javax.swing.JFrame.MAXIMIZED_BOTH);
|
||||||
jasperViewer.setVisible(true);
|
jasperViewer.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
package org.adempiere.report.jasper;
|
package org.adempiere.report.jasper;
|
||||||
|
|
||||||
|
import org.compiere.model.PrintInfo;
|
||||||
|
|
||||||
import net.sf.jasperreports.engine.JRException;
|
import net.sf.jasperreports.engine.JRException;
|
||||||
import net.sf.jasperreports.engine.JasperPrint;
|
import net.sf.jasperreports.engine.JasperPrint;
|
||||||
|
|
||||||
public interface JRViewerProvider {
|
public interface JRViewerProvider {
|
||||||
|
|
||||||
public void openViewer(JasperPrint jasperPrint, String title) throws JRException;
|
public void openViewer(JasperPrint jasperPrint, String title, PrintInfo printInfo) throws JRException;
|
||||||
|
|
||||||
|
default void openViewer(JasperPrint jasperPrint, String title) throws JRException {
|
||||||
|
openViewer(jasperPrint, title, null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,17 @@ package org.adempiere.report.jasper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.compiere.model.PrintInfo;
|
||||||
|
|
||||||
import net.sf.jasperreports.engine.JRException;
|
import net.sf.jasperreports.engine.JRException;
|
||||||
import net.sf.jasperreports.engine.JasperPrint;
|
import net.sf.jasperreports.engine.JasperPrint;
|
||||||
|
|
||||||
public interface JRViewerProviderList {
|
public interface JRViewerProviderList {
|
||||||
|
|
||||||
public void openViewer(List<JasperPrint> jasperPrintList, String title) throws JRException;
|
public void openViewer(List<JasperPrint> jasperPrintList, String title, PrintInfo printInfo) throws JRException;
|
||||||
|
|
||||||
|
default void openViewer(List<JasperPrint> jasperPrintList, String title) throws JRException {
|
||||||
|
openViewer(jasperPrintList, title, null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -722,13 +722,15 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (printInfo == null)
|
||||||
|
printInfo = new PrintInfo(pi);
|
||||||
if (reportPathList.length == 1) {
|
if (reportPathList.length == 1) {
|
||||||
if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess run report -"+jasperPrint.getName());
|
if (log.isLoggable(Level.INFO)) log.info( "ReportStarter.startProcess run report -"+jasperPrint.getName());
|
||||||
JRViewerProvider viewerLauncher = Service.locator().locate(JRViewerProvider.class).getService();
|
JRViewerProvider viewerLauncher = Service.locator().locate(JRViewerProvider.class).getService();
|
||||||
if (!Util.isEmpty(processInfo.getReportType())) {
|
if (!Util.isEmpty(processInfo.getReportType())) {
|
||||||
jasperPrint.setProperty("IDEMPIERE_REPORT_TYPE", processInfo.getReportType());
|
jasperPrint.setProperty("IDEMPIERE_REPORT_TYPE", processInfo.getReportType());
|
||||||
}
|
}
|
||||||
viewerLauncher.openViewer(jasperPrint, pi.getTitle());
|
viewerLauncher.openViewer(jasperPrint, pi.getTitle(), printInfo);
|
||||||
} else {
|
} else {
|
||||||
jasperPrintList.add(jasperPrint);
|
jasperPrintList.add(jasperPrint);
|
||||||
if (idx+1 == reportPathList.length) {
|
if (idx+1 == reportPathList.length) {
|
||||||
|
@ -736,7 +738,7 @@ public class ReportStarter implements ProcessCall, ClientProcess
|
||||||
if (viewerLauncher == null) {
|
if (viewerLauncher == null) {
|
||||||
throw new AdempiereException("Can not find a viewer provider for multiple jaspers");
|
throw new AdempiereException("Can not find a viewer provider for multiple jaspers");
|
||||||
}
|
}
|
||||||
viewerLauncher.openViewer(jasperPrintList, pi.getTitle());
|
viewerLauncher.openViewer(jasperPrintList, pi.getTitle(), printInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1342,7 +1342,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
|
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
|
||||||
toolbar.getButton("PostIt").setPressed(adTabbox.getSelectedGridTab().hasPostIt());
|
toolbar.getButton("PostIt").setPressed(adTabbox.getSelectedGridTab().hasPostIt());
|
||||||
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
|
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
|
||||||
toolbar.getButton("Find").setPressed(adTabbox.getSelectedGridTab().isQueryActive());
|
|
||||||
|
|
||||||
if (toolbar.isPersonalLock)
|
if (toolbar.isPersonalLock)
|
||||||
{
|
{
|
||||||
|
@ -1362,6 +1361,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
toolbar.enableCustomize(adtab.isGridView());
|
toolbar.enableCustomize(adtab.isGridView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toolbar.getButton("Find").setPressed(adTabbox.getSelectedGridTab().isQueryActive() ||
|
||||||
|
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1707,8 +1709,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
toolbar.enablePostIt(false);
|
toolbar.enablePostIt(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbar.getButton("Find").setPressed(adTabbox.getSelectedGridTab().isQueryActive());
|
|
||||||
|
|
||||||
// Elaine 2008/12/05
|
// Elaine 2008/12/05
|
||||||
// Lock Indicator
|
// Lock Indicator
|
||||||
if (toolbar.isPersonalLock)
|
if (toolbar.isPersonalLock)
|
||||||
|
@ -1727,6 +1727,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
toolbar.enableZoomAcross(!isNewRow);
|
toolbar.enableZoomAcross(!isNewRow);
|
||||||
toolbar.enableActiveWorkflows(!isNewRow);
|
toolbar.enableActiveWorkflows(!isNewRow);
|
||||||
toolbar.enableRequests(!isNewRow);
|
toolbar.enableRequests(!isNewRow);
|
||||||
|
toolbar.getButton("Find").setPressed(adTabbox.getSelectedGridTab().isQueryActive() ||
|
||||||
|
(!isNewRow && (m_onlyCurrentRows || m_onlyCurrentDays > 0)));
|
||||||
|
|
||||||
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow);
|
toolbar.enablePrint(adTabbox.getSelectedGridTab().isPrinted() && !isNewRow);
|
||||||
toolbar.enableReport(!isNewRow);
|
toolbar.enableReport(!isNewRow);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.adempiere.webui.window;
|
package org.adempiere.webui.window;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -21,9 +23,11 @@ import org.adempiere.webui.panel.ITabOnCloseHandler;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.theme.ThemeManager;
|
import org.adempiere.webui.theme.ThemeManager;
|
||||||
import org.adempiere.webui.util.ZKUpdateUtil;
|
import org.adempiere.webui.util.ZKUpdateUtil;
|
||||||
|
import org.compiere.model.MArchive;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
|
import org.compiere.model.PrintInfo;
|
||||||
import org.compiere.tools.FileUtil;
|
import org.compiere.tools.FileUtil;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -91,10 +95,12 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
|
||||||
private KeyEvent prevKeyEvent;
|
private KeyEvent prevKeyEvent;
|
||||||
|
|
||||||
private String m_title; // local title - embedded windows clear the title
|
private String m_title; // local title - embedded windows clear the title
|
||||||
|
protected ToolBarButton bArchive = new ToolBarButton();
|
||||||
|
private PrintInfo m_printInfo;
|
||||||
|
|
||||||
private int mediaVersion = 0;
|
private int mediaVersion = 0;
|
||||||
|
|
||||||
public ZkJRViewer(JasperPrint jasperPrint, String title) {
|
public ZkJRViewer(JasperPrint jasperPrint, String title, PrintInfo printInfo) {
|
||||||
super();
|
super();
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
@ -102,10 +108,11 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
|
||||||
this.isList = false;
|
this.isList = false;
|
||||||
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
||||||
setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, m_WindowNo);
|
setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, m_WindowNo);
|
||||||
|
m_printInfo = printInfo;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZkJRViewer(java.util.List<JasperPrint> jasperPrintList, String title) {
|
public ZkJRViewer(java.util.List<JasperPrint> jasperPrintList, String title, PrintInfo printInfo) {
|
||||||
super();
|
super();
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
m_title = title;
|
m_title = title;
|
||||||
|
@ -113,6 +120,7 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
|
||||||
this.isList = true;
|
this.isList = true;
|
||||||
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
||||||
setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, m_WindowNo);
|
setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, m_WindowNo);
|
||||||
|
m_printInfo = printInfo;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,6 +211,16 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
|
||||||
toolbar.appendChild(bSendMail);
|
toolbar.appendChild(bSendMail);
|
||||||
bSendMail.addEventListener(Events.ON_CLICK, this);
|
bSendMail.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
|
toolbar.appendChild(new Separator("vertical"));
|
||||||
|
bArchive.setName("Archive");
|
||||||
|
if (ThemeManager.isUseFontIconForImage())
|
||||||
|
bArchive.setIconSclass("z-icon-Archive");
|
||||||
|
else
|
||||||
|
bArchive.setImage(ThemeManager.getThemeResource("images/Archive24.png"));
|
||||||
|
bArchive.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Archive")));
|
||||||
|
toolbar.appendChild(bArchive);
|
||||||
|
bArchive.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
North north = new North();
|
North north = new North();
|
||||||
layout.appendChild(north);
|
layout.appendChild(north);
|
||||||
north.appendChild(toolbar);
|
north.appendChild(toolbar);
|
||||||
|
@ -251,6 +269,8 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
|
||||||
cmd_render();
|
cmd_render();
|
||||||
else if (e.getTarget() == bSendMail) // Added by Martin Augustine - Ntier software services 09/10/2013
|
else if (e.getTarget() == bSendMail) // Added by Martin Augustine - Ntier software services 09/10/2013
|
||||||
cmd_sendMail();
|
cmd_sendMail();
|
||||||
|
else if (e.getTarget() == bArchive)
|
||||||
|
cmd_archive();
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
private void cmd_render() {
|
private void cmd_render() {
|
||||||
|
@ -525,4 +545,61 @@ public class ZkJRViewer extends Window implements EventListener<Event>, ITabOnCl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create archive for jasper report
|
||||||
|
*/
|
||||||
|
protected void cmd_archive()
|
||||||
|
{
|
||||||
|
boolean success = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] data = getFileByteData(getPDF());
|
||||||
|
if (data != null && m_printInfo != null)
|
||||||
|
{
|
||||||
|
MArchive archive = new MArchive(Env.getCtx(), m_printInfo, null);
|
||||||
|
archive.setBinaryData(data);
|
||||||
|
success = archive.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (success)
|
||||||
|
FDialog.info(m_WindowNo, this, "Archived");
|
||||||
|
else
|
||||||
|
FDialog.error(m_WindowNo, this, "ArchiveError");
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, "Exception while reading file " + e);
|
||||||
|
}
|
||||||
|
catch (JRException e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, "Error loading object from InputStream" + e);
|
||||||
|
}
|
||||||
|
} // cmd_archive
|
||||||
|
|
||||||
|
/**
|
||||||
|
* convert File data into Byte Data
|
||||||
|
* @param tempFile
|
||||||
|
* @return file in ByteData
|
||||||
|
*/
|
||||||
|
private byte[] getFileByteData(File tempFile)
|
||||||
|
{
|
||||||
|
byte fileContent[] = new byte[(int) tempFile.length()];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileInputStream fis = new FileInputStream(tempFile);
|
||||||
|
fis.read(fileContent);
|
||||||
|
fis.close();
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, "File not found " + e);
|
||||||
|
}
|
||||||
|
catch (IOException ioe)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, "Exception while reading file " + ioe);
|
||||||
|
}
|
||||||
|
return fileContent;
|
||||||
|
} // getFileByteData
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,19 +8,20 @@ import org.adempiere.webui.apps.AEnv;
|
||||||
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;
|
||||||
|
import org.compiere.model.PrintInfo;
|
||||||
|
|
||||||
import net.sf.jasperreports.engine.JRException;
|
import net.sf.jasperreports.engine.JRException;
|
||||||
import net.sf.jasperreports.engine.JasperPrint;
|
import net.sf.jasperreports.engine.JasperPrint;
|
||||||
|
|
||||||
public class ZkJRViewerProvider implements JRViewerProvider, JRViewerProviderList {
|
public class ZkJRViewerProvider implements JRViewerProvider, JRViewerProviderList {
|
||||||
|
|
||||||
public void openViewer(final JasperPrint jasperPrint, final String title)
|
public void openViewer(final JasperPrint jasperPrint, final String title, final PrintInfo printInfo)
|
||||||
throws JRException {
|
throws JRException {
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Window viewer = new ZkJRViewer(jasperPrint, title);
|
Window viewer = new ZkJRViewer(jasperPrint, title, printInfo);
|
||||||
|
|
||||||
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||||
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
||||||
|
@ -31,13 +32,13 @@ public class ZkJRViewerProvider implements JRViewerProvider, JRViewerProviderLis
|
||||||
AEnv.executeAsyncDesktopTask(runnable);
|
AEnv.executeAsyncDesktopTask(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openViewer(final List<JasperPrint> jasperPrintList, final String title)
|
public void openViewer(final List<JasperPrint> jasperPrintList, final String title , final PrintInfo printInfo)
|
||||||
throws JRException {
|
throws JRException {
|
||||||
Runnable runnable = new Runnable() {
|
Runnable runnable = new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Window viewer = new ZkJRViewer(jasperPrintList, title);
|
Window viewer = new ZkJRViewer(jasperPrintList, title, printInfo);
|
||||||
|
|
||||||
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
viewer.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
|
||||||
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
viewer.setAttribute(Window.INSERT_POSITION_KEY, Window.INSERT_NEXT);
|
||||||
|
|
Loading…
Reference in New Issue