1003454 Large reports slow, throwing errors. Reduce memory usage for generation of html output.

This commit is contained in:
Heng Sin Low 2013-11-19 23:54:37 +08:00
parent 84b78846fc
commit 439e3e453a
1 changed files with 31 additions and 21 deletions

View File

@ -560,11 +560,35 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
if (cssPrefix != null) if (cssPrefix != null)
table.setClass(cssPrefix + "-table"); table.setClass(cssPrefix + "-table");
// //
//
table.setNeedClosingTag(false);
PrintWriter w = new PrintWriter(writer);
if (onlyTable)
table.output(w);
else
{
XhtmlDocument doc = new XhtmlDocument();
doc.getHtml().setNeedClosingTag(false);
doc.getBody().setNeedClosingTag(false);
doc.appendBody(table);
if (extension != null && extension.getStyleURL() != null)
{
link l = new link(extension.getStyleURL(), "stylesheet", "text/css");
doc.appendHead(l);
}
if (extension != null && extension.getScriptURL() != null)
{
script jslink = new script();
jslink.setLanguage("javascript");
jslink.setSrc(extension.getScriptURL());
doc.appendHead(jslink);
}
doc.output(w);
}
// 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++)
{ {
tr tr = new tr(); tr tr = new tr();
table.addElement(tr);
if (row != -1) if (row != -1)
{ {
m_printData.setRowIndex(row); m_printData.setRowIndex(row);
@ -693,29 +717,15 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount)
} }
} // printed } // printed
} // for all columns } // for all columns
tr.output(w);
} // for all rows } // for all rows
// w.println();
PrintWriter w = new PrintWriter(writer); w.println("</table>");
if (onlyTable) if (!onlyTable)
table.output(w);
else
{ {
XhtmlDocument doc = new XhtmlDocument(); w.println("</body>");
doc.appendBody(table); w.println("</html>");
if (extension != null && extension.getStyleURL() != null)
{
link l = new link(extension.getStyleURL(), "stylesheet", "text/css");
doc.appendHead(l);
}
if (extension != null && extension.getScriptURL() != null)
{
script jslink = new script();
jslink.setLanguage("javascript");
jslink.setSrc(extension.getScriptURL());
doc.appendHead(jslink);
}
doc.output(w);
} }
w.flush(); w.flush();
w.close(); w.close();