org.jacoco.report.html
Class ReportPage

java.lang.Object
  extended by org.jacoco.report.html.ReportPage
All Implemented Interfaces:
ICoverageTableItem, IReportVisitor
Direct Known Subclasses:
ClassPage, GroupPage, PackagePage, SourceFilePage

public abstract class ReportPage
extends Object
implements IReportVisitor, ICoverageTableItem

Base class for HTML page generators. It renders the page skeleton with the breadcrumb, the title and the footer.

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

Field Summary
protected  IHTMLReportContext context
          context for this report
protected  ReportOutputFolder outputFolder
          output folder for this node
 
Fields inherited from interface org.jacoco.report.IReportVisitor
NOP
 
Constructor Summary
protected ReportPage(ICoverageNode node, ReportPage parent, ReportOutputFolder baseFolder, IHTMLReportContext context)
          Creates a new report page.
 
Method Summary
protected  void body(HTMLElement body, ISourceFileLocator sourceFileLocator)
          Renders the content of the body element.
protected abstract  void content(HTMLElement body, ISourceFileLocator sourceFileLocator)
          Creates the actual content of the page.
protected  void footer(HTMLElement body)
          Renders the page footer.
protected abstract  String getFileName()
          Specifies the local file name of this page.
protected abstract  ReportOutputFolder getFolder(ReportOutputFolder base)
          Creates the output folder relative to the given base for this report page.
 String getLabel()
          Returns the display name of the item.
 String getLink(ReportOutputFolder base)
          Returns an optional link that the item will be linked to.
 ICoverageNode getNode()
          Returns the corresponding node data.
protected  void head(HTMLElement head)
          Fills the content of the 'head' element.
 void visitEnd(ISourceFileLocator sourceFileLocator)
          Called at the very end, when all child node have been processed and the counters for this node are properly populated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jacoco.report.IReportVisitor
visitChild
 

Field Detail

outputFolder

protected final ReportOutputFolder outputFolder
output folder for this node


context

protected final IHTMLReportContext context
context for this report

Constructor Detail

ReportPage

protected ReportPage(ICoverageNode node,
                     ReportPage parent,
                     ReportOutputFolder baseFolder,
                     IHTMLReportContext context)
Creates a new report page.

Parameters:
node - corresponding node
parent - optional hierarchical parent
baseFolder - base folder to create this report page relative to
context - settings context
Method Detail

visitEnd

public void visitEnd(ISourceFileLocator sourceFileLocator)
              throws IOException
Description copied from interface: IReportVisitor
Called at the very end, when all child node have been processed and the counters for this node are properly populated.

Specified by:
visitEnd in interface IReportVisitor
Parameters:
sourceFileLocator - source file locator valid for this node
Throws:
IOException - in case of IO problems with the report writer

head

protected void head(HTMLElement head)
             throws IOException
Fills the content of the 'head' element.

Parameters:
head - enclosing head element
Throws:
IOException - in case of IO problems with the report writer

body

protected void body(HTMLElement body,
                    ISourceFileLocator sourceFileLocator)
             throws IOException
Renders the content of the body element.

Parameters:
body - enclosing body element
sourceFileLocator - locator for source file content in this context
Throws:
IOException - in case of IO problems with the report writer

content

protected abstract void content(HTMLElement body,
                                ISourceFileLocator sourceFileLocator)
                         throws IOException
Creates the actual content of the page.

Parameters:
body - body tag of the page
sourceFileLocator - locator for source file content in this context
Throws:
IOException - in case of IO problems with the report writer

footer

protected void footer(HTMLElement body)
               throws IOException
Renders the page footer.

Parameters:
body - enclosing body element
Throws:
IOException - in case of IO problems with the report writer

getFileName

protected abstract String getFileName()
Specifies the local file name of this page.

Returns:
local file name

getFolder

protected abstract ReportOutputFolder getFolder(ReportOutputFolder base)
Creates the output folder relative to the given base for this report page. The method may decide to simply return the base folder itself.

Parameters:
base - base folder
Returns:
folder to create this page in

getLabel

public String getLabel()
Description copied from interface: ICoverageTableItem
Returns the display name of the item. This might be different from the node name.

Specified by:
getLabel in interface ICoverageTableItem
Returns:
display name of the item

getNode

public ICoverageNode getNode()
Description copied from interface: ICoverageTableItem
Returns the corresponding node data.

Specified by:
getNode in interface ICoverageTableItem
Returns:
node data

getLink

public final String getLink(ReportOutputFolder base)
Description copied from interface: ICoverageTableItem
Returns an optional link that the item will be linked to.

Specified by:
getLink in interface ICoverageTableItem
Parameters:
base - base folder from where the link is created
Returns:
relative link or null if the item has no link