org.jacoco.report.html
Class HTMLElement

java.lang.Object
  extended by org.jacoco.report.xml.XMLElement
      extended by org.jacoco.report.html.HTMLElement

public class HTMLElement
extends XMLElement

A XMLElement with utility methods to create XHTML documents. It provides methods of HTML tags to avoid magic strings in the generators.

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

Field Summary
 
Fields inherited from class org.jacoco.report.xml.XMLElement
writer
 
Constructor Summary
protected HTMLElement(Writer writer, String name)
          Creates a new element for a HTML document.
 
Method Summary
 HTMLElement a(String hrefattr)
          Creates a 'a' element.
 HTMLElement a(String hrefattr, String classattr)
          Creates a 'a' element.
 void br()
          Creates a empty 'br' element.
 HTMLElement div(String classattr)
          Creates a 'div' element.
 HTMLElement element(String name)
          Creates a new child element for this element,
 HTMLElement h1()
          Creates a 'h1' element.
 void img(String srcattr, int widthattr, int heightattr, String titleattr)
          Creates a 'img' element.
 HTMLElement link(String relattr, String hrefattr, String typeattr)
          Creates a 'link' element.
 HTMLElement meta(String httpequivattr, String contentattr)
          Creates a 'meta' element.
 HTMLElement pre(String classattr)
          Creates a 'pre' element.
 void script(String typeattr, String srcattr)
          Creates a 'script' element.
 HTMLElement span(String classattr)
          Creates a 'span' element.
 HTMLElement span(String classattr, String idattr)
          Creates a 'span' element.
 HTMLElement table(String classattr)
          Creates a 'table' element.
 HTMLElement tbody()
          Creates a 'tbody' element.
 HTMLElement td()
          Creates a 'td' element.
 HTMLElement td(int colspanattr)
          Creates a 'td' element.
 HTMLElement td(String classattr)
          Creates a 'td' element.
 HTMLElement td(String classattr, int colspanattr)
          Creates a 'td' element.
 HTMLElement tfoot()
          Creates a 'tfoot' element.
 HTMLElement thead()
          Creates a 'thead' element.
 HTMLElement title()
          Creates a 'title' element.
 HTMLElement tr()
          Creates a 'tr' element.
 
Methods inherited from class org.jacoco.report.xml.XMLElement
addChildElement, attr, attr, beginOpenTag, close, text
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLElement

protected HTMLElement(Writer writer,
                      String name)
Creates a new element for a HTML document.

Parameters:
writer - all output will be written directly to this
name - element name
Method Detail

element

public HTMLElement element(String name)
                    throws IOException
Description copied from class: XMLElement
Creates a new child element for this element,

Overrides:
element in class XMLElement
Parameters:
name - name of the child element
Returns:
child element instance
Throws:
IOException - in case of problems with the writer

meta

public HTMLElement meta(String httpequivattr,
                        String contentattr)
                 throws IOException
Creates a 'meta' element.

Parameters:
httpequivattr - value of the http-equiv attribute
contentattr - value for the content attribute
Returns:
'meta' element
Throws:
IOException - in case of problems with the writer

link

public HTMLElement link(String relattr,
                        String hrefattr,
                        String typeattr)
                 throws IOException
Creates a 'link' element.

Parameters:
relattr - value of the rel attribute
hrefattr - value for the href attribute
typeattr - value for the type attribute
Returns:
'link' element
Throws:
IOException - in case of problems with the writer

title

public HTMLElement title()
                  throws IOException
Creates a 'title' element.

Returns:
'title' element
Throws:
IOException - in case of problems with the writer

h1

public HTMLElement h1()
               throws IOException
Creates a 'h1' element.

Returns:
'h1' element
Throws:
IOException - in case of problems with the writer

span

public HTMLElement span(String classattr)
                 throws IOException
Creates a 'span' element.

Parameters:
classattr - value of the class attribute
Returns:
'span' element
Throws:
IOException - in case of problems with the writer

span

public HTMLElement span(String classattr,
                        String idattr)
                 throws IOException
Creates a 'span' element.

Parameters:
classattr - value of the class attribute
idattr - value of the id attribute
Returns:
'span' element
Throws:
IOException - in case of problems with the writer

div

public HTMLElement div(String classattr)
                throws IOException
Creates a 'div' element.

Parameters:
classattr - value of the class attribute
Returns:
'div' element
Throws:
IOException - in case of problems with the writer

pre

public HTMLElement pre(String classattr)
                throws IOException
Creates a 'pre' element.

Parameters:
classattr - value of the class attribute
Returns:
'pre' element
Throws:
IOException - in case of problems with the writer

br

public void br()
        throws IOException
Creates a empty 'br' element.

Throws:
IOException - in case of problems with the writer

a

public HTMLElement a(String hrefattr)
              throws IOException
Creates a 'a' element.

Parameters:
hrefattr - value of the href attribute
Returns:
'a' element
Throws:
IOException - in case of problems with the writer

a

public HTMLElement a(String hrefattr,
                     String classattr)
              throws IOException
Creates a 'a' element.

Parameters:
hrefattr - value of the href attribute
classattr - value of the class attribute
Returns:
'a' element
Throws:
IOException - in case of problems with the writer

table

public HTMLElement table(String classattr)
                  throws IOException
Creates a 'table' element.

Parameters:
classattr - value of the class attribute
Returns:
'table' element
Throws:
IOException - in case of problems with the writer

thead

public HTMLElement thead()
                  throws IOException
Creates a 'thead' element.

Returns:
'thead' element
Throws:
IOException - in case of problems with the writer

tfoot

public HTMLElement tfoot()
                  throws IOException
Creates a 'tfoot' element.

Returns:
'tfoot' element
Throws:
IOException - in case of problems with the writer

tbody

public HTMLElement tbody()
                  throws IOException
Creates a 'tbody' element.

Returns:
'tbody' element
Throws:
IOException - in case of problems with the writer

tr

public HTMLElement tr()
               throws IOException
Creates a 'tr' element.

Returns:
'tr' element
Throws:
IOException - in case of problems with the writer

td

public HTMLElement td()
               throws IOException
Creates a 'td' element.

Returns:
'td' element
Throws:
IOException - in case of problems with the writer

td

public HTMLElement td(String classattr)
               throws IOException
Creates a 'td' element.

Parameters:
classattr - value of the class attribute
Returns:
'td' element
Throws:
IOException - in case of problems with the writer

td

public HTMLElement td(int colspanattr)
               throws IOException
Creates a 'td' element.

Parameters:
colspanattr - value of the colspan attribute
Returns:
'td' element
Throws:
IOException - in case of problems with the writer

td

public HTMLElement td(String classattr,
                      int colspanattr)
               throws IOException
Creates a 'td' element.

Parameters:
classattr - value of the class attribute
colspanattr - value of the colspan attribute
Returns:
'td' element
Throws:
IOException - in case of problems with the writer

img

public void img(String srcattr,
                int widthattr,
                int heightattr,
                String titleattr)
         throws IOException
Creates a 'img' element.

Parameters:
srcattr - value of the src attribute
widthattr - value of the width attribute
heightattr - value of the height attribute
titleattr - value of the title and alt attribute
Throws:
IOException - in case of problems with the writer

script

public void script(String typeattr,
                   String srcattr)
            throws IOException
Creates a 'script' element.

Parameters:
typeattr - value of the type attribute
srcattr - value of the src attribute
Throws:
IOException - in case of problems with the writer