Package org.jacoco.report.html
Class HTMLFormatter
- java.lang.Object
-
- org.jacoco.report.html.HTMLFormatter
-
- All Implemented Interfaces:
IHTMLReportContext
public class HTMLFormatter extends java.lang.Object implements IHTMLReportContext
Formatter for coverage reports in multiple HTML pages.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
footerText
private ElementIndex
index
private ILanguageNames
languageNames
private java.util.Locale
locale
private java.lang.String
outputEncoding
private Resources
resources
private SessionsPage
sessionsPage
private Table
table
-
Constructor Summary
Constructors Constructor Description HTMLFormatter()
New instance with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addMissedTotalColumns(Table table, java.lang.String label, ICoverageNode.CounterEntity entity)
private Table
createTable()
IReportVisitor
createVisitor(IMultiReportOutput output)
Creates a new visitor to write a report to the given output.java.lang.String
getFooterText()
Returns a string of textual information to include in every page footer.IIndexUpdate
getIndexUpdate()
Returns the service for index updates.ILanguageNames
getLanguageNames()
Returns the language names call-back used in this report.java.util.Locale
getLocale()
Returns the locale used to format numbers and dates.java.lang.String
getOutputEncoding()
Returns the encoding of the generated HTML documents.Resources
getResources()
Returns the static resources used in this report.ILinkable
getSessionsPage()
Returns the link to the sessions page.Table
getTable()
Returns a table for rendering coverage nodes.void
setFooterText(java.lang.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
setLocale(java.util.Locale locale)
Sets the locale used for report rendering.void
setOutputEncoding(java.lang.String outputEncoding)
Sets the encoding used for generated HTML pages.
-
-
-
Field Detail
-
languageNames
private ILanguageNames languageNames
-
locale
private java.util.Locale locale
-
footerText
private java.lang.String footerText
-
outputEncoding
private java.lang.String outputEncoding
-
resources
private Resources resources
-
index
private ElementIndex index
-
sessionsPage
private SessionsPage sessionsPage
-
table
private Table table
-
-
Method Detail
-
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
-
setLocale
public void setLocale(java.util.Locale locale)
Sets the locale used for report rendering. The current default locale is used by default.- Parameters:
locale
- locale used for report rendering
-
setFooterText
public void setFooterText(java.lang.String footerText)
Sets the optional text that should be included in every footer page.- Parameters:
footerText
- footer text
-
setOutputEncoding
public void setOutputEncoding(java.lang.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 interfaceIHTMLReportContext
- Returns:
- language names
-
getResources
public Resources getResources()
Description copied from interface:IHTMLReportContext
Returns the static resources used in this report.- Specified by:
getResources
in interfaceIHTMLReportContext
- Returns:
- static resources
-
getTable
public Table getTable()
Description copied from interface:IHTMLReportContext
Returns a table for rendering coverage nodes.- Specified by:
getTable
in interfaceIHTMLReportContext
- Returns:
- table for rendering
-
createTable
private Table createTable()
-
addMissedTotalColumns
private void addMissedTotalColumns(Table table, java.lang.String label, ICoverageNode.CounterEntity entity)
-
getFooterText
public java.lang.String getFooterText()
Description copied from interface:IHTMLReportContext
Returns a string of textual information to include in every page footer.- Specified by:
getFooterText
in interfaceIHTMLReportContext
- Returns:
- footer text or empty string
-
getSessionsPage
public ILinkable getSessionsPage()
Description copied from interface:IHTMLReportContext
Returns the link to the sessions page.- Specified by:
getSessionsPage
in interfaceIHTMLReportContext
- Returns:
- sessions page link
-
getOutputEncoding
public java.lang.String getOutputEncoding()
Description copied from interface:IHTMLReportContext
Returns the encoding of the generated HTML documents.- Specified by:
getOutputEncoding
in interfaceIHTMLReportContext
- Returns:
- encoding for generated HTML documents
-
getIndexUpdate
public IIndexUpdate getIndexUpdate()
Description copied from interface:IHTMLReportContext
Returns the service for index updates.- Specified by:
getIndexUpdate
in interfaceIHTMLReportContext
- Returns:
- sevice for indes updates
-
getLocale
public java.util.Locale getLocale()
Description copied from interface:IHTMLReportContext
Returns the locale used to format numbers and dates.- Specified by:
getLocale
in interfaceIHTMLReportContext
- Returns:
- locale for numbers and dates
-
createVisitor
public IReportVisitor createVisitor(IMultiReportOutput output) throws java.io.IOException
Creates a new visitor to write a report to the given output.- Parameters:
output
- output to write the report to- Returns:
- visitor to emit the report data to
- Throws:
java.io.IOException
- in case of problems with the output stream
-
-