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

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


  protected void startParsing(final Attributes attrs) throws SAXException
  {
    super.startParsing(attrs);

    final Object maybeReport = getRootHandler().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;
    }
View Full Code Here


    {
      final RootLevelBand rlb = (RootLevelBand) section;
      final SubReport[] reports = rlb.getSubReports();
      for (int i = 0; i < reports.length; i++)
      {
        final SubReport report = reports[i];
        if ("toc".equals(report.getMetaData().getName()))
        {
          activateTableOfContents(schema, definition, report);
        }
        else if ("index".equals(report.getMetaData().getName()))
        {
          activateIndex(schema, definition, report);
        }

      }
View Full Code Here

    report.setQuery("org.pentaho.reporting.engine.classic.testcases.base.functionality.demohandler.SubReportProcessingCrashTestHandler#createMainTableModel()");

    final Element textElement = TextFieldElementFactory.createStringElement("reportField1", new Rectangle(0, 0, 100, 20), Color.BLACK, ElementAlignment.LEFT, ElementAlignment.TOP, new FontDefinition("Arial", 12), "-", "c1");
    report.getItemBand().addElement(textElement);

    final SubReport subReport = new SubReport();
    subReport.addInputParameter("c1", "c1");

    subReport.setQuery("org.pentaho.reporting.engine.classic.testcases.base.functionality.demohandler.SubReportProcessingCrashTestHandler#createSubReportTableModel(c1)");
    final Element subReportTextElement = TextFieldElementFactory.createStringElement("subreportField1", new Rectangle(20, 0, 100, 20), Color.RED, ElementAlignment.LEFT, ElementAlignment.TOP, new FontDefinition("Arial", 12), "-", "t1");
    subReport.getItemBand().addElement(subReportTextElement);
    report.getItemBand().addSubReport(subReport);

    final Element textElementT1 = TextFieldElementFactory.createStringElement("reportFieldT1", new Rectangle(0, 20, 100, 20), Color.BLACK, ElementAlignment.LEFT, ElementAlignment.TOP, new FontDefinition("Arial", 12), "-", "t2");
    report.getItemBand().addElement(textElementT1);

    final ParameterMapping[] parameterMappings = subReport.getExportMappings();

    for (int i = 0; i < parameterMappings.length; i++)
    {
      final ParameterMapping parameterMapping = parameterMappings[i];
      logger.debug("parameterMapping.getAlias() = " + parameterMapping.getAlias());
View Full Code Here

      final AbstractRootLevelBand arb = (AbstractRootLevelBand) rootLevelBand;

      for (int i = 0; i < subreports.size(); i++)
      {
        final SubreportElementReadHandler readHandler = (SubreportElementReadHandler) subreports.get(i);
        final SubReport subReport = (SubReport) readHandler.getObject();
        arb.addSubReport(subReport);
      }
    }

    if (verticalLinealModel != null)
View Full Code Here

  /**
   * Creates a new SubReport.
   */
  public static SubReport createSubReport(TableModel tm, int columnsPerPage)
  {
    SubReport report = new SubReport();

    report.setReportHeader(new ReportHeader());
    report.setReportFooter(new ReportFooter());
    report.setPageHeader(initPageHeader("SubReport " + columnsPerPage));
    report.setPageFooter(new PageFooter());

    ItemBand items = report.getItemBand();
    items.getStyle().setStyleProperty(ElementStyleKeys.BACKGROUND_COLOR, Color.lightGray);
    items.setName("Items");

    ContentFieldElementFactory tfFactory = new ContentFieldElementFactory();
    items.getStyle().setFontDefinitionProperty(HEADER_FONT);
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

      throws IOException, ReportWriterException
  {
    final int subReportCount = band.getSubReportCount();
    for (int i = 0; i < subReportCount; i++)
    {
      final SubReport sreport = band.getSubReport(i);
      final ReportWriterContext context =
          new ReportWriterContext(sreport, getReportWriter());
      final SubReportDefinitionWriter writer =
          new SubReportDefinitionWriter(context, getXmlWriter());
      writer.write();
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);
  }
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 =
          (ParameterMappingReadHandler) importParameters.get(i);
      report.addInputParameter(handler.getName(), handler.getAlias());
    }
    for (int i = 0; i < exportParameters.size(); i++)
    {
      final ParameterMappingReadHandler handler =
          (ParameterMappingReadHandler) exportParameters.get(i);
      report.addExportParameter(handler.getAlias(), handler.getName());
    }
  }
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.