de.vc.report.sources.csv

## Class CSVTableModel

- java.lang.Object
- - de.vc.report.ReportTableModel
  - - de.vc.report.sources.csv.CSVTableModel

-     public class CSVTableModel
      extends ReportTableModel

  A table model of csv data source holds values for one table of ALL reports. In consequence you have to define an ID in the data source CSV and a referencing column in this model. So can jFO assign a table-row to a data source.
  Please recognize that usually a table model is only for ONE report and not for ALL reports.
  Visit also our examples to learn more about it.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSVTableModel(java.lang.String csvFile, java.lang.String[] columnNames, int referenceColumn, java.lang.String referencedKey)` Creates a new csv table model.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String[]` | `definedColumns()` Gets all table columns of this model.
    `protected void` | `doDisposeData()`
    `protected java.lang.Object` | `doGetValueOfCell(java.lang.String columnName)`
    `protected void` | `doReset()`
    `protected void` | `doSelectNextRow()`
    `char` | `getDelimiter()` Gets the delimiter of csv file.
    `boolean` | `hasMoreRows()` Determinates if more rows are available.
    `void` | `setDelimiter(char delimiter)` Sets the delimiter of csv file.

    - ### Methods inherited from class de.vc.report.ReportTableModel

      `disposeData, getLogger, getRowIndex, getValueOfCell, reset, selectNextRow`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### CSVTableModel

          public CSVTableModel(java.lang.String csvFile,
                       java.lang.String[] columnNames,
                       int referenceColumn,
                       java.lang.String referencedKey)
                        throws java.io.IOException

      Creates a new csv table model.
      Parameters:
        `csvFile` - CSV file.
        `columnNames` - Name of columns in csv file.
        `referenceColumn` - Index of column that references a key of report-data.
        `referencedKey` - The key of report-data
      Throws:
        `java.io.IOException` - Throws an IO-Exception.

  - ### Method Detail

    - #### definedColumns

          public java.lang.String[] definedColumns()

      Description copied from class: `ReportTableModel`
      Gets all table columns of this model. Note that two different table models must not have equal column names!
      Specified by:
        `definedColumns` in class `ReportTableModel`
      Returns:
        String[] Name of columns.

    - #### doDisposeData

          protected void doDisposeData()
                                throws ReportException

      Overrides:
        `doDisposeData` in class `ReportTableModel`
      Throws:
        `ReportException`

    - #### doGetValueOfCell

          protected java.lang.Object doGetValueOfCell(java.lang.String columnName)

      Specified by:
        `doGetValueOfCell` in class `ReportTableModel`

    - #### doReset

          protected void doReset()

      Specified by:
        `doReset` in class `ReportTableModel`

    - #### doSelectNextRow

          protected void doSelectNextRow()

      Specified by:
        `doSelectNextRow` in class `ReportTableModel`

    - #### getDelimiter

          public char getDelimiter()

      Gets the delimiter of csv file.
      Returns:
        Delimiter of csv, is ',' by default.

    - #### hasMoreRows

          public boolean hasMoreRows()

      Description copied from class: `ReportTableModel`
      Determinates if more rows are available.
      Specified by:
        `hasMoreRows` in class `ReportTableModel`
      Returns:
        true, if at least one row is available.

    - #### setDelimiter

          public void setDelimiter(char delimiter)

      Sets the delimiter of csv file.
      Parameters:
        `delimiter` - Delimter of csv.

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.