FR [ 2804629 ] AbstractExcelExporter getters should be public

https://sourceforge.net/tracker/?func=detail&aid=2804629&group_id=176962&atid=879335
This commit is contained in:
teo_sarca 2009-06-11 06:57:15 +00:00
parent ecf839802b
commit 98832daff2
5 changed files with 93 additions and 41 deletions

View File

@ -50,18 +50,70 @@ import org.compiere.util.Util;
*/
public abstract class AbstractExcelExporter
{
protected abstract boolean isFunctionRow();
protected abstract int getColumnCount();
protected abstract int getRowCount();
/**
* Is the current Row a Function Row
* @return true if function row
*/
public abstract boolean isFunctionRow();
/**
* Get Columns Count
* @return number of columns
*/
public abstract int getColumnCount();
/**
* Get Rows Count
* @return number of rows
*/
public abstract int getRowCount();
/**
* Set current row
* @param row row index
*/
protected abstract void setCurrentRow(int row);
protected abstract boolean isColumnPrinted(int col);
protected abstract String getHeaderName(int col);
protected abstract int getDisplayType(int row, int col);
protected abstract Object getValueAt(int row, int col);
protected abstract boolean isPageBreak(int row, int col);
/**
* Check if column is printed (displayed)
* @param col column index
* @return true if is visible
*/
public abstract boolean isColumnPrinted(int col);
/**
* Get column header name
* @param col column index
* @return header name
*/
public abstract String getHeaderName(int col);
/**
* Get cell display type (see {@link DisplayType})
* @param row row index
* @param col column index
* @return display type
*/
public abstract int getDisplayType(int row, int col);
/**
* Get cell value
* @param row row index
* @param col column index
* @return cell value
*/
public abstract Object getValueAt(int row, int col);
/**
* Check if there is a page break on given cell
* @param row row index
* @param col column index
* @return true if there is a page break
*/
public abstract boolean isPageBreak(int row, int col);
/** Logger */
protected CLogger log = CLogger.getCLogger(getClass());
protected final CLogger log = CLogger.getCLogger(getClass());
//
private HSSFWorkbook m_workbook;
private HSSFDataFormat m_dataFormat;

View File

@ -42,12 +42,12 @@ public class ArrayExcelExporter extends AbstractExcelExporter {
}
@Override
protected int getColumnCount() {
public int getColumnCount() {
return m_data.get(0).size();
}
@Override
protected int getDisplayType(int row, int col) {
public int getDisplayType(int row, int col) {
ArrayList<Object> dataRow = m_data.get(row+1);
Object value = dataRow.get(col);
if (value == null)
@ -74,7 +74,7 @@ public class ArrayExcelExporter extends AbstractExcelExporter {
}
@Override
protected String getHeaderName(int col) {
public String getHeaderName(int col) {
Object o = m_data.get(0).get(col);
String name = o != null ? o.toString() : null;
String nameTrl = Msg.translate(getLanguage(), name);
@ -84,29 +84,29 @@ public class ArrayExcelExporter extends AbstractExcelExporter {
}
@Override
protected int getRowCount() {
public int getRowCount() {
return m_data.size() - 1;
}
@Override
protected Object getValueAt(int row, int col) {
public Object getValueAt(int row, int col) {
ArrayList<Object> dataRow = m_data.get(row+1);
Object value = dataRow.get(col);
return value;
}
@Override
protected boolean isColumnPrinted(int col) {
public boolean isColumnPrinted(int col) {
return true;
}
@Override
protected boolean isFunctionRow() {
public boolean isFunctionRow() {
return false;
}
@Override
protected boolean isPageBreak(int row, int col) {
public boolean isPageBreak(int row, int col) {
return false;
}

View File

@ -40,31 +40,31 @@ public class GridTabExcelExporter extends AbstractExcelExporter
}
@Override
protected int getColumnCount()
public int getColumnCount()
{
return m_tab.getFieldCount();
}
@Override
protected int getDisplayType(int row, int col)
public int getDisplayType(int row, int col)
{
return m_tab.getField(col).getDisplayType();
}
@Override
protected String getHeaderName(int col)
public String getHeaderName(int col)
{
return m_tab.getField(col).getHeader();
}
@Override
protected int getRowCount()
public int getRowCount()
{
return m_tab.getRowCount();
}
@Override
protected Object getValueAt(int row, int col)
public Object getValueAt(int row, int col)
{
GridField f = m_tab.getField(col);
Object key = m_tab.getValue(row, f.getColumnName());
@ -87,7 +87,7 @@ public class GridTabExcelExporter extends AbstractExcelExporter
}
@Override
protected boolean isColumnPrinted(int col)
public boolean isColumnPrinted(int col)
{
GridField f = m_tab.getField(col);
// Hide not displayed fields
@ -103,13 +103,13 @@ public class GridTabExcelExporter extends AbstractExcelExporter
}
@Override
protected boolean isFunctionRow()
public boolean isFunctionRow()
{
return false;
}
@Override
protected boolean isPageBreak(int row, int col)
public boolean isPageBreak(int row, int col)
{
return false;
}

View File

@ -46,7 +46,7 @@ extends AbstractExcelExporter
}
@Override
protected int getColumnCount() {
public int getColumnCount() {
return m_printFormat.getItemCount();
}
@ -65,7 +65,7 @@ extends AbstractExcelExporter
return null;
}
@Override
protected int getDisplayType(int row, int col) {
public int getDisplayType(int row, int col) {
PrintDataElement pde = getPDE(row, col);
if (pde != null) {
return pde.getDisplayType();
@ -75,7 +75,7 @@ extends AbstractExcelExporter
}
@Override
protected Object getValueAt(int row, int col) {
public Object getValueAt(int row, int col) {
PrintDataElement pde = getPDE(row, col);
Object value = null;
if (pde == null)
@ -107,23 +107,23 @@ extends AbstractExcelExporter
}
@Override
protected String getHeaderName(int col) {
public String getHeaderName(int col) {
return m_printFormat.getItem(col).getPrintName(getLanguage());
}
@Override
protected int getRowCount() {
public int getRowCount() {
return m_printData.getRowCount();
}
@Override
protected boolean isColumnPrinted(int col) {
public boolean isColumnPrinted(int col) {
MPrintFormatItem item = m_printFormat.getItem(col);
return item.isPrinted();
}
@Override
protected boolean isPageBreak(int row, int col) {
public boolean isPageBreak(int row, int col) {
PrintDataElement pde = getPDE(row, col);
return pde != null ? pde.isPageBreak() : false;
}
@ -134,7 +134,7 @@ extends AbstractExcelExporter
}
@Override
protected boolean isFunctionRow() {
public boolean isFunctionRow() {
return m_printData.isFunctionRow();
}

View File

@ -31,42 +31,42 @@ extends AbstractExcelExporter
}
@Override
protected int getColumnCount() {
public int getColumnCount() {
return m_model.getColumnCount();
}
@Override
protected int getDisplayType(int row, int col) {
public int getDisplayType(int row, int col) {
return m_model.getRColumn(col).getDisplayType();
}
@Override
protected String getHeaderName(int col) {
public String getHeaderName(int col) {
return m_model.getRColumn(col).getColHeader();
}
@Override
protected int getRowCount() {
public int getRowCount() {
return m_model.getRowCount();
}
@Override
protected Object getValueAt(int row, int col) {
public Object getValueAt(int row, int col) {
return m_model.getValueAt(row, col);
}
@Override
protected boolean isColumnPrinted(int col) {
public boolean isColumnPrinted(int col) {
return true;
}
@Override
protected boolean isFunctionRow() {
public boolean isFunctionRow() {
return m_model.isGroupRow(m_currentRow);
}
@Override
protected boolean isPageBreak(int row, int col) {
public boolean isPageBreak(int row, int col) {
return false;
}