|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sos.reports.AbstractReportTemplate | +--sos.reports.TableReportTemplate
A report template that creates a report from
an Object[]
,
java.util.List
,
javax.swing.ListModel
,
Object[][]
,
java.util.Map
,
javax.swing.text.TableModel
,
or ReportTableModel
.
The report can handle any number of header and footer
tiers and cells that straddle multiple rows or columns.
ListModel
.
The ListModel
interface
has no way to set a value.
If the table data is given by a TableModel
, then isCellEditable
determines if the content is editable.
The edited value is pushed back into the underlying data structure.
STRADDLE_PREVIOUS_COLUMN
and
STRADDLE_PREVIOUS_ROW
.For example, the following example creates a report table with straddling cells:
Object[][] data = new Object[][] { { "Cell 0,0", "Cell 0,1", "Spans 3 columns" }, { "Spans 2 rows 2 columns", TableReportTemplate.STRADDLE_PREVIOUS_COLUMN, TableReportTemplate.STRADDLE_PREVIOUS_ROW }, { TableReportTemplate.STRADDLE_PREVIOUS_ROW, TableReportTemplate.STRADDLE_PREVIOUS_ROW, TableReportTemplate.STRADDLE_PREVIOUS_ROW }, { "Cell 3,0", "Spans 2 rows", TableReportTemplate.STRADDLE_PREVIOUS_COLUMN } }; TableReportTemplate template = new TableReportTemplate(); Report report = template.createReport( data );Straddling cells should not cross header and footer tier boundaries.
ReportTableModel.getTableStyleName()
. For the style name of a row
element, this class uses the string returned by ReportTableModel.getRowStyleNameAt(int)
.
For the style name of a column element, this class invokes
ReportTableModel.getColumnStyleNameAt(int)
. The style names
used by the cell elements are determined from ReportTableModel.getCellStyleNameAt(int, int)
.
Last, the style names used by the cell content is given
by ReportTableModel.getStyleNameAt(int, int)
. The client can
customize these style names by providing the data as an
instance of ReportTableModel
and implementing these methods accordingly.
All other forms of data use the style name convention set in
AbstractReportTableModel
.
ReportTableModel
,
AbstractReportTableModel
Field Summary | |
static java.lang.Object |
STRADDLE_PREVIOUS_COLUMN
A place holder object that indicates that this cell is a part of the cell in the previous column. |
static java.lang.Object |
STRADDLE_PREVIOUS_ROW
A place holder object that indicates that this cell is a part of the cell in the previous row. |
static int |
USE_COLUMN_NAMES
A constant (used as the number of row headers) to indicate that the template should use the column names as row headers. |
Constructor Summary | |
TableReportTemplate()
Creates an instance of TableReportTemplate with
a default name and 0 as the number of header
and footer rows and columns. |
|
TableReportTemplate(java.lang.String name)
Creates an instance of TableReportTemplate with
the specified name and 0 as the number of header and footer rows and columns. |
|
TableReportTemplate(java.lang.String name,
int numHeaderRows,
int numHeaderColumns,
int numFooterRows,
int numFooterColumns)
Creates an instance of TableReportTemplate that
has the specified number of header and footer rows and columns. |
Method Summary | |
Report |
createReport(java.lang.Object content,
Theme theme)
Creates a report with the specified content and theme. |
java.lang.String |
getName()
Returns a localized name of this report template. |
void |
setColumnPrototypes(java.lang.Object[] prototypeColumnValues)
Sets the column prototype values. |
Methods inherited from class sos.reports.AbstractReportTemplate |
createReport, getDefaultTheme, getThemes, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface sos.reports.ReportTemplate |
createReport, getDefaultTheme, getThemes |
Field Detail |
public static final java.lang.Object STRADDLE_PREVIOUS_ROW
public static final java.lang.Object STRADDLE_PREVIOUS_COLUMN
public static final int USE_COLUMN_NAMES
Constructor Detail |
public TableReportTemplate()
TableReportTemplate
with
a default name and 0 as the number of header
and footer rows and columns.
TableReportTemplate(String,int,int,int,int)
public TableReportTemplate(java.lang.String name)
TableReportTemplate
with
the specified name and 0 as the number of header and footer rows and columns.
name
- localized string that this template should use as its nameTableReportTemplate(String,int,int,int,int)
public TableReportTemplate(java.lang.String name, int numHeaderRows, int numHeaderColumns, int numFooterRows, int numFooterColumns)
TableReportTemplate
that
has the specified number of header and footer rows and columns.
name
- localized string that this template should use as its namenumHeaderRows
- number of rows to treat as header rowsnumHeaderColumns
- number of columns to treat as header columnsnumFooterRows
- number of rows to treat as footer rowsnumFooterColumns
- number of columns to treat as footer columns
java.lang.IllegalArgumentException
- if numHeaderRows < 0 && numHeaderRows != USE_COLUMN_NAMES
;
if numHeaderColumns < 0
;
if numFooterRows < 0
;
if numFooterColumns < 0
;Method Detail |
public Report createReport(java.lang.Object content, Theme theme) throws java.lang.IllegalArgumentException
ReportTemplate
createReport
in interface ReportTemplate
content
- content of the report to be generatedtheme
- theme of the report to be generated
null
report with the specified content
and based on the specified theme
java.lang.IllegalArgumentException
- if content
is not appropriate
(wrong class, e.g.) for the reports generated by this templatepublic java.lang.String getName()
ReportTemplate
getName
in interface ReportTemplate
public void setColumnPrototypes(java.lang.Object[] prototypeColumnValues)
prototypeColumnValues
- typical values for each column (may be null
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |