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