本文整理汇总了Java中org.pentaho.reporting.engine.classic.core.MasterReport类的典型用法代码示例。如果您正苦于以下问题:Java MasterReport类的具体用法?Java MasterReport怎么用?Java MasterReport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MasterReport类属于org.pentaho.reporting.engine.classic.core包,在下文中一共展示了MasterReport类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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));
}
示例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;
}