info.informatica.report
Class ReportWriter

java.lang.Object
  extended by info.informatica.report.ReportWriter
Direct Known Subclasses:
PdfReportWriter, TextReportWriter

public abstract class ReportWriter
extends Object

Controls the writing of a report.

Each time a report is printed, a new ReportWriter is created.

Version:
1.04
Author:
amengual at informatica dot info

Method Summary
abstract  void close()
          Closes the report destination file.
abstract  TablePrinter createTablePrinter(AbstractTableBlock table)
           
abstract  void embedNativeObject(Object rendered)
          Embeds in the document a rendered block.
abstract  void embedText(info.informatica.doc.dom4j.CSSStylableElement peer, String text)
          Embeds a text fragment, generally a paragraph.
abstract  void open(OutputStream out)
          Opens the destination file.
 void print(Map<String,? extends Object> data)
          Print the document.
 void print(ReportDataSource data)
          Print the report.
 void printNested(Block nested, Dataset ds)
          Prints a nested block.
 Block wrapBlock(Block block)
          Wrap generic blocks with document-specific ones.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

print

public void print(ReportDataSource data)
           throws info.informatica.doc.RenderingException,
                  DatasetException
Print the report.

Remember to first open the output stream!

Parameters:
data - the ReportDataSource
Throws:
info.informatica.doc.RenderingException - if a problem occurred when rendering the report.
DatasetException - if there was a problem using the data.
NullPointerException - if data source is null.

print

public void print(Map<String,? extends Object> data)
           throws info.informatica.doc.RenderingException
Print the document.

Remember to first open the output stream!

Parameters:
data - the spec_id-variable map.
Throws:
info.informatica.doc.RenderingException - if a problem occurred when rendering the report.
NullPointerException - if data is null.

wrapBlock

public Block wrapBlock(Block block)
Wrap generic blocks with document-specific ones.

The resulting native block must implement the same rendering interface as the generic block.

Parameters:
block - a generic block.
Returns:
the document-specific block associated to the generic block, or the same generic block if no specific block was found.

printNested

public void printNested(Block nested,
                        Dataset ds)
                 throws info.informatica.doc.RenderingException,
                        DatasetException
Prints a nested block.

Dynamic blocks that allow nested blocks must call this method for each row.

Throws:
info.informatica.doc.RenderingException
DatasetException

open

public abstract void open(OutputStream out)
                   throws info.informatica.doc.RenderingException
Opens the destination file.

Parameters:
out - an OutputStream used to write the report document.
Throws:
info.informatica.doc.RenderingException - in case of problem preparing for opening the report document.
IllegalStateException - if called twice.

close

public abstract void close()
Closes the report destination file.


embedNativeObject

public abstract void embedNativeObject(Object rendered)
                                throws info.informatica.doc.RenderingException
Embeds in the document a rendered block.

Parameters:
rendered - a document-specific Object representation of the block. For example, if it is a PDF block it must be a PDF element.
Throws:
info.informatica.doc.RenderingException - if a problem occurred when embedding the object.

embedText

public abstract void embedText(info.informatica.doc.dom4j.CSSStylableElement peer,
                               String text)
                        throws info.informatica.doc.RenderingException
Embeds a text fragment, generally a paragraph.

This method allows to reuse all the text blocks in non-text reports without having to write report-specific wrappers for each report type.

Parameters:
peer - the formatting peer that should be used to format the the text.
text - the text to embed into the document.
Throws:
info.informatica.doc.RenderingException - if a problem occurred when embedding the text.

createTablePrinter

public abstract TablePrinter createTablePrinter(AbstractTableBlock table)