Class CounterColumn
- java.lang.Object
-
- org.jacoco.report.internal.html.table.CounterColumn
-
- All Implemented Interfaces:
IColumnRenderer
public abstract class CounterColumn extends java.lang.Object implements IColumnRenderer
Column that prints the counter values of entities for each item and a summary in the footer. If the total number of items is zero, no column is emitted at all. The implementation is stateful, instances must not be used in parallel.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCounterColumn(ICoverageNode.CounterEntity entity, java.util.Locale locale, java.util.Comparator<ICoverageNode> comparator)Creates a new column that is based on theICounterfor the given entity.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidfooter(HTMLElement td, ICoverageNode total, Resources resources, ReportOutputFolder base)Renders the footer for this column.java.util.Comparator<ITableItem>getComparator()Returns the comparator to sort this table column.protected abstract intgetValue(ICounter counter)Retrieves the respective value from the counter.booleaninit(java.util.List<? extends ITableItem> items, ICoverageNode total)Initializes the column before any output method is called.voiditem(HTMLElement td, ITableItem item, Resources resources, ReportOutputFolder base)Renders a single item in this column.static CounterColumnnewCovered(ICoverageNode.CounterEntity entity, java.util.Locale locale)Creates a new column that shows the covered count for the given entity.static CounterColumnnewMissed(ICoverageNode.CounterEntity entity, java.util.Locale locale)Creates a new column that shows the missed count for the given entity.static CounterColumnnewTotal(ICoverageNode.CounterEntity entity, java.util.Locale locale)Creates a new column that shows the total count for the given entity.
-
-
-
Constructor Detail
-
CounterColumn
protected CounterColumn(ICoverageNode.CounterEntity entity, java.util.Locale locale, java.util.Comparator<ICoverageNode> comparator)
Creates a new column that is based on theICounterfor the given entity.- Parameters:
entity- counter entity for this columnlocale- locale for rendering numberscomparator- comparator for the nodes of this column
-
-
Method Detail
-
newTotal
public static CounterColumn newTotal(ICoverageNode.CounterEntity entity, java.util.Locale locale)
Creates a new column that shows the total count for the given entity.- Parameters:
entity- counter entity for this columnlocale- locale for rendering numbers- Returns:
- column instance
-
newMissed
public static CounterColumn newMissed(ICoverageNode.CounterEntity entity, java.util.Locale locale)
Creates a new column that shows the missed count for the given entity.- Parameters:
entity- counter entity for this columnlocale- locale for rendering numbers- Returns:
- column instance
-
newCovered
public static CounterColumn newCovered(ICoverageNode.CounterEntity entity, java.util.Locale locale)
Creates a new column that shows the covered count for the given entity.- Parameters:
entity- counter entity for this columnlocale- locale for rendering numbers- Returns:
- column instance
-
init
public boolean init(java.util.List<? extends ITableItem> items, ICoverageNode total)
Description copied from interface:IColumnRendererInitializes the column before any output method is called.- Specified by:
initin interfaceIColumnRenderer- Parameters:
items- all items that will be displayed in the tabletotal- the summary of all coverage data items in the table- Returns:
trueif the column should be visible
-
footer
public void footer(HTMLElement td, ICoverageNode total, Resources resources, ReportOutputFolder base) throws java.io.IOException
Description copied from interface:IColumnRendererRenders the footer for this column.- Specified by:
footerin interfaceIColumnRenderer- Parameters:
td- the parent table celltotal- the summary of all coverage data items in the tableresources- static resources that might be referencedbase- base folder of the table- Throws:
java.io.IOException- in case of IO problems with the element output
-
item
public void item(HTMLElement td, ITableItem item, Resources resources, ReportOutputFolder base) throws java.io.IOException
Description copied from interface:IColumnRendererRenders a single item in this column.- Specified by:
itemin interfaceIColumnRenderer- Parameters:
td- the parent table cellitem- the item to displayresources- static resources that might be referencedbase- base folder of the table- Throws:
java.io.IOException- in case of IO problems with the element output
-
getComparator
public java.util.Comparator<ITableItem> getComparator()
Description copied from interface:IColumnRendererReturns the comparator to sort this table column.- Specified by:
getComparatorin interfaceIColumnRenderer- Returns:
- comparator for this column
-
getValue
protected abstract int getValue(ICounter counter)
Retrieves the respective value from the counter.- Parameters:
counter- counter object- Returns:
- value of interest
-
-