public final class TableProcessor extends AbstractProcessor<TableProcessor.Input,TableProcessor.Output>
A processor for generating a table.
See also: !table attribute
[[examples=verboseExample,datasource_dynamic_tables,customDynamicReport]]| Modifier and Type | Class and Description |
|---|---|
static class |
TableProcessor.Input
Input object for execute.
|
static class |
TableProcessor.Output
The Output of the processor.
|
AbstractProcessor.ContextProcessor.ExecutionContextMDC_JOB_ID_KEY| Modifier | Constructor and Description |
|---|---|
protected |
TableProcessor()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
TableProcessor.Input |
createInputParameter()
Returns a new/clean instance of a parameter object.
|
TableProcessor.Output |
execute(TableProcessor.Input values,
Processor.ExecutionContext context)
Perform the process on the input attributes.
|
protected void |
extraValidation(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
Perform any extra validation a subclass may need to perform.
|
void |
setColumns(java.util.Map<java.lang.String,TableColumnConverter<?>> columnConverters)
Set strategies for converting the textual representation of each column to some other object (image,
other text, etc...).
|
void |
setConverters(java.util.List<TableColumnConverter<?>> converters)
Set strategies for converting the textual representation of each cell to some other object (image,
other text, etc...).
|
void |
setDetailStyle(java.lang.String detailStyle)
The id of the style to apply to the all columns in the table detail section except first and last
columns.
|
void |
setDynamic(boolean dynamic)
If true then the JasperReport template will be generated dynamically based on the columns in the table
attribute.
|
void |
setExcludeColumns(java.util.Set<java.lang.String> excludeColumns)
A set of column names to exclude from the table.
|
void |
setFirstDetailStyle(java.lang.String firstDetailStyle)
The id of the style to apply to the first column in the table detail section.
|
void |
setFirstHeaderStyle(java.lang.String firstHeaderStyle)
The id of the style to apply to the first column in the table header.
|
void |
setHeaderStyle(java.lang.String headerStyle)
The id of the style to apply to the all columns in the table header except first and last columns.
|
void |
setJasperTemplate(java.lang.String jasperTemplate)
The path to the JasperReports template that contains the template for the sub-report.
|
void |
setLastDetailStyle(java.lang.String lastDetailStyle)
The id of the style to apply to the last column in the table detail section.
|
void |
setLastHeaderStyle(java.lang.String lastHeaderStyle)
The id of the style to apply to the last column in the table header.
|
void |
setMaxColumns(int maxColumns)
The maximum number of columns to allow.
|
void |
setReportWidth(java.lang.Integer reportWidth)
If dynamic is true, the page width of the table report can be adjusted with this property.
|
getInputMapperBiMap, getInputPrefix, getOutputMapperBiMap, getOutputPrefix, getOutputType, setInputMapper, setInputPrefix, setOutputMapper, setOutputPrefix, setPrefix, toString, toString, validatepublic void setJasperTemplate(java.lang.String jasperTemplate)
If dynamic is true then the template will be used to obtain the column styles and the size of the subreport and to get the position of the first header and field element. The actual field and column definitions will be dynamically generated from the table data that is provided.
This may be null if dynamic is false. If it is null then the main template will likely use the generated table datasource directly as its datasource for use in its detail section and the table will be directly in the main template's detail section. Or a later processor may use the table's datasource in someway.jasperTemplate - the template to use for rendering the table.public void setDynamic(boolean dynamic)
Default: false
dynamic - indicate if the template should be dynamically generated for each print
request.public void setReportWidth(java.lang.Integer reportWidth)
reportWidth - The report width to use.public void setColumns(java.util.Map<java.lang.String,TableColumnConverter<?>> columnConverters)
columnConverters - Map from column name -> TableColumnConverterpublic void setConverters(java.util.List<TableColumnConverter<?>> converters)
converters - A list of TableColumnConverters.public void setFirstHeaderStyle(java.lang.String firstHeaderStyle)
The style must be a style element in the jasperTemplate.
firstHeaderStyle - a ref to a style in the japserTemplatepublic void setLastHeaderStyle(java.lang.String lastHeaderStyle)
The style must be a style element in the jasperTemplate.
lastHeaderStyle - a ref to a style in the japserTemplatepublic void setHeaderStyle(java.lang.String headerStyle)
The style must be a style element in the jasperTemplate.
headerStyle - a ref to a style in the japserTemplatepublic void setFirstDetailStyle(java.lang.String firstDetailStyle)
The style must be a style element in the jasperTemplate.
firstDetailStyle - a ref to a style in the jasperTemplatepublic void setLastDetailStyle(java.lang.String lastDetailStyle)
The style must be a style element in the jasperTemplate.
lastDetailStyle - a ref to a style in the jasperTemplatepublic void setDetailStyle(java.lang.String detailStyle)
The style must be a style element in the jasperTemplate.
detailStyle - a ref to a style in the japserTemplatepublic void setMaxColumns(int maxColumns)
maxColumns - maximum number of columns to allow.public void setExcludeColumns(java.util.Set<java.lang.String> excludeColumns)
excludeColumns - a set of names of the columns to exclude from the table.public TableProcessor.Input createInputParameter()
ProcessorValues object.
The way the properties will be looked up is to
Values object using the mapped
property name
HasDefaultValue annotation is on the field for
the property.
public TableProcessor.Output execute(TableProcessor.Input values, Processor.ExecutionContext context) throws java.lang.Exception
Processorvalues - A Java object whose public fields are populated from the Values object (which is used for transferring properties between
processors).context - The execution context for a print task.Values object. The key in the
Values
object is the name of the field or if there is a mapping in the Processor.getOutputMapperBiMap()
map, the mapped name. The key is determined in a similar way as for the input object.java.lang.Exceptionprotected void extraValidation(java.util.List<java.lang.Throwable> validationErrors,
Configuration configuration)
AbstractProcessorextraValidation in class AbstractProcessor<TableProcessor.Input,TableProcessor.Output>validationErrors - a list to add errors to so that all validation errors are reported as
one.configuration - the containing configuration