• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *    Marc R. Hoffmann - initial API and implementation
10  *
11  *******************************************************************************/
12 package org.jacoco.report.internal.html.table;
13 
14 import java.io.IOException;
15 import java.util.Comparator;
16 import java.util.List;
17 
18 import org.jacoco.core.analysis.ICoverageNode;
19 import org.jacoco.report.internal.ReportOutputFolder;
20 import org.jacoco.report.internal.html.HTMLElement;
21 import org.jacoco.report.internal.html.resources.Resources;
22 
23 /**
24  * Renderer for a single column of a coverage table. The methods are always
25  * called in the sequence <code>init header footer item*</code>. Implementations
26  * might be stateful.
27  */
28 public interface IColumnRenderer {
29 
30 	/**
31 	 * Initializes the column before any output method is called.
32 	 *
33 	 * @param items
34 	 *            all items that will be displayed in the table
35 	 * @param total
36 	 *            the summary of all coverage data items in the table
37 	 * @return <code>true</code> if the column should be visible
38 	 */
init(List<? extends ITableItem> items, ICoverageNode total)39 	public boolean init(List<? extends ITableItem> items, ICoverageNode total);
40 
41 	/**
42 	 * Renders the footer for this column.
43 	 *
44 	 * @param td
45 	 *            the parent table cell
46 	 * @param total
47 	 *            the summary of all coverage data items in the table
48 	 * @param resources
49 	 *            static resources that might be referenced
50 	 * @param base
51 	 *            base folder of the table
52 	 * @throws IOException
53 	 *             in case of IO problems with the element output
54 	 */
footer(HTMLElement td, ICoverageNode total, Resources resources, ReportOutputFolder base)55 	public void footer(HTMLElement td, ICoverageNode total,
56 			Resources resources, ReportOutputFolder base) throws IOException;
57 
58 	/**
59 	 * Renders a single item in this column.
60 	 *
61 	 * @param td
62 	 *            the parent table cell
63 	 * @param item
64 	 *            the item to display
65 	 * @param resources
66 	 *            static resources that might be referenced
67 	 * @param base
68 	 *            base folder of the table
69 	 * @throws IOException
70 	 *             in case of IO problems with the element output
71 	 */
item(HTMLElement td, ITableItem item, Resources resources, ReportOutputFolder base)72 	public void item(HTMLElement td, ITableItem item, Resources resources,
73 			ReportOutputFolder base) throws IOException;
74 
75 	/**
76 	 * Returns the comparator to sort this table column.
77 	 *
78 	 * @return comparator for this column
79 	 */
getComparator()80 	public Comparator<ITableItem> getComparator();
81 
82 }
83