net.sf.statcvs.reportmodel

Class IntegerColumn


public class IntegerColumn
extends Column

A column of integer values. The column's total is the sum of all values.
Version:
$Id: IntegerColumn.java,v 1.2 2008/04/02 11:22:14 benoitx Exp $
Author:
Richard Cyganiak

Constructor Summary

IntegerColumn(String title)
Creates a new SimpleTextColumn with the given head

Method Summary

void
addValue(int value)
Adds a value to this column (in a new row)
int
getRows()
int
getSum()
Returns the sum of all values in the column
int
getValue(int rowIndex)
Returns a value in the column
void
renderCell(int rowIndex, TableCellRenderer renderer)
void
renderHead(TableCellRenderer renderer)
void
renderTotal(TableCellRenderer renderer)
void
setShowPercentages(boolean enable)
Set if the values should be shown as percentages
void
setShowValues(boolean enable)
Set if the actual integer values should be shown
void
setSum(int sum)
Sets the sum of the column.

Methods inherited from class net.sf.statcvs.reportmodel.Column

getRows, renderCell, renderHead, renderTotal

Constructor Details

IntegerColumn

public IntegerColumn(String title)
Creates a new SimpleTextColumn with the given head
Parameters:
title - the head of the column

Method Details

addValue

public void addValue(int value)
Adds a value to this column (in a new row)
Parameters:
value - the new value

getRows

public int getRows()
Overrides:
getRows in interface Column

getSum

public int getSum()
Returns the sum of all values in the column
Returns:
sum

getValue

public int getValue(int rowIndex)
Returns a value in the column
Parameters:
rowIndex - the row to get, starting at 0
Returns:
the value of this row

renderCell

public void renderCell(int rowIndex,
                       TableCellRenderer renderer)
Overrides:
renderCell in interface Column

renderHead

public void renderHead(TableCellRenderer renderer)
Overrides:
renderHead in interface Column

renderTotal

public void renderTotal(TableCellRenderer renderer)
Overrides:
renderTotal in interface Column

setShowPercentages

public void setShowPercentages(boolean enable)
Set if the values should be shown as percentages
Parameters:
enable - show percentages?

setShowValues

public void setShowValues(boolean enable)
Set if the actual integer values should be shown
Parameters:
enable - show values?

setSum

public void setSum(int sum)
Sets the sum of the column. Useful if, for example, the column contains only the top 10 values of more values, but the column total should reflect all values.
Parameters:
sum - the column's total