{
String cssPrefix = extension != null ? extension.getClassPrefix() : null;
if (cssPrefix != null && cssPrefix.trim().length() == 0)
cssPrefix = null;
table table = new table();
if (cssPrefix != null)
table.setClass(cssPrefix + "-table");
//
// for all rows (-1 = header row)
for (int row = -1; row < m_printData.getRowCount(); row++)
{
tr tr = new tr();
table.addElement(tr);
if (row != -1)
{
m_printData.setRowIndex(row);
if (extension != null)
{
extension.extendRowElement(tr, m_printData);
}
}
// for all columns
for (int col = 0; col < m_printFormat.getItemCount(); col++)
{
MPrintFormatItem item = m_printFormat.getItem(col);
if (item.isPrinted())
{
// header row
if (row == -1)
{
th th = new th();
tr.addElement(th);
th.addElement(Util.maskHTML(item.getPrintName(language)));
}
else
{
td td = new td();
tr.addElement(td);
Object obj = m_printData.getNode(new Integer(item.getAD_Column_ID()));
if (obj == null)
td.addElement(" ");
else if (obj instanceof PrintDataElement)
{
PrintDataElement pde = (PrintDataElement) obj;
String value = pde.getValueDisplay(language); // formatted
if (pde.getColumnName().endsWith("_ID") && extension != null)
{
//link for column
a href = new a("javascript:void(0)");
href.setID(pde.getColumnName() + "_" + row + "_a");
td.addElement(href);
href.addElement(Util.maskHTML(value));
if (cssPrefix != null)
href.setClass(cssPrefix + "-href");
extension.extendIDColumn(row, td, href, pde);
}
else
{
td.addElement(Util.maskHTML(value));
}
if (cssPrefix != null)
{
if (DisplayType.isNumeric(pde.getDisplayType()))
td.setClass(cssPrefix + "-number");
else if (DisplayType.isDate(pde.getDisplayType()))
td.setClass(cssPrefix + "-date");
else
td.setClass(cssPrefix + "-text");
}
}
else if (obj instanceof PrintData)
{
// ignore contained Data
}
else
log.log(Level.SEVERE, "Element not PrintData(Element) " + obj.getClass());
}
} // printed
} // for all columns
} // for all rows
//
PrintWriter w = new PrintWriter(writer);
if (onlyTable)
table.output(w);
else
{
XhtmlDocument doc = new XhtmlDocument();
doc.appendBody(table);
if (extension.getStyleURL() != null)