Search in sources :

Example 1 with HTMLElement

use of org.jacoco.report.internal.html.HTMLElement in project jacoco by jacoco.

the class ReportPage method body.

private void body(final HTMLElement body) throws IOException {
    body.attr("onload", getOnload());
    final HTMLElement navigation = body.div(Styles.BREADCRUMB);
    navigation.attr("id", "breadcrumb");
    infoLinks(navigation.span(Styles.INFO));
    breadcrumb(navigation, folder);
    body.h1().text(getLinkLabel());
    content(body);
    footer(body);
}
Also used : HTMLElement(org.jacoco.report.internal.html.HTMLElement)

Example 2 with HTMLElement

use of org.jacoco.report.internal.html.HTMLElement in project jacoco by jacoco.

the class ReportPage method footer.

private void footer(final HTMLElement body) throws IOException {
    final HTMLElement footer = body.div(Styles.FOOTER);
    final HTMLElement versioninfo = footer.span(Styles.RIGHT);
    versioninfo.text("Created with ");
    versioninfo.a(JaCoCo.HOMEURL).text("JaCoCo");
    versioninfo.text(" ").text(JaCoCo.VERSION);
    footer.text(context.getFooterText());
}
Also used : HTMLElement(org.jacoco.report.internal.html.HTMLElement)

Example 3 with HTMLElement

use of org.jacoco.report.internal.html.HTMLElement in project jacoco by jacoco.

the class SessionsPage method sessionTable.

private void sessionTable(final HTMLElement body) throws IOException {
    final HTMLElement table = body.table(Styles.COVERAGETABLE);
    {
        final HTMLElement tr = table.thead().tr();
        tr.td().text("Session");
        tr.td().text("Start Time");
        tr.td().text("Dump Time");
    }
    final HTMLElement tbody = table.tbody();
    for (final SessionInfo i : sessionInfos) {
        final HTMLElement tr = tbody.tr();
        tr.td().span(Styles.EL_SESSION).text(i.getId());
        tr.td().text(dateFormat.format(new Date(i.getStartTimeStamp())));
        tr.td().text(dateFormat.format(new Date(i.getDumpTimeStamp())));
    }
}
Also used : HTMLElement(org.jacoco.report.internal.html.HTMLElement) SessionInfo(org.jacoco.core.data.SessionInfo) Date(java.util.Date)

Example 4 with HTMLElement

use of org.jacoco.report.internal.html.HTMLElement in project jacoco by jacoco.

the class SessionsPage method executionDataTable.

private void executionDataTable(final HTMLElement body) throws IOException {
    final HTMLElement table = body.table(Styles.COVERAGETABLE);
    {
        final HTMLElement tr = table.thead().tr();
        tr.td().text("Class");
        tr.td().text("Id");
    }
    final HTMLElement tbody = table.tbody();
    final ILanguageNames names = context.getLanguageNames();
    for (final ExecutionData e : executionData) {
        final HTMLElement tr = tbody.tr();
        final String link = index.getLinkToClass(e.getId());
        final String qualifiedName = names.getQualifiedClassName(e.getName());
        if (link == null) {
            tr.td().span(Styles.EL_CLASS).text(qualifiedName);
        } else {
            tr.td().a(link, Styles.EL_CLASS).text(qualifiedName);
        }
        final String id = String.format("%016x", Long.valueOf(e.getId()));
        tr.td().code().text(id);
    }
}
Also used : HTMLElement(org.jacoco.report.internal.html.HTMLElement) ILanguageNames(org.jacoco.report.ILanguageNames) ExecutionData(org.jacoco.core.data.ExecutionData)

Example 5 with HTMLElement

use of org.jacoco.report.internal.html.HTMLElement in project jacoco by jacoco.

the class SourceHighlighter method render.

/**
 * Highlights the given source file.
 *
 * @param parent
 *            parent HTML element
 * @param source
 *            highlighting information
 * @param contents
 *            contents of the source file
 * @throws IOException
 *             problems while reading the source file or writing the output
 */
public void render(final HTMLElement parent, final ISourceNode source, final Reader contents) throws IOException {
    final HTMLElement pre = parent.pre(Styles.SOURCE + " lang-" + lang + " linenums");
    final BufferedReader lineBuffer = new BufferedReader(contents);
    String line;
    int nr = 0;
    while ((line = lineBuffer.readLine()) != null) {
        nr++;
        renderCodeLine(pre, line, source.getLine(nr), nr);
    }
}
Also used : HTMLElement(org.jacoco.report.internal.html.HTMLElement) BufferedReader(java.io.BufferedReader)

Aggregations

HTMLElement (org.jacoco.report.internal.html.HTMLElement)9 ExecutionData (org.jacoco.core.data.ExecutionData)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 SessionInfo (org.jacoco.core.data.SessionInfo)1 ILanguageNames (org.jacoco.report.ILanguageNames)1 Test (org.junit.Test)1 Document (org.w3c.dom.Document)1