Package org.pentaho.reporting.engine.classic.core

Examples of org.pentaho.reporting.engine.classic.core.SubReport


  }

  @Test
  public void testInlineSubReportIsInline() throws Exception
  {
    SubReport subReport = new SubReport();
    subReport.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, BandStyleKeys.LAYOUT_INLINE);

    MasterReport report = new MasterReport();
    report.getReportHeader().addElement(subReport);
    LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage(report, 0);
  }
View Full Code Here


      throws SAXException
  {
    final RootXmlReadHandler rootHandler = getRootHandler();
    final Object maybeReport = rootHandler.getHelperObject
        (ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    final SubReport report;
    if (maybeReport instanceof SubReport == false)
    {
      // replace it ..
      report = new SubReport();
      report.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE, getRootHandler().getSource());
    }
    else
    {
      report = (SubReport) maybeReport;
    }

    if (ReportParserUtil.isIncluded(rootHandler) == false)
    {
      final String query = attrs.getValue(getUri(), "query");
      if (query != null)
      {
        report.setQuery(query);
      }
    }

    if (rootHandler.getHelperObject(ExtSubReportReadHandler.ELEMENT_FACTORY_KEY) == null)
    {
      final ElementFactoryCollector elementFactory = new ElementFactoryCollector();
      rootHandler.setHelperObject(ExtSubReportReadHandler.ELEMENT_FACTORY_KEY, elementFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.STYLE_FACTORY_KEY) == null)
    {
      final StyleKeyFactoryCollector styleKeyFactory = new StyleKeyFactoryCollector();
      rootHandler.setHelperObject(ExtSubReportReadHandler.STYLE_FACTORY_KEY, styleKeyFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.CLASS_FACTORY_KEY) == null)
    {
      final ClassFactoryCollector classFactory = new ClassFactoryCollector();
      classFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.CLASS_FACTORY_KEY, classFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.DATASOURCE_FACTORY_KEY) == null)
    {
      final DataSourceCollector dataSourceFactory = new DataSourceCollector();
      dataSourceFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.DATASOURCE_FACTORY_KEY, dataSourceFactory);
    }
    if (rootHandler.getHelperObject(ExtSubReportReadHandler.TEMPLATE_FACTORY_KEY) == null)
    {
      final TemplateCollector templateFactory = new TemplateCollector();
      templateFactory.configure(rootHandler.getParserConfiguration());
      rootHandler.setHelperObject(ExtSubReportReadHandler.TEMPLATE_FACTORY_KEY, templateFactory);
    }

    report.setName(attrs.getValue(getUri(), "name"));

    rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
    if (rootHandler.getHelperObject(ReportParserUtil.HELPER_OBJ_LEGACY_STYLES) instanceof HashMap == false)
    {
      rootHandler.setHelperObject(ReportParserUtil.HELPER_OBJ_LEGACY_STYLES, new HashMap<String, ElementStyleSheet>());
View Full Code Here

   * @throws SAXException if there is a parsing error.
   */
  protected void doneParsing() throws SAXException
  {
    super.doneParsing();
    final SubReport report = getSubReport();
    for (int i = 0; i < importParameters.size(); i++)
    {
      final ParameterMappingReadHandler handler = importParameters.get(i);
      report.addInputParameter(handler.getName(), handler.getAlias());
    }
    for (int i = 0; i < exportParameters.size(); i++)
    {
      final ParameterMappingReadHandler handler = exportParameters.get(i);
      report.addExportParameter(handler.getAlias(), handler.getName());
    }
  }
View Full Code Here

        return;
      }

      if (report instanceof SubReport)
      {
        final SubReport sr = (SubReport) report;
        if (isInlineSubReport(sr))
        {
          valid = false;
          return;
        }
View Full Code Here

    model.addRow("b", "3", "row-6");
    model.addRow("a", "1", "row-7");
    model.addRow("b", "1", "row-8");
    model.addRow("b", "2", "row-9");

    final SubReport report = new SubReport();
    report.addGroup(new RelationalGroup());
    report.setDataFactory(new TableDataFactory("query", model));
    report.setQuery("query");
    report.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH, 200f);
    report.getStyle().setStyleProperty(ElementStyleKeys.POS_X, 100f);
    report.getStyle().setStyleProperty(ElementStyleKeys.POS_Y, 20f);

    final RelationalGroup group0 = (RelationalGroup) report.getGroup(0);
    group0.setName("outer-group");
    group0.addField("g0");
    group0.getHeader().addElement(TableTestUtil.createDataItem("outer-header-field", 100, 20));
    group0.getFooter().addElement(TableTestUtil.createDataItem("outer-footer-field", 100, 20));
    group0.getStyle().setStyleProperty(ElementStyleKeys.WIDOWS, 2);

    final RelationalGroup group1 = (RelationalGroup) report.getGroup(1);
    group1.setName("inner-group");
    group1.addField("g1");
    group1.getHeader().addElement(TableTestUtil.createDataItem("inner-header-field", 100, 20));
    group1.getFooter().addElement(TableTestUtil.createDataItem("inner-footer-field", 100, 20));
    group1.getStyle().setStyleProperty(ElementStyleKeys.WIDOWS, 2);

    report.getItemBand().addElement(TableTestUtil.createDataItem("detail-field", 100, 20));
    report.getItemBand().getParentSection().getStyle().setStyleProperty(ElementStyleKeys.WIDOWS, 2);


    final MasterReport master = new MasterReport();
    master.setPageDefinition(new SimplePageDefinition(new PageSize(500, 100)));
    master.getReportHeader().addElement(report);
View Full Code Here


  public void testErrorDoesNotCloseSubreport() throws Exception
  {
    final TestDataFactory dataFactory = new TestDataFactory();
    final SubReport subreport = new SubReport();
    subreport.setQuery("Query");
    subreport.setDataFactory(dataFactory);

    final MasterReport report = new MasterReport();
    report.getReportHeader().addSubReport(subreport);

    final TestPrintReportProcessor reportProcessor = new TestPrintReportProcessor(report);
View Full Code Here

    else
    {
      if (ReportParserUtil.INCLUDE_PARSING_VALUE.equals(getRootHandler().getHelperObject
          (ReportParserUtil.INCLUDE_PARSING_KEY)))
      {
        report = new SubReport();
      }
      else
      {
        report = new MasterReport();
      }
View Full Code Here

          contentState.getFileName());
      dataSourceAtts.setAttribute(BundleNamespaces.DATADEFINITION, "ref", relativePath);// NON-NLS
    }
    else if (report instanceof SubReport)
    {
      final SubReport subreport = (SubReport) report;
      if (subreport.getDataFactory() != null)
      {
        final String dataSourceDefFile = writeDataFactory(bundle, contentState, subreport.getDataFactory());
        final String relativePath = IOUtils.getInstance().createRelativePath(dataSourceDefFile,
            contentState.getFileName());
        dataSourceAtts.setAttribute(BundleNamespaces.DATADEFINITION, "ref", relativePath);// NON-NLS
      }
    }
View Full Code Here

  {
    final AbstractReportDefinition report = state.getReport();
    if (report instanceof SubReport)
    {
      writer.writeTag(BundleNamespaces.DATADEFINITION, "parameter-mapping", XmlWriterSupport.OPEN);// NON-NLS
      final SubReport subReport = (SubReport) report;
      final ParameterMapping[] inputMappings = subReport.getInputMappings();
      for (int i = 0; i < inputMappings.length; i++)
      {
        final ParameterMapping mapping = inputMappings[i];
        final AttributeList attList = new AttributeList();
        attList.setAttribute(BundleNamespaces.DATADEFINITION, "name", mapping.getName());// NON-NLS
        attList.setAttribute(BundleNamespaces.DATADEFINITION, "alias", mapping.getAlias());// NON-NLS
        writer.writeTag(BundleNamespaces.DATADEFINITION, "input-parameter", attList, XmlWriterSupport.CLOSE);// NON-NLS
      }

      final ParameterMapping[] exportMappings = subReport.getExportMappings();
      for (int i = 0; i < exportMappings.length; i++)
      {
        final ParameterMapping mapping = exportMappings[i];
        final AttributeList attList = new AttributeList();
        attList.setAttribute(BundleNamespaces.DATADEFINITION, "name", mapping.getName());// NON-NLS
View Full Code Here

  {
    final Object maybeReport = getRootHandler().getHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME);
    if (maybeReport instanceof SubReport == false)
    {
      // replace it ..
      report = new SubReport();
      getRootHandler().setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
    }
    else
    {
      report = (SubReport) maybeReport;
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.SubReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.