本文整理汇总了Java中org.pentaho.reporting.engine.classic.core.TableDataFactory类的典型用法代码示例。如果您正苦于以下问题:Java TableDataFactory类的具体用法?Java TableDataFactory怎么用?Java TableDataFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableDataFactory类属于org.pentaho.reporting.engine.classic.core包,在下文中一共展示了TableDataFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performPreProcessing
import org.pentaho.reporting.engine.classic.core.TableDataFactory; //导入依赖的package包/类
/**
* Adds an informative table of all parameters and their values to the report. If a report has no parameters
* we dont need to add that table.
*
* This method demonstrates how to inject data via a sub-report into an existing report. It uses the
* report-wizard for the bulk of the design-work.
*
* @param report
* @param flowController
* @return
* @throws ReportProcessingException
*/
public MasterReport performPreProcessing(final MasterReport report,
final DefaultFlowController flowController) throws ReportProcessingException
{
if (report.getParameterDefinition().getParameterCount() == 0)
{
return report;
}
SubReport subReport = new SubReport();
subReport.getDetailsHeader().getStyle().setStyleProperty(TextStyleKeys.BOLD, Boolean.TRUE);
subReport.setDataFactory(new TableDataFactory("parameter-data", computeParameterData(report, flowController)));
subReport.setQuery("parameter-data");
subReport.addPreProcessor(new WizardProcessor());
subReport.setAttribute(AttributeNames.Wizard.NAMESPACE, "wizard-spec", createReportSpec());
subReport.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.ENABLE, Boolean.TRUE);
subReport.addExpression(createFormula("formatted-name", "=IF(ISBLANK([label]); [name]; [value])"));
subReport.addExpression(createFormula("formatted-value", "=CSVTEXT([value])"));
report.getReportHeader().addSubReport(subReport);
return report;
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:34,代码来源:GenerateParameterInformationPreProcessor.java
示例2: createCrosstabReport
import org.pentaho.reporting.engine.classic.core.TableDataFactory; //导入依赖的package包/类
protected MasterReport createCrosstabReport(final TableModel tableModel) {
final MasterReport report = new MasterReport();
report.setPageDefinition(new SimplePageDefinition(PageSize.A3, PageFormat.LANDSCAPE, new Insets(0, 0, 0, 0)));
report.setDataFactory(new TableDataFactory("query", tableModel));
report.setQuery("query");
final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel(report);
AggregationFunction dummy = createAggregateFunction("dummy", null, null);
if (dummy == null) {
return null;
}
final CrosstabBuilder builder = new CrosstabBuilder(dataSchemaModel);
builder.addRowDimension(ROW_DIMENSION_A);
builder.addRowDimension(ROW_DIMENSION_B);
builder.addColumnDimension(COLUMN_DIMENSION_A);
builder.addColumnDimension(COLUMN_DIMENSION_B);
builder.addDetails(VALUE, dummy.getClass());
report.setRootGroup(builder.create());
return report;
}
示例3: createRelationalReport
import org.pentaho.reporting.engine.classic.core.TableDataFactory; //导入依赖的package包/类
protected MasterReport createRelationalReport(final TableModel tableModel,
final String... additionalFields) {
final MasterReport report = new MasterReport();
report.setPageDefinition(new SimplePageDefinition(PageSize.A3, PageFormat.LANDSCAPE, new Insets(0, 0, 0, 0)));
report.setDataFactory(new TableDataFactory("query", tableModel));
report.setQuery("query");
final DesignTimeDataSchemaModel dataSchemaModel = new DesignTimeDataSchemaModel(report);
final RelationalReportBuilder builder = new RelationalReportBuilder(dataSchemaModel);
builder.addGroup(ROW_DIMENSION_A);
builder.addGroup(ROW_DIMENSION_B);
builder.addGroup(COLUMN_DIMENSION_A);
builder.addGroup(COLUMN_DIMENSION_B);
builder.addDetails(VALUE, null, Color.lightGray);
builder.addDetails("relational", null, Color.yellow);
for (int i = 0; i < additionalFields.length; i++) {
String additionalField = additionalFields[i];
builder.addDetails(additionalField, null, null);
}
report.setRootGroup(builder.create());
return report;
}
示例4: configureReport
import org.pentaho.reporting.engine.classic.core.TableDataFactory; //导入依赖的package包/类
private MasterReport configureReport() {
PlainParameter plainParam = new PlainParameter("text-parameter", String.class);
plainParam.setDefaultValue("Hello World!");
DefaultListParameter listParam = new DefaultListParameter
("param-query", "key", "value", "list-param", true, false, String.class);
listParam.setDefaultValue(new String[]{"One", "Two", "Three"});
DefaultParameterDefinition params = new DefaultParameterDefinition();
params.addParameterDefinition(plainParam);
params.addParameterDefinition(listParam);
TypedTableModel model = new TypedTableModel();
model.addColumn("key", String.class);
model.addColumn("value", String.class);
model.addRow("One", "First Row");
model.addRow("Two", "Second Row");
model.addRow("Three", "Third Row");
model.addRow("Four", "Fourth Row");
TableDataFactory dataFactory = new TableDataFactory();
dataFactory.addTable("param-query", model);
MasterReport report = new MasterReport();
report.setDataFactory(dataFactory);
report.getPageFooter().addElement(TableTestUtil.createDataItem("Dummy Item"));
report.setParameterDefinition(params);
return report;
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:30,代码来源:GenerateParameterInformationPreProcessorTest.java
示例5: getContextDataFactory
import org.pentaho.reporting.engine.classic.core.TableDataFactory; //导入依赖的package包/类
public DataFactory getContextDataFactory()
{
final TypedTableModel tableModel = new TypedTableModel();
tableModel.addColumn("Id", Integer.class);
tableModel.addColumn("Value", String.class);
tableModel.addRow(1, "North");
tableModel.addRow(2, "East");
tableModel.addRow(3, "South");
tableModel.addRow(4, "West");
return new TableDataFactory("backend-query", tableModel);
}
示例6: doPost
import org.pentaho.reporting.engine.classic.core.TableDataFactory; //导入依赖的package包/类
@Override
public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
try {
// Declaring a report.
MasterReport report = new MasterReport();
// Loading the Table DataFactory.
DefaultTableModel tableModel = new DefaultTableModel(
new Object[][] {
{"Product A", 123},
{"Product B", 234},
{"Product C", 345},
{"Product D", 456}
},
new String[] {"Product", "Cost"});
TableDataFactory dataFactory = new TableDataFactory();
dataFactory.addTable("default", tableModel);
report.setDataFactory(dataFactory);
// Getting the item band to host the elements.
ItemBand itemBand = report.getItemBand();
// Adding a text field for the product name, added to the item band.
TextFieldElementFactory textFactory = new TextFieldElementFactory();
textFactory.setFieldname("Product");
textFactory.setX(1f);
textFactory.setY(1f);
textFactory.setMinimumWidth(200f);
textFactory.setMinimumHeight(20f);
Element nameField = textFactory.createElement();
itemBand.addElement(nameField);
// Adding a number filed with the total cost of the products.
NumberFieldElementFactory numberFactory = new NumberFieldElementFactory();
numberFactory.setFieldname("Cost");
numberFactory.setX(201f);
numberFactory.setY(1f);
numberFactory.setMinimumWidth(100f);
numberFactory.setMinimumHeight(20f);
Element totalCost = numberFactory.createElement();
itemBand.addElement(totalCost);
// Conversion to PDF and rendering.
response.setContentType("application/pdf");
PdfReportUtil.createPDF(report, response.getOutputStream());
}
catch (Exception e)
{
e.printStackTrace();
}
}