use of org.pentaho.reporting.engine.classic.core.modules.output.table.html.HtmlPrinter in project pentaho-platform by pentaho.
the class JFreeReportZipHtmlComponent method performExport.
@Override
protected boolean performExport(final MasterReport report, final OutputStream outputStream) {
try {
String dataDirectory = getInputStringValue(AbstractJFreeReportComponent.REPORTDIRECTORYHTML_DATADIR);
if (dataDirectory == null) {
// $NON-NLS-1$
dataDirectory = "data";
}
final ZipRepository zipRepository = new ZipRepository();
final ContentLocation root = zipRepository.getRoot();
final ContentLocation data = // $NON-NLS-1$
RepositoryUtilities.createLocation(zipRepository, RepositoryUtilities.split(dataDirectory, "/"));
final FlowHtmlOutputProcessor outputProcessor = new FlowHtmlOutputProcessor();
final HtmlPrinter printer = new AllItemsHtmlPrinter(report.getResourceManager());
// $NON-NLS-1$
printer.setContentWriter(root, new DefaultNameGenerator(root, "report.html"));
// $NON-NLS-1$
printer.setDataWriter(data, new DefaultNameGenerator(data, "content"));
printer.setUrlRewriter(new SingleRepositoryURLRewriter());
outputProcessor.setPrinter(printer);
final FlowReportProcessor sp = new FlowReportProcessor(report, outputProcessor);
final int yieldRate = getYieldRate();
if (yieldRate > 0) {
sp.addReportProgressListener(new YieldReportListener(yieldRate));
}
sp.processReport();
zipRepository.write(outputStream);
close();
return true;
} catch (ReportProcessingException e) {
// $NON-NLS-1$
error(Messages.getInstance().getString("JFreeReportZipHtmlComponent.ERROR_0046_FAILED_TO_PROCESS_REPORT"), e);
return false;
} catch (IOException e) {
// $NON-NLS-1$
error(Messages.getInstance().getString("JFreeReportZipHtmlComponent.ERROR_0046_FAILED_TO_PROCESS_REPORT"), e);
return false;
} catch (ContentIOException e) {
// $NON-NLS-1$
error(Messages.getInstance().getString("JFreeReportZipHtmlComponent.ERROR_0046_FAILED_TO_PROCESS_REPORT"), e);
return false;
}
}
Aggregations