org.jacoco.report.html
Class SourceFilePage

java.lang.Object
  extended by org.jacoco.report.html.ReportPage
      extended by org.jacoco.report.html.SourceFilePage
All Implemented Interfaces:
ICoverageTableItem, IReportVisitor

public class SourceFilePage
extends ReportPage

Page showing the content of a source file with numbered and highlighted source lines.

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

Field Summary
 
Fields inherited from class org.jacoco.report.html.ReportPage
context, outputFolder
 
Constructor Summary
SourceFilePage(ICoverageNode node, ReportPage parent, ReportOutputFolder outputFolder, IHTMLReportContext context)
          Creates a new visitor in the given context.
 
Method Summary
protected  void body(HTMLElement body, ISourceFileLocator sourceFileLocator)
          Renders the content of the body element.
protected  void content(HTMLElement body, ISourceFileLocator sourceFileLocator)
          Creates the actual content of the page.
 boolean exists()
          Checks whether this page has actually been rendered.
protected  String getFileName()
          Specifies the local file name of this page.
protected  ReportOutputFolder getFolder(ReportOutputFolder base)
          Creates the output folder relative to the given base for this report page.
protected  void head(HTMLElement head)
          Fills the content of the 'head' element.
 IReportVisitor visitChild(ICoverageNode node)
          Called for every direct child.
 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 org.jacoco.report.html.ReportPage
footer, getLabel, getLink, getNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceFilePage

public SourceFilePage(ICoverageNode node,
                      ReportPage parent,
                      ReportOutputFolder outputFolder,
                      IHTMLReportContext context)
Creates a new visitor in the given context.

Parameters:
node -
parent -
outputFolder -
context -
Method Detail

visitChild

public IReportVisitor visitChild(ICoverageNode node)
Description copied from interface: IReportVisitor
Called for every direct child.

Parameters:
node - Node for the child in the implementation class specific to this type. The counters are may yet be populated.
Returns:
visitor instance for processing the child node

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
Overrides:
visitEnd in class ReportPage
Parameters:
sourceFileLocator - source file locator valid for this node
Throws:
IOException - in case of IO problems with the report writer

content

protected void content(HTMLElement body,
                       ISourceFileLocator sourceFileLocator)
                throws IOException
Description copied from class: ReportPage
Creates the actual content of the page.

Specified by:
content in class ReportPage
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

head

protected void head(HTMLElement head)
             throws IOException
Description copied from class: ReportPage
Fills the content of the 'head' element.

Overrides:
head in class ReportPage
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
Description copied from class: ReportPage
Renders the content of the body element.

Overrides:
body in class ReportPage
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

getFileName

protected String getFileName()
Description copied from class: ReportPage
Specifies the local file name of this page.

Specified by:
getFileName in class ReportPage
Returns:
local file name

getFolder

protected ReportOutputFolder getFolder(ReportOutputFolder base)
Description copied from class: ReportPage
Creates the output folder relative to the given base for this report page. The method may decide to simply return the base folder itself.

Specified by:
getFolder in class ReportPage
Parameters:
base - base folder
Returns:
folder to create this page in

exists

public boolean exists()
Checks whether this page has actually been rendered. This might not be the case if no source file has been found.

Returns:
whether the page has been created