# Class IntegerColumn

java.lang.Object
net.sf.statcvs.reportmodel.Column
net.sf.statcvs.reportmodel.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.4 2009/03/09 21:45:42 benoitx Exp $
Author:
  Richard Cyganiak invalid input: '<'rcyg@gmx.de>

## Constructor Summary

Constructors
Constructor
Description
`IntegerColumn(String title)`
Creates a new `SimpleTextColumn` with the given head

## Method Summary

Modifier and Type
Method
Description
`void`
`addValue(int value)`
Adds a value to this column (in a new row)
`int`
`getRows()`
Return number of rows that have been added to this column
`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)`
Renders a row of the column into a `TableCellRenderer` by calling one of its `TableCellRenderer.renderCell(String)` methods
`void`
`renderHead(TableCellRenderer renderer)`
Renders the head of the column into a `TableCellRenderer` by calling one of its `TableCellRenderer.renderCell(String)` methods
`void`
`renderTotal(TableCellRenderer renderer)`
Renders the footer of the column into a `TableCellRenderer` by calling one of its `TableCellRenderer.renderCell(String)` methods.
`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 Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### IntegerColumn

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

Parameters:
  `title` - the head of the column

## Method Details

### setShowValues

public void setShowValues(boolean enable)
Set if the actual integer values should be shown

Parameters:
  `enable` - show values?

### setShowPercentages

public void setShowPercentages(boolean enable)
Set if the values should be shown as percentages

Parameters:
  `enable` - show percentages?

### addValue

public void addValue(int value)
Adds a value to this column (in a new row)

Parameters:
  `value` - the new value

### 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

### getSum

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

Returns:
  sum

### 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

### getRows

public int getRows()
Description copied from class: `Column`
Return number of rows that have been added to this column

Specified by:
  `getRows` in class `Column`
Returns:
  number of rows that have been added to this column
See Also:
  - `Column.getRows()`

### renderHead

public void renderHead(TableCellRenderer renderer)
Description copied from class: `Column`
Renders the head of the column into a `TableCellRenderer` by calling one of its `TableCellRenderer.renderCell(String)` methods

Specified by:
  `renderHead` in class `Column`
Parameters:
  `renderer` - the TableCellRenderer to use TODO: this is probably unnecessary; better add a getTitle method
See Also:
  - `Column.renderHead(net.sf.statcvs.renderer.TableCellRenderer)`

### renderCell

public void renderCell(int rowIndex, TableCellRenderer renderer)
Description copied from class: `Column`
Renders a row of the column into a `TableCellRenderer` by calling one of its `TableCellRenderer.renderCell(String)` methods

Specified by:
  `renderCell` in class `Column`
Parameters:
  `rowIndex` - the row number, starting at 0
  `renderer` - the TableCellRenderer to use
See Also:
  - `Column.renderCell(int, TableCellRenderer)`

### renderTotal

public void renderTotal(TableCellRenderer renderer)
Description copied from class: `Column`
Renders the footer of the column into a `TableCellRenderer` by calling one of its `TableCellRenderer.renderCell(String)` methods. The footer usually contains some kind of total for the column.

Specified by:
  `renderTotal` in class `Column`
Parameters:
  `renderer` - the TableCellRenderer to use
See Also:
  - `Column.renderTotal(net.sf.statcvs.renderer.TableCellRenderer)`