org.jacoco.report.html
Class HTMLFormatter

java.lang.Object
  extended by org.jacoco.report.html.HTMLFormatter
All Implemented Interfaces:
IHTMLReportContext, IReportFormatter

public class HTMLFormatter
extends Object
implements IReportFormatter, IHTMLReportContext

Formatter for coverage reports in multiple HTML pages.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Field Summary
static Comparator<ICoverageNode> DEFAULT_SORTING
          The default sorting which is absolute not covered instructions and absolute total instructions as the second criterion.
 
Constructor Summary
HTMLFormatter()
          New instance with default settings.
 
Method Summary
 IReportVisitor createReportVisitor(ICoverageNode session)
          Creates a visitor for root of a coverage data tree.
 String getFooterText()
          Returns a string of textual information to include in every page footer.
 ILanguageNames getLanguageNames()
          Returns the language names call-back used in this report.
 String getOutputEncoding()
          Returns the encoding of the generated HTML documents.
 Resources getResources()
          Returns the static resources used in this report.
 CoverageTable getTable(ICoverageNode.ElementType type)
          Returns a table for rendering of the given type.
 void setFooterText(String footerText)
          Sets the optional text that should be included in every footer page.
 void setLanguageNames(ILanguageNames languageNames)
          Sets the implementation for language name display.
 void setOutputEncoding(String outputEncoding)
          Sets the encoding used for generated HTML pages.
 void setReportOutput(IMultiReportOutput output)
          Defines the output for files created by the formatter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SORTING

public static final Comparator<ICoverageNode> DEFAULT_SORTING
The default sorting which is absolute not covered instructions and absolute total instructions as the second criterion.

Constructor Detail

HTMLFormatter

public HTMLFormatter()
New instance with default settings.

Method Detail

setReportOutput

public void setReportOutput(IMultiReportOutput output)
Defines the output for files created by the formatter. This is a mandatory property.

Parameters:
output - file output

setLanguageNames

public void setLanguageNames(ILanguageNames languageNames)
Sets the implementation for language name display. Java language names are defined by default.

Parameters:
languageNames - converter for language specific names

setFooterText

public void setFooterText(String footerText)
Sets the optional text that should be included in every footer page.

Parameters:
footerText - footer text

setOutputEncoding

public void setOutputEncoding(String outputEncoding)
Sets the encoding used for generated HTML pages. Default is UTF-8.

Parameters:
outputEncoding - HTML output encoding

getLanguageNames

public ILanguageNames getLanguageNames()
Description copied from interface: IHTMLReportContext
Returns the language names call-back used in this report.

Specified by:
getLanguageNames in interface IHTMLReportContext
Returns:
language names

getResources

public Resources getResources()
Description copied from interface: IHTMLReportContext
Returns the static resources used in this report.

Specified by:
getResources in interface IHTMLReportContext
Returns:
static resources

getTable

public CoverageTable getTable(ICoverageNode.ElementType type)
Description copied from interface: IHTMLReportContext
Returns a table for rendering of the given type.

Specified by:
getTable in interface IHTMLReportContext
Parameters:
type - element type
Returns:
table for rendering

getFooterText

public String getFooterText()
Description copied from interface: IHTMLReportContext
Returns a string of textual information to include in every page footer.

Specified by:
getFooterText in interface IHTMLReportContext
Returns:
footer text or empty string

getOutputEncoding

public String getOutputEncoding()
Description copied from interface: IHTMLReportContext
Returns the encoding of the generated HTML documents.

Specified by:
getOutputEncoding in interface IHTMLReportContext
Returns:
encoding for generated HTML documents

createReportVisitor

public IReportVisitor createReportVisitor(ICoverageNode session)
                                   throws IOException
Description copied from interface: IReportFormatter
Creates a visitor for root of a coverage data tree.

Specified by:
createReportVisitor in interface IReportFormatter
Parameters:
session - session root node
Returns:
visitor for the root node
Throws:
IOException