IDEMPIERE-2479:Printformat, Surpress Repeats doesnt works for HTML and XLS

for html
This commit is contained in:
hieplq 2015-07-05 15:11:14 +07:00
parent 3715043994
commit 87ca88e18a
2 changed files with 24 additions and 2 deletions

View File

@ -628,6 +628,9 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
thead thead = new thead(); thead thead = new thead();
tbody tbody = new tbody(); tbody tbody = new tbody();
Object [] preValues = new Object [m_layout.colSuppressRepeats.length];
int printColIndex = -1;
// for all rows (-1 = header row) // for all rows (-1 = header row)
for (int row = -1; row < m_printData.getRowCount(); row++) for (int row = -1; row < m_printData.getRowCount(); row++)
{ {
@ -650,12 +653,15 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
// add row to table header // add row to table header
thead.addElement(tr); thead.addElement(tr);
} }
printColIndex = -1;
// for all columns // for all columns
for (int col = 0; col < m_printFormat.getItemCount(); col++) for (int col = 0; col < m_printFormat.getItemCount(); col++)
{ {
MPrintFormatItem item = m_printFormat.getItem(col); MPrintFormatItem item = m_printFormat.getItem(col);
if (item.isPrinted()) if (item.isPrinted())
{ {
printColIndex++;
// header row // header row
if (row == -1) if (row == -1)
{ {
@ -679,12 +685,26 @@ 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(new Integer(item.getAD_Column_ID())); Object obj = m_printData.getNode(new Integer(item.getAD_Column_ID()));
if (obj == null) if (obj == null){
td.addElement("&nbsp;"); td.addElement("&nbsp;");
if (m_layout.colSuppressRepeats[printColIndex]){
preValues[col] = null;
}
}
else if (obj instanceof PrintDataElement) else if (obj instanceof PrintDataElement)
{ {
PrintDataElement pde = (PrintDataElement) obj; PrintDataElement pde = (PrintDataElement) obj;
String value = pde.getValueDisplay(language); // formatted String value = pde.getValueDisplay(language); // formatted
if (m_layout.colSuppressRepeats[printColIndex]){
if (value.equals(preValues[printColIndex])){
td.addElement("&nbsp;");
continue;
}else{
preValues[printColIndex] = value;
}
}
if (pde.getColumnName().endsWith("_ID") && extension != null && !isExport) if (pde.getColumnName().endsWith("_ID") && extension != null && !isExport)
{ {
boolean isZoom = false; boolean isZoom = false;

View File

@ -225,6 +225,8 @@ public class LayoutEngine implements Pageable, Printable, Doc
/** Image Size */ /** Image Size */
public static Dimension IMAGE_SIZE = new Dimension(10,10); public static Dimension IMAGE_SIZE = new Dimension(10,10);
public boolean[] colSuppressRepeats;
static { static {
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
URL url = LayoutEngine.class.getResource("true10.gif"); URL url = LayoutEngine.class.getResource("true10.gif");
@ -1603,7 +1605,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
int[] columnMaxWidth = new int[columnCount]; int[] columnMaxWidth = new int[columnCount];
int[] columnMaxHeight = new int[columnCount]; int[] columnMaxHeight = new int[columnCount];
boolean[] fixedWidth = new boolean [columnCount]; boolean[] fixedWidth = new boolean [columnCount];
boolean[] colSuppressRepeats = new boolean[columnCount]; colSuppressRepeats = new boolean[columnCount];
String[] columnJustification = new String[columnCount]; String[] columnJustification = new String[columnCount];
HashMap<Integer,Integer> additionalLines = new HashMap<Integer,Integer>(); HashMap<Integer,Integer> additionalLines = new HashMap<Integer,Integer>();