本文整理汇总了Java中org.pentaho.reporting.engine.classic.core.MasterReport类的典型用法代码示例。如果您正苦于以下问题:Java MasterReport类的具体用法?Java MasterReport怎么用?Java MasterReport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MasterReport类属于org.pentaho.reporting.engine.classic.core包,在下文中一共展示了MasterReport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSaveAndLoad
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
public void testSaveAndLoad() throws Exception
{
MasterReport report = new MasterReport();
report.getReportHeader().addElement(createElement());
ByteArrayOutputStream bout = new ByteArrayOutputStream();
BundleWriter.writeReportToZipStream(report, bout);
ResourceManager mgr = new ResourceManager();
MasterReport loadedReport = (MasterReport) mgr.createDirectly(bout.toByteArray(), MasterReport.class).getResource();
assertEquals(1, loadedReport.getReportHeader().getElementCount());
Element element = loadedReport.getReportHeader().getElement(0);
assertTrue(element.getElementType() instanceof SampleTextElementType);
assertEquals("Test message for validation: {0}",
element.getAttribute(SampleElementModule.NAMESPACE, SampleTextElementType.TEMPLATE_STRING));
runAndValidateReport(loadedReport);
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:20,代码来源:SampleTextElementTest.java
示例2: doPost
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
@Override
public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
try {
// Getting the report.
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
Resource res = manager.createDirectly(
new URL("file:resources/interactive_report_2.prpt"),
MasterReport.class);
MasterReport report = (MasterReport) res.getResource();
// Mandatory parameter.
report.getParameterValues().put("LINE", request.getParameter("line"));
// Conversion to HTML and rendering.
response.setContentType("text/html");
HtmlReportUtil.createStreamHTML(report, response.getOutputStream());
}
catch (Exception e)
{
e.printStackTrace();
}
}
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:31,代码来源:PentahoServlet2.java
示例3: preview
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
public void preview() {
try {
AbstractReportDefinition element = processWizardSpecification();
SwtXulLoader theXulLoader = new SwtXulLoader();
theXulLoader.registerClassLoader(getClass().getClassLoader());
theXulLoader.setOuterContext(((XulRoot) document.getRootElement()).getRootObject());
theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag");
theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/wizard/prptPreview.xul");
theXulContainer.addEventHandler(new PreviewCloseHandler());
SwtXulRunner theRunner = new SwtXulRunner();
theRunner.addContainer(theXulContainer);
theRunner.initialize();
PrptViewerTag thePrptViewerTag = (PrptViewerTag) theXulContainer.getDocumentRoot().getElementById("prptViewer");
thePrptViewerTag.setMasterReport((MasterReport) element);
XulDialog theDialog = (XulDialog) theXulContainer.getDocumentRoot().getElementById("prpt-preview");
theDialog.show();
} catch (Exception e) {
e.printStackTrace();
logger.error("error previewing", e);
}
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:26,代码来源:PreviewWizardController.java
示例4: finish
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
public void finish() {
try {
MasterReport element = (MasterReport) processWizardSpecification();
element = WizardProcessorUtil.materialize(element, new WizardProcessor());
VisualizationManager theManager = VisualizationManager.getInstance();
PRPTVisualization theVisualization = (PRPTVisualization) theManager.getVisualization("Report Wizard");
if (theVisualization != null) {
theVisualization.createVisualizationFromMasterReport(element, tempModel);
}
((XulDialog) document.getElementById("main_wizard_window")).hide();
} catch (Exception e) {
e.printStackTrace();
logger.error("error finishing", e);
}
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:17,代码来源:PreviewWizardController.java
示例5: testPrptSetMasterReport
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
@Test
public void testPrptSetMasterReport() throws Exception{
if(ClassicEngineBoot.getInstance().isBootDone() == false){
ClassicEngineBoot engineBoot = ClassicEngineBoot.getInstance();
engineBoot.start();
}
SwtXulLoader loader = new SwtXulLoader();
loader.register("PRPT", PrptViewerTag.class.getCanonicalName());
XulDomContainer container = loader.loadXul("org/pentaho/agilebi/test/res/prpt.xul");
PrptViewerTag prpt = (PrptViewerTag) container.getDocumentRoot().getElementById("prptViewer");
ResourceManager theResourceManager = new ResourceManager();
theResourceManager.registerDefaults();
File theReportFile = new File("test-res/test.prpt");
Resource theResource = theResourceManager.createDirectly(theReportFile, MasterReport.class);
MasterReport masterReport = (MasterReport) theResource.getResource();
prpt.setMasterReport(masterReport);
}
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:24,代码来源:TestPrptComponent.java
示例6: ReportExportTask
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
/**
* Creates a new PDF export task.
*/
public ReportExportTask( final MasterReport report, final SwingGuiContext swingGuiContext, String targetPath,
Boolean createParentFolder ) {
if ( report == null ) {
throw new NullPointerException( "ReportExportTask(..): Report parameter cannot be null" );
}
this.report = report;
this.statusListener = swingGuiContext.getStatusListener();
this.messages =
new Messages( swingGuiContext.getLocale(), BASE_RESOURCE_CLASS,
ObjectUtilities.getClassLoader( ReportExportTask.class ) );
this.targetPath = targetPath;
this.createParentFolder = createParentFolder;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:ReportExportTask.java
示例7: testSerialize
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
public void testSerialize() throws Exception
{
MasterReport report = new MasterReport();
report.getReportHeader().addElement(createElement());
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
oout.writeObject(report);
oout.close();
ObjectInputStream oin = new ObjectInputStream(new ByteArrayInputStream(bout.toByteArray()));
MasterReport loadedReport = (MasterReport) oin.readObject();
assertEquals(1, loadedReport.getReportHeader().getElementCount());
Element element = loadedReport.getReportHeader().getElement(0);
assertTrue(element.getElementType() instanceof SampleTextElementType);
assertEquals("Test message for validation: {0}",
element.getAttribute(SampleElementModule.NAMESPACE, SampleTextElementType.TEMPLATE_STRING));
runAndValidateReport(loadedReport);
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:22,代码来源:SampleTextElementTest.java
示例8: runAndValidateReport
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
private void runAndValidateReport(final MasterReport report) throws ReportProcessingException, ContentProcessingException
{
LogicalPageBox box = DebugReportRunner.layoutSingleBand(report, report.getReportHeader());
RenderNode node = MatchFactory.findElementByName(box, "test-element");
assertEquals(RenderableReplacedContentBox.class, node.getClass());
RenderableReplacedContentBox rb = (RenderableReplacedContentBox) node;
RenderableReplacedContent content = rb.getContent();
Object rawObject = content.getRawObject();
assertTrue(rawObject instanceof DrawableWrapper);
DrawableWrapper wrapper = (DrawableWrapper) rawObject;
assertTrue(wrapper.getBackend() instanceof SampleGraphicsDrawable);
SampleGraphicsDrawable sgd = (SampleGraphicsDrawable) wrapper.getBackend();
assertEquals("Test message for validation: null", sgd.getTextToPrint());
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:17,代码来源:SampleGraphicsElementTest.java
示例9: testSaveAndLoad
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
public void testSaveAndLoad() throws Exception
{
MasterReport report = new MasterReport();
report.getReportHeader().addElement(createElement());
ByteArrayOutputStream bout = new ByteArrayOutputStream();
BundleWriter.writeReportToZipStream(report, bout);
ResourceManager mgr = new ResourceManager();
MasterReport loadedReport = (MasterReport) mgr.createDirectly(bout.toByteArray(), MasterReport.class).getResource();
assertEquals(1, loadedReport.getReportHeader().getElementCount());
Element element = loadedReport.getReportHeader().getElement(0);
assertTrue(element.getElementType() instanceof SampleGraphicsElementType);
assertEquals("Test message for validation: {0}",
element.getAttribute(SampleElementModule.NAMESPACE, SampleGraphicsElementType.TEMPLATE_STRING));
assertEquals(0.5f,element.getStyle().getStyleProperty(SampleElementStyleKeys.IMAGE_BACKGROUND_ALPHA));
runAndValidateReport(loadedReport);
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:21,代码来源:SampleGraphicsElementTest.java
示例10: testSerialize
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
public void testSerialize() throws Exception
{
MasterReport report = new MasterReport();
report.getReportHeader().addElement(createElement());
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
oout.writeObject(report);
oout.close();
ObjectInputStream oin = new ObjectInputStream(new ByteArrayInputStream(bout.toByteArray()));
MasterReport loadedReport = (MasterReport) oin.readObject();
assertEquals(1, loadedReport.getReportHeader().getElementCount());
Element element = loadedReport.getReportHeader().getElement(0);
assertTrue(element.getElementType() instanceof SampleGraphicsElementType);
assertEquals("Test message for validation: {0}",
element.getAttribute(SampleElementModule.NAMESPACE, SampleGraphicsElementType.TEMPLATE_STRING));
assertEquals(0.5f,element.getStyle().getStyleProperty(SampleElementStyleKeys.IMAGE_BACKGROUND_ALPHA));
runAndValidateReport(loadedReport);
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:23,代码来源:SampleGraphicsElementTest.java
示例11: performPreProcessing
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的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
示例12: computeParameterData
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
/**
* Convert the parameters defined on the report into a table-model that can be consumed by the
* sub-report.
*
* @param report
* @param flowController
* @return
* @throws ReportProcessingException
*/
private TypedTableModel computeParameterData(final MasterReport report,
final DefaultFlowController flowController) throws ReportProcessingException
{
ReportParameterDefinition parameterDefinition = report.getParameterDefinition();
ParameterContext pc = new DefaultParameterContext(report);
TypedTableModel data = new TypedTableModel();
data.addColumn("name", String.class);
data.addColumn("label", String.class);
data.addColumn("value", Object.class);
for (ParameterDefinitionEntry p : parameterDefinition.getParameterDefinitions())
{
String label = p.getParameterAttribute
(ParameterAttributeNames.Core.NAMESPACE, ParameterAttributeNames.Core.LABEL, pc);
Object value = flowController.getMasterRow().getGlobalView().get(p.getName());
data.addRow(p.getName(), label, value);
}
return data;
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:28,代码来源:GenerateParameterInformationPreProcessor.java
示例13: testApply
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
@Test
public void testApply() throws Exception
{
ReportPreProcessor preProcessor = create();
MasterReport report = new MasterReport();
report.getPageFooter().addElement(TableTestUtil.createDataItem("Dummy Item"));
report.addPreProcessor(preProcessor);
MasterReport materialize = materialize(report.derive(true), preProcessor);
Assert.assertEquals(BandStyleKeys.LAYOUT_BLOCK, materialize.getPageFooter().getLayout());
Assert.assertEquals(2, materialize.getPageFooter().getElementCount());
Band oldContent = (Band) materialize.getPageFooter().getElement(0);
Assert.assertEquals(1, oldContent.getElementCount());
Assert.assertEquals(report.getPageFooter().getElement(0).getObjectID(), oldContent.getElement(0).getObjectID());
Band newContent = (Band) materialize.getPageFooter().getElement(1);
Assert.assertEquals(1, newContent.getElementCount());
Assert.assertEquals("Text",
newContent.getElement(0).getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE));
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:25,代码来源:SamplePreProcessorTest.java
示例14: testApply
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
@Test
public void testApply() throws Exception {
ReportPreProcessor preProcessor = create();
MasterReport report = configureReport();
report.addPreProcessor(preProcessor);
MasterReport materialize = materialize(report.derive(true), preProcessor);
Assert.assertEquals(1, materialize.getReportHeader().getSubReportCount());
SubReport sr = materialize.getReportHeader().getSubReport(0);
DataFactory dataFactory = sr.getDataFactory();
TableModel tableModel = dataFactory.queryData("parameter-data", new StaticDataRow());
Assert.assertEquals(tableModel.getColumnCount(), 3);
Assert.assertEquals(tableModel.getRowCount(), 2);
Assert.assertNotNull(sr.getAttribute(AttributeNames.Wizard.NAMESPACE, "wizard-spec"));
Assert.assertEquals(1, sr.getPreProcessorCount());
Assert.assertEquals(WizardProcessor.class, sr.getPreProcessor(0).getClass());
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:21,代码来源:GenerateParameterInformationPreProcessorTest.java
示例15: configureReport
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
private MasterReport configureReport(MasterReport report, boolean relational) {
report.addExpression(create("relational", null, COLUMN_DIMENSION_B));
report.addExpression(new ValidateFunctionResultExpression("#relational", isFailHardOnError(), null));
if (relational) {
return report;
}
report.addExpression(create("cell", COLUMN_DIMENSION_B, ROW_DIMENSION_B));
report.addExpression(new ValidateFunctionResultExpression("#cell", isFailHardOnError(), COLUMN_DIMENSION_B));
report.addExpression(create("row-b", COLUMN_DIMENSION_A, ROW_DIMENSION_B));
report.addExpression(new ValidateFunctionResultExpression("#row-b", isFailHardOnError(), COLUMN_DIMENSION_A));
report.addExpression(create("row-a", COLUMN_DIMENSION_A, ROW_DIMENSION_A));
report.addExpression(new ValidateFunctionResultExpression("#row-a", isFailHardOnError(), COLUMN_DIMENSION_A));
report.addExpression(create("column-a", null, COLUMN_DIMENSION_A));
report.addExpression(new ValidateFunctionResultExpression("#column-a", isFailHardOnError(), null));
report.addExpression(create("column-b", COLUMN_DIMENSION_B, ROW_DIMENSION_A));
report.addExpression(new ValidateFunctionResultExpression("#column-b", isFailHardOnError(), COLUMN_DIMENSION_B));
return report;
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:26,代码来源:ExpressionTestBase.java
示例16: createCrosstabReport
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的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;
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:22,代码来源:ExpressionTestBase.java
示例17: createRelationalReport
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的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;
}
开发者ID:tmorgner,项目名称:pentaho-reporting-oem-sdk,代码行数:24,代码来源:ExpressionTestBase.java
示例18: doPost
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
@Override
public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
try {
// Getting the report.
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
Resource res = manager.createDirectly(
new URL("file:resources/interactive_report_1.prpt"),
MasterReport.class);
MasterReport report = (MasterReport) res.getResource();
// Conversion to HTML and rendering.
response.setContentType("text/html");
HtmlReportUtil.createStreamHTML(report, response.getOutputStream());
}
catch (Exception e)
{
e.printStackTrace();
}
}
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:28,代码来源:PentahoServlet.java
示例19: doPost
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
@Override
public void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
// Prpt file.
String reportPath = "file:" + this.getServletContext().getRealPath("WEB-INF/classes/reports/my_first_report.prpt");
try
{
// Resource manager.
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
// Get report.
Resource res = manager.createDirectly(new URL(reportPath), MasterReport.class);
MasterReport report = (MasterReport) res.getResource();
// Generate report in PDF into the response.
response.setContentType("application/pdf");
PdfReportUtil.createPDF(report, response.getOutputStream());
}
catch (Exception e)
{
e.printStackTrace();
}
}
开发者ID:fcorti,项目名称:pentaho-8-reporting-for-java-developers,代码行数:32,代码来源:PentahoServlet2.java
示例20: loadMasterReport
import org.pentaho.reporting.engine.classic.core.MasterReport; //导入依赖的package包/类
public static MasterReport loadMasterReport(String sourceFilename) throws Exception {
ResourceManager manager = new ResourceManager();
manager.registerDefaults();
FileObject fileObject = KettleVFS.getFileObject(sourceFilename);
URL url = new URL(fileObject.getName().getURI());
Resource resource = manager.createDirectly(url, MasterReport.class);
MasterReport report = (MasterReport) resource.getResource();
return report;
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:11,代码来源:PentahoReportingOutput.java
注:本文中的org.pentaho.reporting.engine.classic.core.MasterReport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论