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);
|
||||
|
||||
/**
|
||||
* 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 */
|
||||
protected final transient CLogger log = CLogger.getCLogger(getClass());
|
||||
//
|
||||
|
@ -497,7 +506,7 @@ public abstract class AbstractExcelExporter
|
|||
}
|
||||
|
||||
int displayType = getDisplayType(rownum, col);
|
||||
if (obj == null){
|
||||
if (obj == null || !isDisplayed(rownum, col)){
|
||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||
preValues[printColIndex] = null;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,16 @@ public abstract class AbstractXLSXExporter
|
|||
* @return true if there is a page break
|
||||
*/
|
||||
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 */
|
||||
protected final CLogger log = CLogger.getCLogger(getClass());
|
||||
//
|
||||
|
@ -457,7 +466,7 @@ public abstract class AbstractXLSXExporter
|
|||
// line row
|
||||
Object obj = getValueAt(rownum, col);
|
||||
int displayType = getDisplayType(rownum, col);
|
||||
if (obj == null)
|
||||
if (obj == null || !isDisplayed(rownum, col))
|
||||
{
|
||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex])
|
||||
{
|
||||
|
|
|
@ -117,4 +117,10 @@ public class ArrayExcelExporter extends AbstractXLSXExporter {
|
|||
protected int getCurrentRow() {
|
||||
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) {
|
||||
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.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
* Excel Exporter Adapter for GridTab
|
||||
|
@ -199,4 +198,10 @@ public class GridTabXLSXExporter extends AbstractXLSXExporter implements IGridTa
|
|||
{
|
||||
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.PrintDataElement;
|
||||
import org.compiere.print.layout.PrintDataEvaluatee;
|
||||
import org.compiere.print.layout.PrintDataEvaluatee;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Evaluator;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Evaluator;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -533,4 +535,17 @@ extends AbstractExcelExporter
|
|||
}
|
||||
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.PrintData;
|
||||
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
|
||||
*
|
||||
|
@ -213,4 +215,18 @@ public class PrintDataXLSXExporter extends AbstractXLSXExporter
|
|||
sheet.setMargin(HSSFSheet.LeftMargin, ((double) paper.getMarginLeft()) / 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.PrintInfo;
|
||||
import org.compiere.print.layout.LayoutEngine;
|
||||
import org.compiere.print.layout.PrintDataEvaluatee;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ServerProcessCtl;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Evaluator;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Msg;
|
||||
|
@ -847,7 +849,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
td td = new td();
|
||||
tr.addElement(td);
|
||||
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
if (obj == null){
|
||||
if (obj == null || !isDisplayPFItem(item)){
|
||||
td.addElement(" ");
|
||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||
preValues[printColIndex] = null;
|
||||
|
@ -1064,7 +1066,7 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
printColIndex++;
|
||||
Object obj = m_printData.getNode(Integer.valueOf(item.getAD_Column_ID()));
|
||||
String data = "";
|
||||
if (obj == null){
|
||||
if (obj == null || !isDisplayPFItem(item)){
|
||||
if (colSuppressRepeats != null && colSuppressRepeats[printColIndex]){
|
||||
preValues[printColIndex] = null;
|
||||
}
|
||||
|
@ -2391,5 +2393,13 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
|
|||
return String.format(CSS_SELECTOR_TEMPLATE, index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDisplayPFItem(MPrintFormatItem item)
|
||||
{
|
||||
if(Util.isEmpty(item.getDisplayLogic()))
|
||||
return true;
|
||||
|
||||
return Evaluator.evaluateLogic(new PrintDataEvaluatee(null, m_printData), item.getDisplayLogic());
|
||||
}
|
||||
|
||||
} // ReportEngine
|
||||
|
|
|
@ -78,4 +78,10 @@ extends AbstractExcelExporter
|
|||
protected int getCurrentRow() {
|
||||
return m_currentRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayed(int row, int col)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2707,6 +2707,12 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
public boolean isPageBreak(int row, int col)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayed(int row, int col)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue