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

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


                              final Section section) throws ReportProcessingException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof SubReport == false)
      {
        if (element instanceof Section)
        {
          processSection(schema, definition, (Section) element);
          continue;
        }
        continue;
      }

      if ("toc".equals(element.getMetaData().getName()))
      {
        activateTableOfContents(schema, definition, element);
      }
      else if ("index".equals(element.getMetaData().getName()))
      {
        activateIndex(schema, definition, element);
      }

    }
View Full Code Here


    }

    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement re = section.getElement(i);
      if (re instanceof Element == false)
      {
        throw new IllegalStateException("Cannot write custom implementations of report-element.");
      }
      final Element e = (Element) re;
View Full Code Here

                              final AbstractReportDefinition reportDefinition) throws ReportProcessingException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof SubReport)
      {
        continue;
      }

      if (element instanceof Section)
      {
        processSection((Section) element, dataSchema, reportDefinition);
        continue;
      }

      final Object attribute =
          element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.ELEMENT_TYPE);
      if (attribute instanceof LegacyChartType == false)
      {
        continue;
      }

      final Object maybeChartExpression =
          element.getAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);
      if (maybeChartExpression instanceof ChartExpression == false)
      {
        continue;
      }

      final ChartExpression chartExpression = (ChartExpression) maybeChartExpression;
      final Object primaryChartExpression = element.getAttribute
          (LegacyChartElementModule.NAMESPACE, LegacyChartElementModule.PRIMARY_DATA_COLLECTOR_FUNCTION_ATTRIBUTE);
      if (primaryChartExpression instanceof Expression)
      {
        final Expression datasetExpression = (Expression) primaryChartExpression;
        final Expression datasetExpressionInstance = datasetExpression.getInstance();
        final String name = AutoGeneratorUtility.generateUniqueExpressionName
            (dataSchema, "::legacy-charts::primary-dataset::{0}", reportDefinition);
        datasetExpressionInstance.setName(name);
        chartExpression.setDataSource(name);
        reportDefinition.addExpression(datasetExpressionInstance);
      }

      if (chartExpression instanceof MultiPlotChartExpression == false)
      {
        continue;
      }
      final MultiPlotChartExpression multiPlotChartExpression = (MultiPlotChartExpression) chartExpression;

      final Object secondaryDataSourceExpression = element.getAttribute
          (LegacyChartElementModule.NAMESPACE, LegacyChartElementModule.SECONDARY_DATA_COLLECTOR_FUNCTION_ATTRIBUTE);
      if (secondaryDataSourceExpression instanceof Expression)
      {
        final Expression datasetExpression = (Expression) secondaryDataSourceExpression;
        final Expression datasetExpressionInstance = datasetExpression.getInstance();
View Full Code Here

                              final Section section) throws BundleWriterException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof Section)
      {
        processSection(documentBundle, report, (Section) element);
      }

      if (element instanceof RootLevelBand)
      {
        final RootLevelBand rl = (RootLevelBand) element;
        final SubReport[] reports = rl.getSubReports();
        for (int j = 0; j < reports.length; j++)
        {
          final SubReport subReport = reports[j];
          processSection(documentBundle, report, subReport);
        }
      }

      // Process the attributes if they are a resource key
      final ElementMetaData metaData = element.getMetaData();
      final AttributeMetaData[] attributeDescriptions = metaData.getAttributeDescriptions();
      for (int j = 0; j < attributeDescriptions.length; j++)
      {
        final AttributeMetaData attributeDescription = attributeDescriptions[j];
        if ("Resource".equals(attributeDescription.getValueRole()) == false)
        {
          continue;
        }

        final Object attribute = element.getAttribute(attributeDescription.getNameSpace(), attributeDescription.getName());
        if (attribute instanceof ResourceKey == false)
        {
          continue;
        }

        final ResourceKey resourceKey = (ResourceKey) attribute;
        final ResourceKey replacementKey = processResourceKeyAttribute(documentBundle, report, resourceKey);
        if (replacementKey != null)
        {
          element.setAttribute(attributeDescription.getNameSpace(), attributeDescription.getName(), replacementKey);
        }
      }
    }
  }
View Full Code Here

                              final Section section) throws ReportProcessingException
  {
    final int count = section.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = section.getElement(i);
      if (element instanceof SubReport)
      {
        continue;
      }

      if (element instanceof Section)
      {
        processSection(schema, definition, (Section) element);
        continue;
      }

      final Object attribute =
          element.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE);
      if (attribute instanceof Class == false)
      {
        continue;
      }

      final Class aggType = (Class) attribute;
      if (AggregationFunction.class.isAssignableFrom(aggType) == false)
      {
        continue;
      }

      try
      {
        final AggregationFunction o = (AggregationFunction) aggType.newInstance();
        final String group = (String) element.getAttribute
            (AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_GROUP);
        if (group != null)
        {
          o.setGroup(group);
        }
        else
        {
          final Group g = findGroup(element);
          if (g != null)
          {
            if (g.getName() == null)
            {
              g.setName("::wizard:group:" + g.getClass().getName() + ':' + System.identityHashCode(g));
            }

            o.setGroup(g.getName());
          }
        }

        final String fieldName = (String) element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD);
        if (o instanceof FieldAggregationFunction)
        {
          final FieldAggregationFunction fo = (FieldAggregationFunction) o;
          fo.setField(fieldName);
        }

        final Object labelFor =
            element.getAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR);
        if (labelFor == null)
        {
          element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.LABEL_FOR, fieldName);
        }

        final String name = AutoGeneratorUtility.generateUniqueExpressionName
            (schema, "::wizard:aggregation:{0}",
                (String[]) generatedExpressionNames.toArray(new String[generatedExpressionNames.size()]));
        o.setName(name);
        generatedExpressionNames.add(name);

        element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, name);
        // finally clean up
        element.setAttribute(AttributeNames.Wizard.NAMESPACE, AttributeNames.Wizard.AGGREGATION_TYPE, null);
        definition.addExpression(o);
      }
      catch (Exception e)
      {
        throw new ReportProcessingException("Failed to pre-process the report", e);
View Full Code Here

    final Object o = element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.SOURCE);
    if (o instanceof ResourceKey)
    {
      return (ResourceKey) o;
    }
    final ReportElement parent = element.getParentSection();
    if (parent != null)
    {
      return getDefinitionSource(parent);
    }
    return null;
View Full Code Here

    final Object o = element.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.CONTENT_BASE);
    if (o instanceof ResourceKey)
    {
      return (ResourceKey) o;
    }
    final ReportElement parent = element.getParentSection();
    if (parent != null)
    {
      return getContentBase(parent);
    }
    return null;
View Full Code Here

  private void iterateSection(final Section s, final UpdateTask task)
  {
    final int count = s.getElementCount();
    for (int i = 0; i < count; i++)
    {
      final ReportElement element = s.getElement(i);
      task.processElement(element);
      if (element instanceof SubReport)
      {
        continue;
      }
View Full Code Here

    {
      final int count = gb.getElementCount();
      GroupBody locatedBody = null;
      for (int i = 0; i < count; i++)
      {
        final ReportElement element = gb.getElement(i);
        if (element instanceof Group)
        {
          existingGroup = (Group) element;
          locatedBody = existingGroup.getBody();
          break;
View Full Code Here

    {
      final int count = gb.getElementCount();
      boolean found = false;
      for (int i = 0; i < count; i++)
      {
        final ReportElement element = gb.getElement(i);
        if (element instanceof Group)
        {
          existingGroup = (Group) element;
          result += 1;
          gb = existingGroup.getBody();
View Full Code Here

TOP

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

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.