info.informatica.report.block
Class DefaultTemplateBlock

java.lang.Object
  extended by info.informatica.report.block.AbstractBlock
      extended by info.informatica.report.block.DefaultTemplateBlock
All Implemented Interfaces:
Block, MapBlock, TemplateBlock

public class DefaultTemplateBlock
extends AbstractBlock
implements TemplateBlock, MapBlock

A MapBlock that supports DataFormatter formatting.

The basic building block of the default templates.

Author:
amengual at informatica dot info

Constructor Summary
DefaultTemplateBlock(ReportElement peerElement)
           
 
Method Summary
 String format(Dataset data)
           
 String format(Map<String,? extends Object> m)
           
 DataFormatter getFormatter()
          Gets the FormatPrinter object associated to this block.
 void init()
          Arranges the block for printing.
 void print(ReportWriter rw, Map<String,? extends Object> m)
           
 void printSample(ReportWriter rw)
          Print a sample of this block.
 void setTemplate(String templateText)
           
 
Methods inherited from class info.informatica.report.block.AbstractBlock
filterChildReportElement, filterChildXHTMLElement, getCondition, getPeerElement, getReportDataSpec, getTransformParameters, isHidden, setCondition, setReportDataSpec
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTemplateBlock

public DefaultTemplateBlock(ReportElement peerElement)
Method Detail

init

public void init()
          throws info.informatica.doc.DocumentFormatException
Description copied from class: AbstractBlock
Arranges the block for printing. This method must be called before printing.

Note that blocks implementing NativeBlock must also call initRender(), after init().

This method needs to be called only once, typically before generating the data to be able to check for configuration errors.

Specified by:
init in interface Block
Specified by:
init in class AbstractBlock
Throws:
info.informatica.doc.DocumentFormatException - if is unable to initialize due to a syntax or formatting problem.

setTemplate

public void setTemplate(String templateText)
                 throws info.informatica.doc.DocumentFormatException
Specified by:
setTemplate in interface TemplateBlock
Throws:
info.informatica.doc.DocumentFormatException

format

public String format(Map<String,? extends Object> m)
Specified by:
format in interface TemplateBlock

format

public String format(Dataset data)
              throws DatasetException
Specified by:
format in interface TemplateBlock
Throws:
DatasetException

getFormatter

public DataFormatter getFormatter()
Gets the FormatPrinter object associated to this block.

Returns:
the FormatPrinter object associated to this block.

print

public void print(ReportWriter rw,
                  Map<String,? extends Object> m)
           throws info.informatica.doc.RenderingException
Specified by:
print in interface MapBlock
Throws:
info.informatica.doc.RenderingException

printSample

public void printSample(ReportWriter rw)
                 throws info.informatica.doc.RenderingException
Description copied from interface: Block
Print a sample of this block. This operation is optional.

Specified by:
printSample in interface Block
Overrides:
printSample in class AbstractBlock
Parameters:
rw - the ReportWriter to write to.
Throws:
info.informatica.doc.RenderingException - if cannot render the sample.