org.jacoco.report.internal.html
Class HTMLElement

java.lang.Object
  extended by org.jacoco.report.internal.xml.XMLElement
      extended by org.jacoco.report.internal.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.


Field Summary
 
Fields inherited from class org.jacoco.report.internal.xml.XMLElement
writer
 
Constructor Summary
HTMLElement(OutputStream output, String encoding)
          Creates a html root element of a XHTML document.
 
Method Summary
 HTMLElement a(ILinkable linkable, ReportOutputFolder base)
          Creates a link to the given ILinkable.
 HTMLElement a(String hrefattr)
          Creates a 'a' element.
 HTMLElement a(String hrefattr, String classattr)
          Creates a 'a' element.
 HTMLElement body()
          Creates a 'body' element.
 HTMLElement code()
          Creates a 'code' 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.
 HTMLElement head()
          Creates a 'head' 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 p()
          Creates a 'p' element.
 HTMLElement pre(String classattr)
          Creates a 'pre' element.
 void script(String srcattr)
          Creates a JavaScript 'script' element.
 HTMLElement span()
          Creates a 'span' 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(String classattr)
          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.internal.xml.XMLElement
attr, attr, attr, close, text
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLElement

public HTMLElement(OutputStream output,
                   String encoding)
            throws IOException
Creates a html root element of a XHTML document.

Parameters:
encoding - character encoding used for output
output - output stream will be closed if the root element is closed
Throws:
IOException - in case of problems with the underlying output
Method Detail

element

public HTMLElement element(String name)
                    throws IOException
Description copied from class: XMLElement
Creates a new child element for this element. Might be overridden in subclasses to return a instance of the subclass.

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

head

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

Returns:
'head' element
Throws:
IOException - in case of problems with the underlying output

body

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

Returns:
'body' element
Throws:
IOException - in case of problems with the underlying output

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 underlying output

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 underlying output

title

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

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

h1

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

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

p

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

Returns:
'p' element
Throws:
IOException - in case of problems with the underlying output

span

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

Returns:
'span' element
Throws:
IOException - in case of problems with the underlying output

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 underlying output

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 underlying output

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 underlying output

code

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

Returns:
'code' element
Throws:
IOException - in case of problems with the underlying output

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 underlying output

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 underlying output

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 underlying output

a

public HTMLElement a(ILinkable linkable,
                     ReportOutputFolder base)
              throws IOException
Creates a link to the given ILinkable.

Parameters:
linkable - object to link to
base - base folder where the link should be placed
Returns:
'a' element or 'span' element, if the link target does not exist
Throws:
IOException - in case of problems with the underlying output

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 underlying output

thead

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

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

tfoot

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

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

tbody

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

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

tr

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

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

td

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

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

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 underlying output

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 underlying output

script

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

Parameters:
srcattr - value of the src attribute
Throws:
IOException - in case of problems with the underlying output


Copyright © 2009–2024 Mountainminds GmbH & Co. KG. All rights reserved.