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

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


    final MasterReport report = new MasterReport();
    final StaticDataFactory staticDataFactory = new StaticDataFactory();
    report.setDataFactory(staticDataFactory);
    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++)
View Full Code Here


   *
   * @return the newly generated instance of the element.
   */
  public Element createElement()
  {
    final Element element = new Element();
    applyElementName(element);
    applyStyle(element.getStyle());

    element.setElementType(new PieSparklineType());
    if (getContent() != null)
    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent());
    }
    if (getFieldname() != null)
    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname());
    }
    if (getFormula() != null)
    {
      final FormulaExpression formulaExpression = new FormulaExpression();
      formulaExpression.setFormula(getFormula());
      element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
    }
    if (startAngle != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.START_ANGLE, startAngle);
    }
    if (lowSlice != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.LOW_SLICE, lowSlice);
    }
    if (mediumSlice != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.MEDIUM_SLICE, mediumSlice);
    }
    if (highSlice != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.HIGH_SLICE, highSlice);
    }
    if (counterClockwise != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.COUNTER_CLOCKWISE,
          counterClockwise);
    }

    return element;
  }
View Full Code Here

   *
   * @return the newly generated instance of the element.
   */
  public Element createElement()
  {
    final Element element = new Element();
    applyElementName(element);
    applyStyle(element.getStyle());

    element.setElementType(new BarSparklineType());
    if (getContent() != null)
    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent());
    }
    if (getFieldname() != null)
    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname());
    }
    if (getFormula() != null)
    {
      final FormulaExpression formulaExpression = new FormulaExpression();
      formulaExpression.setFormula(getFormula());
      element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
    }
    if (spacing != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.SPACING, spacing);
    }

    return element;
  }
View Full Code Here

   *
   * @return the newly generated instance of the element.
   */
  public Element createElement()
  {
    final Element element = new Element();
    applyElementName(element);
    applyStyle(element.getStyle());

    element.setElementType(new LineSparklineType());
    if (getContent() != null)
    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, getContent());
    }
    if (getFieldname() != null)
    {
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FIELD, getFieldname());
    }
    if (getFormula() != null)
    {
      final FormulaExpression formulaExpression = new FormulaExpression();
      formulaExpression.setFormula(getFormula());
      element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
    }
    if (spacing != null)
    {
      element.setAttribute(SparklineAttributeNames.NAMESPACE, SparklineAttributeNames.SPACING, spacing);
    }
    return element;
  }
View Full Code Here

    factory.setNullString("<null>");
    factory.setFormatString("d-MMM-yyyy");
    factory.setFieldname("report.date");
    header.addElement(factory.createElement());

    final Element line = HorizontalLineElementFactory.createHorizontalLine(16);
    line.getStyle().setStyleProperty(ElementStyleKeys.STROKE, new BasicStroke(2));
    line.getStyle().setStyleProperty(ElementStyleKeys.PAINT, Color.decode("#CFCFCF"));
    header.addElement(line);
    return header;
  }
View Full Code Here

    // this is the opposite of the HideElementByName function.
    final boolean visible = isVisible();
    final Element[] elements = FunctionUtilities.findAllElements(b, getElement());
    for (int i = 0; i < elements.length; i++)
    {
      final Element element = elements[i];
      element.setVisible(visible);
    }
  }
View Full Code Here

      if (doc == null)
      {
        return value;
      }

      final Element element = process(doc.getDefaultRootElement());
      return RichTextConverterUtilities.convertToBand(StyleKey.getDefinedStyleKeys(), source, element);
    }
    catch (Exception e)
    {
      return value;
View Full Code Here

    if (textElement.isLeaf())
    {
      final AttributeSet attributes = textElement.getAttributes();
      if (HTML.Tag.IMG.equals(attributes.getAttribute(StyleConstants.NameAttribute)))
      {
        final Element result = new Element();
        result.setName(textElement.getName());
        result.setElementType(ContentType.INSTANCE);
        final String src = (String) attributes.getAttribute(HTML.Attribute.SRC);
        final String alt = (String) attributes.getAttribute(HTML.Attribute.TITLE);
        result.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, convertURL(src));
        result.setAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.TITLE, alt);
        result.setAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Swing.TOOLTIP, alt);
        if (attributes.isDefined(HTML.Attribute.WIDTH) &&
            attributes.isDefined(HTML.Attribute.HEIGHT))
        {
          result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.TRUE);
          result.getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.FALSE);
          result.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH,
              parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.WIDTH))));
          result.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT,
              parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.HEIGHT))));
        }
        else if (attributes.isDefined(HTML.Attribute.WIDTH))
        {
          result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.TRUE);
          result.getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.TRUE);
          result.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH,
              parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.WIDTH))));
          result.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
        }
        else if (attributes.isDefined(HTML.Attribute.HEIGHT))
        {
          result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.TRUE);
          result.getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.TRUE);
          result.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT,
              parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.HEIGHT))));
          result.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
        }
        else
        {
          result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.FALSE);
          result.getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.TRUE);
          result.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
        }
        configureStyle(textElement, result);
        return result;
      }

      final javax.swing.text.Element parent = textElement.getParentElement();
      final int endOffset = textElement.getEndOffset();
      final int startOffset = textElement.getStartOffset();
      final String text = textElement.getDocument().getText(startOffset, endOffset - startOffset);
      if (parent != null)
      {
        final HTML.Tag tag = findTag(parent.getAttributes());
        if ("\n".equals(text))
        {
          if (BLOCK_ELEMENTS.contains(tag) ||
              "paragraph".equals(textElement.getName()) ||
              "section".equals(textElement.getName()))
          {
            if (parent.getElementCount() > 0 && parent.getElement(parent.getElementCount() - 1) == textElement)
            {
              // Skipping an artificial \n at the end of paragraph element. This is generated by the swing
              // parser and really messes things up here.
              return null;
            }
          }
        }
      }
      final Element result = new Element();
      result.setName(textElement.getName());
      result.setElementType(LabelType.INSTANCE);
      result.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, text);
      configureStyle(textElement, result);
      if (HTML.Tag.BR.equals(textElement.getAttributes().getAttribute(StyleConstants.NameAttribute)))
      {
        result.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, "\n");
        result.getStyle().setStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT, Boolean.FALSE);
        result.getStyle().setStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE, WhitespaceCollapse.PRESERVE);
      }
      return result;
    }

    // we need to intercept for <UL> and <OL> here

    final Band band = new Band();
    configureStyle(textElement, band);
    configureBand(textElement, band);
    final boolean bandIsInline = isInlineElement(band);
    final int size = textElement.getElementCount();
    Band inlineContainer = null;
    for (int i = 0; i < size; i++)
    {
      final Element element = process(textElement.getElement(i));
      if (element == null)
      {
        continue;
      }

      if (isInlineElement(element) == bandIsInline)
      {
        band.addElement(element);
        continue;
      }

      if (band.getElementCount() == 0)
      {
        inlineContainer = new Band();
        inlineContainer.getStyle().setStyleProperty(BandStyleKeys.LAYOUT, "inline");
        inlineContainer.addElement(element);
        band.addElement(inlineContainer);
        continue;
      }

      final Element maybeInlineContainer = (Element) band.getElement(band.getElementCount() - 1);
      if (maybeInlineContainer == inlineContainer)
      {
        // InlineContainer cannot be null at this point, as band.getElement never returns null.
        //noinspection ConstantConditions
        inlineContainer.addElement(element);
View Full Code Here

    }
    lastObject = fieldValue;
    final Element[] elements = FunctionUtilities.findAllElements(event.getReport().getItemBand(), getElement());
    for (int i = 0; i < elements.length; i++)
    {
      final Element e = elements[i];
      e.setVisible(visible);
    }
  }
View Full Code Here

    firstInGroup = true;
    lastObject = fieldValue;
    final Element[] elements = FunctionUtilities.findAllElements(event.getReport().getItemBand(), getElement());
    for (int i = 0; i < elements.length; i++)
    {
      final Element e = elements[i];
      e.setVisible(visible);
    }
  }
View Full Code Here

TOP

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

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.