org.jacoco.report.html
Class ReportPage

java.lang.Object
  extended by org.jacoco.report.html.ReportPage
All Implemented Interfaces:
ILinkable
Direct Known Subclasses:
NodePage, SessionsPage

public abstract class ReportPage
extends Object
implements ILinkable

Base class for HTML page generators. It renders the page skeleton with the breadcrumb, the title and the footer. Every report page is part of a hierarchy and has a parent page (except the root page).

Version:
0.4.1.20101007204400
Author:
Marc R. Hoffmann

Field Summary
protected  IHTMLReportContext context
          context for this report
protected  ReportOutputFolder folder
          output folder for this node
 
Constructor Summary
protected ReportPage(ReportPage parent, ReportOutputFolder folder, IHTMLReportContext context)
          Creates a new report page.
 
Method Summary
protected abstract  void content(HTMLElement body)
          Creates the actual content of the page.
protected abstract  String getFileName()
          Specifies the local file name of this page.
 String getLink(ReportOutputFolder base)
          Returns a relative link to the item that works from the given base folder.
protected  String getOnload()
          Returns the onload handler for this page.
protected  void headExtra(HTMLElement head)
          Hook to add extra content into the head tag.
 void renderDocument()
          Renders the page content.
 
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.html.ILinkable
getLinkLabel, getLinkStyle
 

Field Detail

folder

protected final ReportOutputFolder folder
output folder for this node


context

protected final IHTMLReportContext context
context for this report

Constructor Detail

ReportPage

protected ReportPage(ReportPage parent,
                     ReportOutputFolder folder,
                     IHTMLReportContext context)
Creates a new report page.

Parameters:
parent - optional hierarchical parent
folder - base folder to create this report in
context - settings context
Method Detail

renderDocument

public final void renderDocument()
                          throws IOException
Renders the page content. This method must be called at most once.

Throws:
IOException

headExtra

protected void headExtra(HTMLElement head)
                  throws IOException
Hook to add extra content into the head tag.

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

getOnload

protected String getOnload()
Returns the onload handler for this page.

Returns:
handler or null

getFileName

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

Returns:
local file name

content

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

Parameters:
body - body tag of the page
Throws:
IOException - in case of IO problems with the report writer

getLink

public final String getLink(ReportOutputFolder base)
Description copied from interface: ILinkable
Returns a relative link to the item that works from the given base folder.

Specified by:
getLink in interface ILinkable
Parameters:
base - folder where the link should be inserted
Returns:
relative link or null if the target does not exist