Package ca.spatial.reportwriter
Class TableFormat
java.lang.Object
ca.spatial.reportwriter.TableFormat
This class will output a table of data in HTML format.
The formatter will organize the column and row headings appropriately.
-
Constructor Summary
ConstructorsConstructorDescriptionTableFormat(double[][] dataArray, int maximumFractionDigits)
Set the table data that is to be formatted.TableFormat(double[][] dataArray, int maximumFractionDigits, NumberFormat displayFormat)
Set the table data that is to be formatted. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPrefixColumn(String label, double[] values)
Add a column that will appear to the left of the table.void
addPrefixColumn(String label, int[] values)
Add a column that will appear to the left of the table.void
addPrefixColumn(String label, Object[] values)
Add a column that will appear to the left of the table.void
addSuffixColumn(String label, double[] values)
Add a column that will appear to the right of the table.void
addSuffixColumn(String label, int[] values)
Add a column that will appear to the right of the table.void
addSuffixColumn(String label, Object[] values)
Add a column that will appear to the right of the table.void
void
addYearsForPeriods(String label, int[] periods, AttributeStore as)
format()
Format the table in HTML, and return the result as a Stringboolean
boolean
boolean
void
setColumnHeadings(PathTree columns)
Set the column headings for the table.void
setColumnHeadings(Comparable[] columns)
Set the column headings for the table.setDoColumnTotals(boolean mode)
setDoRowTotals(boolean mode)
setDoSubTotals(boolean mode)
void
setRowHeadings(PathTree rows)
Set the column headings for the table.void
setRowHeadings(Comparable[] rows)
Set the row headings for the table.
-
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
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
-
getDoColumnTotals
public boolean getDoColumnTotals() -
setDoSubTotals
-
getDoSubTotals
public boolean getDoSubTotals() -
setDoRowTotals
-
getDoRowTotals
public boolean getDoRowTotals() -
addPrefixColumn
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
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
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
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
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
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
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
Set the column headings for the table. -
setRowHeadings
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
Set the column headings for the table. -
addTotals
-
addYearsForPeriods
-
format
Format the table in HTML, and return the result as a String
-