net.sf.statcvs.reportmodel
Class GenericColumn

java.lang.Object
  extended by net.sf.statcvs.reportmodel.Column
      extended by net.sf.statcvs.reportmodel.GenericColumn
Direct Known Subclasses:
AuthorColumn, AuthorIdColumn, DirectoryColumn, FileColumn, SimpleTextColumn

public abstract class GenericColumn
extends Column

A generic column with a text header and a text total. Each cell contains an Object. The renderCell method must be implemented by subclasses.

Version:
$Id: GenericColumn.java,v 1.2 2008/04/02 11:22:14 benoitx Exp $
Author:
Richard Cyganiak

Constructor Summary
GenericColumn(java.lang.String title)
          Creates a new GenericColumn with the given head
 
Method Summary
 void addValue(java.lang.Object value)
          Adds a value to this column (in a new row)
 int getRows()
          Return number of rows that have been added to this column
 java.lang.Object getValue(int rowIndex)
          Returns a value of the column
abstract  void renderCell(int rowIndex, TableCellRenderer renderer)
          Renders a row of the column into a TableCellRenderer by calling one of its TableCellRenderer.renderCell(java.lang.String) methods
 void renderHead(TableCellRenderer renderer)
          Renders the head of the column into a TableCellRenderer by calling one of its TableCellRenderer.renderCell(java.lang.String) methods
 void renderTotal(TableCellRenderer renderer)
          Renders the footer of the column into a TableCellRenderer by calling one of its TableCellRenderer.renderCell(java.lang.String) methods.
 void setTotal(java.lang.String value)
          Sets the total for this column
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericColumn

public GenericColumn(java.lang.String title)
Creates a new GenericColumn with the given head

Parameters:
title - the head of the column
Method Detail

setTotal

public void setTotal(java.lang.String value)
Sets the total for this column

Parameters:
value - the total for this column

addValue

public void addValue(java.lang.Object value)
Adds a value to this column (in a new row)

Parameters:
value - the new value

getValue

public java.lang.Object getValue(int rowIndex)
Returns a value of the column

Parameters:
rowIndex - the row, starting at 0
Returns:
the value

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(java.lang.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 abstract 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(java.lang.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, net.sf.statcvs.renderer.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(java.lang.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)


Copyright © 2008. All Rights Reserved.