Class TableFormat

java.lang.Object
ca.spatial.reportwriter.TableFormat

public class TableFormat extends Object
This class will output a table of data in HTML format. The formatter will organize the column and row headings appropriately.
  • Constructor Details

    • TableFormat

      public TableFormat(double[][] dataArray, int maximumFractionDigits)
      Set the table data that is to be formatted.
      Parameters:
      dataArray - a two-dimensional array of double values, stored in column-major order.
      maximumFractionDigits - Set the maximum fraction digits that are to be used for double values in the table.
    • TableFormat

      public TableFormat(double[][] dataArray, int maximumFractionDigits, NumberFormat displayFormat)
      Set the table data that is to be formatted.
      Parameters:
      dataArray - a two-dimensional array of double values, stored in column-major order.
      maximumFractionDigits - Set the maximum fraction digits that are to be used for double values in the table.
      displayFormat - A formating object used to display the values in the table. This may be null, but if specified will override the maximumFractionDigits specification.
  • Method Details

    • setDoColumnTotals

      public TableFormat setDoColumnTotals(boolean mode)
    • getDoColumnTotals

      public boolean getDoColumnTotals()
    • setDoSubTotals

      public TableFormat setDoSubTotals(boolean mode)
    • getDoSubTotals

      public boolean getDoSubTotals()
    • setDoRowTotals

      public TableFormat setDoRowTotals(boolean mode)
    • getDoRowTotals

      public boolean getDoRowTotals()
    • addPrefixColumn

      public void addPrefixColumn(String label, int[] values)
      Add a column that will appear to the left of the table. This is typically used to add period numbers or year.
      Parameters:
      label - The label for this column heading.
      values - The values for this column, one for each row.
    • addPrefixColumn

      public void addPrefixColumn(String label, double[] values)
      Add a column that will appear to the left of the table. This is typically used to add period numbers or year.
      Parameters:
      label - The label for this column heading.
      values - The values for this column, one for each row.
    • addPrefixColumn

      public void addPrefixColumn(String label, Object[] values)
      Add a column that will appear to the left of the table. This is typically used to add period numbers or year.
      Parameters:
      label - The label for this column heading.
      values - The values for this column, one for each row.
    • addSuffixColumn

      public void addSuffixColumn(String label, int[] values)
      Add a column that will appear to the right of the table. This is typically used to add a total column.
      Parameters:
      label - The label for this column heading.
      values - The values for this column, one for each row.
    • addSuffixColumn

      public void addSuffixColumn(String label, double[] values)
      Add a column that will appear to the right of the table. This is typically used to add a total column.
      Parameters:
      label - The label for this column heading.
      values - The values for this column, one for each row.
    • addSuffixColumn

      public void addSuffixColumn(String label, Object[] values)
      Add a column that will appear to the right of the table. This is typically used to add a total column.
      Parameters:
      label - The label for this column heading.
      values - The values for this column, one for each row.
    • setColumnHeadings

      public void setColumnHeadings(Comparable[] columns)
      Set the column headings for the table. These will be presented in the order that they are shown without any sorting being applied. Sorting is the responsibility of the calling program.
    • setColumnHeadings

      public void setColumnHeadings(PathTree columns)
      Set the column headings for the table.
    • setRowHeadings

      public void setRowHeadings(Comparable[] rows)
      Set the row headings for the table. These will be presented in the order that they are shown without any sorting being applied. Sorting is the responsibility of the calling program.
    • setRowHeadings

      public void setRowHeadings(PathTree rows)
      Set the column headings for the table.
    • addTotals

      public void addTotals(String label)
    • addYearsForPeriods

      public void addYearsForPeriods(String label, int[] periods, AttributeStore as)
    • format

      public String format()
      Format the table in HTML, and return the result as a String