Package org.jacoco.report.internal.html
Class HTMLElement
- java.lang.Object
-
- org.jacoco.report.internal.xml.XMLElement
-
- org.jacoco.report.internal.html.HTMLElement
-
public class HTMLElement extends XMLElement
AXMLElementwith utility methods to create XHTML documents. It provides methods of HTML tags to avoid magic strings in the generators.
-
-
Field Summary
-
Fields inherited from class org.jacoco.report.internal.xml.XMLElement
writer
-
-
Constructor Summary
Constructors Constructor Description HTMLElement(java.io.OutputStream output, java.lang.String encoding)Creates ahtmlroot element of a XHTML document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HTMLElementa(java.lang.String hrefattr)Creates a 'a' element.HTMLElementa(java.lang.String hrefattr, java.lang.String classattr)Creates a 'a' element.HTMLElementa(ILinkable linkable, ReportOutputFolder base)Creates a link to the givenILinkable.HTMLElementbody()Creates a 'body' element.HTMLElementcode()Creates a 'code' element.HTMLElementdiv(java.lang.String classattr)Creates a 'div' element.HTMLElementelement(java.lang.String name)Creates a new child element for this element.HTMLElementh1()Creates a 'h1' element.HTMLElementhead()Creates a 'head' element.voidimg(java.lang.String srcattr, int widthattr, int heightattr, java.lang.String titleattr)Creates a 'img' element.HTMLElementlink(java.lang.String relattr, java.lang.String hrefattr, java.lang.String typeattr)Creates a 'link' element.HTMLElementmeta(java.lang.String httpequivattr, java.lang.String contentattr)Creates a 'meta' element.HTMLElementp()Creates a 'p' element.HTMLElementpre(java.lang.String classattr)Creates a 'pre' element.voidscript(java.lang.String srcattr)Creates a JavaScript 'script' element.HTMLElementspan()Creates a 'span' element.HTMLElementspan(java.lang.String classattr)Creates a 'span' element.HTMLElementspan(java.lang.String classattr, java.lang.String idattr)Creates a 'span' element.HTMLElementtable(java.lang.String classattr)Creates a 'table' element.HTMLElementtbody()Creates a 'tbody' element.HTMLElementtd()Creates a 'td' element.HTMLElementtd(java.lang.String classattr)Creates a 'td' element.HTMLElementtfoot()Creates a 'tfoot' element.HTMLElementthead()Creates a 'thead' element.HTMLElementtitle()Creates a 'title' element.HTMLElementtr()Creates a 'tr' element.
-
-
-
Constructor Detail
-
HTMLElement
public HTMLElement(java.io.OutputStream output, java.lang.String encoding) throws java.io.IOExceptionCreates ahtmlroot element of a XHTML document.- Parameters:
encoding- character encoding used for outputoutput- output stream will be closed if the root element is closed- Throws:
java.io.IOException- in case of problems with the underlying output
-
-
Method Detail
-
element
public HTMLElement element(java.lang.String name) throws java.io.IOException
Description copied from class:XMLElementCreates a new child element for this element. Might be overridden in subclasses to return a instance of the subclass.- Overrides:
elementin classXMLElement- Parameters:
name- name of the child element- Returns:
- child element instance
- Throws:
java.io.IOException- in case of problems with the underlying output
-
head
public HTMLElement head() throws java.io.IOException
Creates a 'head' element.- Returns:
- 'head' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
body
public HTMLElement body() throws java.io.IOException
Creates a 'body' element.- Returns:
- 'body' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
meta
public HTMLElement meta(java.lang.String httpequivattr, java.lang.String contentattr) throws java.io.IOException
Creates a 'meta' element.- Parameters:
httpequivattr- value of the http-equiv attributecontentattr- value for the content attribute- Returns:
- 'meta' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
link
public HTMLElement link(java.lang.String relattr, java.lang.String hrefattr, java.lang.String typeattr) throws java.io.IOException
Creates a 'link' element.- Parameters:
relattr- value of the rel attributehrefattr- value for the href attributetypeattr- value for the type attribute- Returns:
- 'link' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
title
public HTMLElement title() throws java.io.IOException
Creates a 'title' element.- Returns:
- 'title' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
h1
public HTMLElement h1() throws java.io.IOException
Creates a 'h1' element.- Returns:
- 'h1' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
p
public HTMLElement p() throws java.io.IOException
Creates a 'p' element.- Returns:
- 'p' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
span
public HTMLElement span() throws java.io.IOException
Creates a 'span' element.- Returns:
- 'span' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
span
public HTMLElement span(java.lang.String classattr) throws java.io.IOException
Creates a 'span' element.- Parameters:
classattr- value of the class attribute- Returns:
- 'span' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
span
public HTMLElement span(java.lang.String classattr, java.lang.String idattr) throws java.io.IOException
Creates a 'span' element.- Parameters:
classattr- value of the class attributeidattr- value of the id attribute- Returns:
- 'span' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
div
public HTMLElement div(java.lang.String classattr) throws java.io.IOException
Creates a 'div' element.- Parameters:
classattr- value of the class attribute- Returns:
- 'div' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
code
public HTMLElement code() throws java.io.IOException
Creates a 'code' element.- Returns:
- 'code' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
pre
public HTMLElement pre(java.lang.String classattr) throws java.io.IOException
Creates a 'pre' element.- Parameters:
classattr- value of the class attribute- Returns:
- 'pre' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
a
public HTMLElement a(java.lang.String hrefattr) throws java.io.IOException
Creates a 'a' element.- Parameters:
hrefattr- value of the href attribute- Returns:
- 'a' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
a
public HTMLElement a(java.lang.String hrefattr, java.lang.String classattr) throws java.io.IOException
Creates a 'a' element.- Parameters:
hrefattr- value of the href attributeclassattr- value of the class attribute- Returns:
- 'a' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
a
public HTMLElement a(ILinkable linkable, ReportOutputFolder base) throws java.io.IOException
Creates a link to the givenILinkable.- Parameters:
linkable- object to link tobase- base folder where the link should be placed- Returns:
- 'a' element or 'span' element, if the link target does not exist
- Throws:
java.io.IOException- in case of problems with the underlying output
-
table
public HTMLElement table(java.lang.String classattr) throws java.io.IOException
Creates a 'table' element.- Parameters:
classattr- value of the class attribute- Returns:
- 'table' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
thead
public HTMLElement thead() throws java.io.IOException
Creates a 'thead' element.- Returns:
- 'thead' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
tfoot
public HTMLElement tfoot() throws java.io.IOException
Creates a 'tfoot' element.- Returns:
- 'tfoot' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
tbody
public HTMLElement tbody() throws java.io.IOException
Creates a 'tbody' element.- Returns:
- 'tbody' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
tr
public HTMLElement tr() throws java.io.IOException
Creates a 'tr' element.- Returns:
- 'tr' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
td
public HTMLElement td() throws java.io.IOException
Creates a 'td' element.- Returns:
- 'td' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
td
public HTMLElement td(java.lang.String classattr) throws java.io.IOException
Creates a 'td' element.- Parameters:
classattr- value of the class attribute- Returns:
- 'td' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
img
public void img(java.lang.String srcattr, int widthattr, int heightattr, java.lang.String titleattr) throws java.io.IOExceptionCreates a 'img' element.- Parameters:
srcattr- value of the src attributewidthattr- value of the width attributeheightattr- value of the height attributetitleattr- value of the title and alt attribute- Throws:
java.io.IOException- in case of problems with the underlying output
-
script
public void script(java.lang.String srcattr) throws java.io.IOExceptionCreates a JavaScript 'script' element.- Parameters:
srcattr- value of the src attribute- Throws:
java.io.IOException- in case of problems with the underlying output
-
-