IDEMPIERE-4070: Adding print format item -> Display logic support in XLSX, XLS and HTML report. (#11)
This commit is contained in:
parent
3cc17d25fd
commit
511292c8b9
|
@ -119,6 +119,15 @@ public abstract class AbstractExcelExporter
|
||||||
*/
|
*/
|
||||||
public abstract boolean isPageBreak(int row, int col);
|
public abstract boolean isPageBreak(int row, int col);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there is a display logic
|
||||||
|
*
|
||||||
|
* @param row row index
|
||||||
|
* @param col column index
|
||||||
|
* @return true if there is no logic or evaluate logic specified in print item
|
||||||
|
*/
|
||||||
|
public abstract boolean isDisplayed(int row, int col);
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected final transient CLogger log = CLogger.getCLogger(getClass());
|
protected final transient CLogger log = CLogger.getCLogger(getClass());
|
||||||
//
|
//
|
||||||
|
@ -497,7 +506,7 @@ public abstract class AbstractExcelExporter
|
||||||
}
|
}
|
||||||
|
|
||||||
int displayType = getDisplayType(rownum, col);
|
int displayType = getDisplayType(rownum, col);
|
||||||
if (obj == null){
|
if (obj == null || !isDisplayed(rownum, col)){
|
||||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||||
preValues[printColIndex] = null;
|
preValues[printColIndex] = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,6 +129,15 @@ public abstract class AbstractXLSXExporter
|
||||||
*/
|
*/
|
||||||
public abstract boolean isPageBreak(int row, int col);
|
public abstract boolean isPageBreak(int row, int col);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if there is a display logic
|
||||||
|
*
|
||||||
|
* @param row row index
|
||||||
|
* @param col column index
|
||||||
|
* @return true if there is no logic or evaluate logic specified in print item
|
||||||
|
*/
|
||||||
|
public abstract boolean isDisplayed(int row, int col);
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected final CLogger log = CLogger.getCLogger(getClass());
|
protected final CLogger log = CLogger.getCLogger(getClass());
|
||||||
//
|
//
|
||||||
|
@ -457,7 +466,7 @@ public abstract class AbstractXLSXExporter
|
||||||
// line row
|
// line row
|
||||||
Object obj = getValueAt(rownum, col);
|
Object obj = getValueAt(rownum, col);
|
||||||
int displayType = getDisplayType(rownum, col);
|
int displayType = getDisplayType(rownum, col);
|
||||||
if (obj == null)
|
if (obj == null || !isDisplayed(rownum, col))
|
||||||
{
|
{
|
||||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex])
|
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex])
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,4 +117,10 @@ public class ArrayExcelExporter extends AbstractXLSXExporter {
|
||||||
protected int getCurrentRow() {
|
protected int getCurrentRow() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisplayed(int row, int col)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,4 +191,10 @@ public class GridTabExcelExporter extends AbstractExcelExporter implements IGrid
|
||||||
public boolean isExportableTab(GridTab gridTab) {
|
public boolean isExportableTab(GridTab gridTab) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisplayed(int row, int col)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.compiere.model.MLookupFactory;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.Util;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel Exporter Adapter for GridTab
|
* Excel Exporter Adapter for GridTab
|
||||||
|
@ -199,4 +198,10 @@ public class GridTabXLSXExporter extends AbstractXLSXExporter implements IGridTa
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisplayed(int row, int col)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,11 @@ import org.compiere.print.MPrintPaper;
|
||||||
import org.compiere.print.PrintData;
|
import org.compiere.print.PrintData;
|
||||||
import org.compiere.print.PrintDataElement;
|
import org.compiere.print.PrintDataElement;
|
||||||
import org.compiere.print.layout.PrintDataEvaluatee;
|
import org.compiere.print.layout.PrintDataEvaluatee;
|
||||||
|
import org.compiere.print.layout.PrintDataEvaluatee;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Evaluator;
|
import org.compiere.util.Evaluator;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.Evaluator;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -533,4 +535,17 @@ extends AbstractExcelExporter
|
||||||
}
|
}
|
||||||
return super.isVisible(row, col);
|
return super.isVisible(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisplayed(int row, int col)
|
||||||
|
{
|
||||||
|
if (m_printData.getRowIndex() != row)
|
||||||
|
m_printData.setRowIndex(row);
|
||||||
|
|
||||||
|
MPrintFormatItem item = m_printFormat.getItem(col);
|
||||||
|
if (Util.isEmpty(item.getDisplayLogic()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return Evaluator.evaluateLogic(new PrintDataEvaluatee(null, m_printData), item.getDisplayLogic());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,9 @@ import org.compiere.print.MPrintFormatItem;
|
||||||
import org.compiere.print.MPrintPaper;
|
import org.compiere.print.MPrintPaper;
|
||||||
import org.compiere.print.PrintData;
|
import org.compiere.print.PrintData;
|
||||||
import org.compiere.print.PrintDataElement;
|
import org.compiere.print.PrintDataElement;
|
||||||
|
import org.compiere.print.layout.PrintDataEvaluatee;
|
||||||
|
import org.compiere.util.Evaluator;
|
||||||
|
import org.compiere.util.Util;
|
||||||
/**
|
/**
|
||||||
* Export PrintData to Excel (XLSX) file
|
* Export PrintData to Excel (XLSX) file
|
||||||
*
|
*
|
||||||
|
@ -213,4 +215,18 @@ public class PrintDataXLSXExporter extends AbstractXLSXExporter
|
||||||
sheet.setMargin(HSSFSheet.LeftMargin, ((double) paper.getMarginLeft()) / 72);
|
sheet.setMargin(HSSFSheet.LeftMargin, ((double) paper.getMarginLeft()) / 72);
|
||||||
sheet.setMargin(HSSFSheet.BottomMargin, ((double) paper.getMarginBottom()) / 72);
|
sheet.setMargin(HSSFSheet.BottomMargin, ((double) paper.getMarginBottom()) / 72);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisplayed(int row, int col)
|
||||||
|
{
|
||||||
|
if (m_printData.getRowIndex() != row)
|
||||||
|
m_printData.setRowIndex(row);
|
||||||
|
|
||||||
|
MPrintFormatItem item = m_printFormat.getItem(col);
|
||||||
|
if ( Util.isEmpty(item.getDisplayLogic()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return Evaluator.evaluateLogic(new PrintDataEvaluatee(null, m_printData), item.getDisplayLogic());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,12 +91,14 @@ import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.PrintInfo;
|
import org.compiere.model.PrintInfo;
|
||||||
import org.compiere.print.layout.LayoutEngine;
|
import org.compiere.print.layout.LayoutEngine;
|
||||||
|
import org.compiere.print.layout.PrintDataEvaluatee;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.process.ServerProcessCtl;
|
import org.compiere.process.ServerProcessCtl;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Evaluator;
|
||||||
import org.compiere.util.Ini;
|
import org.compiere.util.Ini;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -847,7 +849,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
td td = new td();
|
td td = new td();
|
||||||
tr.addElement(td);
|
tr.addElement(td);
|
||||||
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||||
if (obj == null){
|
if (obj == null || !isDisplayPFItem(item)){
|
||||||
td.addElement(" ");
|
td.addElement(" ");
|
||||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||||
preValues[printColIndex] = null;
|
preValues[printColIndex] = null;
|
||||||
|
@ -1064,7 +1066,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
printColIndex++;
|
printColIndex++;
|
||||||
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||||
String data = "";
|
String data = "";
|
||||||
if (obj == null){
|
if (obj == null || !isDisplayPFItem(item)){
|
||||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||||
preValues[printColIndex] = null;
|
preValues[printColIndex] = null;
|
||||||
}
|
}
|
||||||
|
@ -2392,4 +2394,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isDisplayPFItem(MPrintFormatItem item)
|
||||||
|
{
|
||||||
|
if(Util.isEmpty(item.getDisplayLogic()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return Evaluator.evaluateLogic(new PrintDataEvaluatee(null, m_printData), item.getDisplayLogic());
|
||||||
|
}
|
||||||
|
|
||||||
} // ReportEngine
|
} // ReportEngine
|
||||||
|
|
|
@ -78,4 +78,10 @@ extends AbstractExcelExporter
|
||||||
protected int getCurrentRow() {
|
protected int getCurrentRow() {
|
||||||
return m_currentRow;
|
return m_currentRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisplayed(int row, int col)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2708,5 +2708,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDisplayed(int row, int col)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue