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

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


    }

    for (int i = nodes.length - 1; i >= 0; i -= 1)
    {
      final RenderNode node = nodes[i];
      final ReportAttributeMap attributes = node.getAttributes();
      final Object swingTooltip = attributes.getAttribute(AttributeNames.Swing.NAMESPACE, AttributeNames.Swing.TOOLTIP);
      if (swingTooltip != null)
      {
        return String.valueOf(swingTooltip);
      }

      final Object htmlTooltip = attributes.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.TITLE);
      if (htmlTooltip != null)
      {
        return String.valueOf(htmlTooltip);
      }
View Full Code Here


            writer.writeTag(null, "covered-cell", XmlWriter.CLOSE);
            continue;
          }

          final AttributeList attList = new AttributeList();
          final ReportAttributeMap attrs = bg.getAttributes();
          final Object nameAttr = attrs.getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NAME);
          if (nameAttr instanceof String)
          {
            attList.setAttribute(null, "content-idref",
                (String) nameAttr);
          }
View Full Code Here

      return false;
    }

    try
    {
      final ReportAttributeMap attrs = box.getAttributes();
      final boolean extraAttributes;
      if (firstElement != box)
      {
        final AttributeList attrList = new AttributeList();
        HtmlPrinter.applyHtmlAttributes(attrs, attrList);
        if (attrList.isEmpty() == false)
        {
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, attrList, XmlWriterSupport.OPEN);
        }
        extraAttributes = false;
      }
      else
      {
        extraAttributes = true;
      }

      final Object rawContent = attrs.getAttribute(AttributeNames.Html.NAMESPACE,
          AttributeNames.Html.EXTRA_RAW_CONTENT);
      if (rawContent != null)
      {
        xmlWriter.writeText(String.valueOf(rawContent));
      }

      final StyleSheet styleSheet = box.getStyleSheet();
      final String target = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TARGET);
      if (target != null)
      {
        final String window = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_WINDOW);
        final AttributeList linkAttr = new AttributeList();
        linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, HREF_ATTR, target);
        if (window != null && StringUtils.startsWithIgnoreCase(target, "javascript:") == false)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TARGET_ATTR, normalizeWindow(window));
        }
        final String title = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TITLE);
        if (title != null)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TITLE_ATTR, title);
        }
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, A_TAG, linkAttr, XmlWriterSupport.OPEN);
        processStack.push(new ElementProcessInfo(true, extraAttributes));
      }
      else
      {
        processStack.push(new ElementProcessInfo(false, extraAttributes));
      }

      if (Boolean.TRUE.equals(attrs.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.SURPRESS_CONTENT)))
      {
        return false;
      }

      return true;
View Full Code Here

    }

    try
    {
      final AttributeList attrList = new AttributeList();
      final ReportAttributeMap attrs = box.getAttributes();
      if (firstElement != box)
      {
        HtmlPrinter.applyHtmlAttributes(attrs, attrList);
        styleManager.updateStyle(HtmlPrinter.produceTextStyle
            (styleBuilder, box, true, false, safariLengthFix, useWhitespacePreWrap), attrList);
      }

      xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, attrList, XmlWriterSupport.OPEN);

      final Object rawContent = attrs.getAttribute(AttributeNames.Html.NAMESPACE,
          AttributeNames.Html.EXTRA_RAW_CONTENT);
      if (rawContent != null)
      {
        xmlWriter.writeText(String.valueOf(rawContent));
      }

      final StyleSheet styleSheet = box.getStyleSheet();
      if (firstElement != box)
      {
        final String anchor = (String) styleSheet.getStyleProperty(ElementStyleKeys.ANCHOR_NAME);
        if (anchor != null)
        {
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, A_TAG, "name", anchor, XmlWriterSupport.CLOSE);
        }
      }
      final String target = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TARGET);
      if (target != null)
      {
        final String window = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_WINDOW);
        final AttributeList linkAttr = new AttributeList();
        linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, HREF_ATTR, target);
        if (window != null && StringUtils.startsWithIgnoreCase(target, "javascript:") == false)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TARGET_ATTR, normalizeWindow(window));
        }
        final String title = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TITLE);
        if (title != null)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TITLE_ATTR, title);
        }
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, A_TAG, linkAttr, XmlWriterSupport.OPEN);
        processStack.push(new ElementProcessInfo(true, true));
      }
      else
      {
        processStack.push(new ElementProcessInfo(false, true));
      }

      if (Boolean.TRUE.equals(attrs.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.SURPRESS_CONTENT)))
      {
        return false;
      }

      return true;
View Full Code Here

    }

    try
    {
      final AttributeList attrList = new AttributeList();
      final ReportAttributeMap attrs = box.getAttributes();
      if (firstElement != box)
      {
        HtmlPrinter.applyHtmlAttributes(attrs, attrList);
        styleManager.updateStyle(HtmlPrinter.produceTextStyle
            (styleBuilder, box, true, false, safariLengthFix, useWhitespacePreWrap), attrList);
      }

      xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, attrList, XmlWriterSupport.OPEN);

      final Object rawContent = attrs.getAttribute(AttributeNames.Html.NAMESPACE,
          AttributeNames.Html.EXTRA_RAW_CONTENT);
      if (rawContent != null)
      {
        xmlWriter.writeText(String.valueOf(rawContent));
      }

      final StyleSheet styleSheet = box.getStyleSheet();
      if (firstElement != box)
      {
        final String anchor = (String) styleSheet.getStyleProperty(ElementStyleKeys.ANCHOR_NAME);
        if (anchor != null)
        {
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, A_TAG, "name", anchor, XmlWriterSupport.CLOSE);
        }
      }

      final String target = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TARGET);
      if (target != null)
      {
        final String window = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_WINDOW);
        final AttributeList linkAttr = new AttributeList();
        linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, HREF_ATTR, target);
        if (window != null && StringUtils.startsWithIgnoreCase(target, "javascript:") == false)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TARGET_ATTR, normalizeWindow(window));
        }
        final String title = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TITLE);
        if (title != null)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TITLE_ATTR, title);
        }
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, A_TAG, linkAttr, XmlWriterSupport.OPEN);
        processStack.push(new ElementProcessInfo(true, true));
      }
      else
      {
        processStack.push(new ElementProcessInfo(false, true));
      }

      if (Boolean.TRUE.equals(attrs.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.SURPRESS_CONTENT)))
      {
        return false;
      }

      return true;
View Full Code Here

    }

    try
    {
      final boolean extraAttributes;
      final ReportAttributeMap attrs = box.getAttributes();
      if (firstElement != box)
      {
        final AttributeList attrList = new AttributeList();
        HtmlPrinter.applyHtmlAttributes(attrs, attrList);
        styleManager.updateStyle(HtmlPrinter.produceTextStyle
            (styleBuilder, box, true, true, safariLengthFix, useWhitespacePreWrap), attrList);

        if (attrList.isEmpty() == false)
        {
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, SPAN_TAG, attrList, XmlWriterSupport.OPEN);
          extraAttributes = true;
        }
        else
        {
          extraAttributes = false;
        }
      }
      else
      {
        extraAttributes = false;
      }

      final Object rawContent = attrs.getAttribute(AttributeNames.Html.NAMESPACE,
          AttributeNames.Html.EXTRA_RAW_CONTENT);
      if (rawContent != null)
      {
        xmlWriter.writeText(String.valueOf(rawContent));
      }

      final StyleSheet styleSheet = box.getStyleSheet();
      if (firstElement != box)
      {
        final String anchor = (String) styleSheet.getStyleProperty(ElementStyleKeys.ANCHOR_NAME);
        if (anchor != null)
        {
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, A_TAG, "name", anchor, XmlWriterSupport.CLOSE);
        }
      }

      final String target = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TARGET);
      if (target != null)
      {
        final String window = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_WINDOW);
        final AttributeList linkAttr = new AttributeList();
        linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, HREF_ATTR, target);
        if (window != null && StringUtils.startsWithIgnoreCase(target, "javascript:") == false)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TARGET_ATTR, normalizeWindow(window));
        }
        final String title = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TITLE);
        if (title != null)
        {
          linkAttr.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TITLE_ATTR, title);
        }
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, A_TAG, linkAttr, XmlWriterSupport.OPEN);
        processStack.push(new ElementProcessInfo(true, extraAttributes));
      }
      else
      {
        processStack.push(new ElementProcessInfo(false, extraAttributes));
      }

      if (Boolean.TRUE.equals(attrs.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.SURPRESS_CONTENT)))
      {
        return false;
      }

      return true;
View Full Code Here

  protected void processRenderableContent(final RenderableReplacedContentBox node)
  {
    try
    {
      final ReportAttributeMap map = node.getAttributes();
      final AttributeList attrs = new AttributeList();
      HtmlPrinter.applyHtmlAttributes(map, attrs);
      if (attrs.isEmpty() == false)
      {
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, attrs, XmlWriterSupport.OPEN);
View Full Code Here

        }
      }
    }

    // Fallback: (At the moment, we only support drawables and images.)
    final ReportAttributeMap attributes = node.getAttributes();
    if (rawObject instanceof ImageContainer)
    {
      final String type = RenderUtility.getEncoderType(attributes);
      final float quality = RenderUtility.getEncoderQuality(attributes);

      // Make it a PNG file ..
      //xmlWriter.writeComment("Image content source:" + source);
      final String name = contentGenerator.writeImage((ImageContainer) rawObject, type, quality, true);
      if (name != null)
      {
        // Write image reference ..
        final AttributeList attrList = new AttributeList();
        attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, SRC_ATTR, name);
        attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, "border", "0");
        final Object titleText = attributes.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.TITLE);
        if (titleText != null)
        {
          attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TITLE_ATTR, String.valueOf(titleText));
        }

        final Object altText = attributes.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.ALT);
        if (altText != null)
        {
          attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, ALT_ATTR, String.valueOf(altText));
        }
        // width and height and scaling and so on ..
        final StyleBuilder imgStyle = produceImageStyle(node);
        if (imgStyle == null)
        {
          final AttributeList clipAttrList = new AttributeList();
          final StyleBuilder divStyle = produceClipStyle(node);
          styleManager.updateStyle(divStyle, clipAttrList);

          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, clipAttrList, XmlWriterSupport.OPEN);
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, IMG_TAG, attrList, XmlWriterSupport.CLOSE);
          xmlWriter.writeCloseTag();
        }
        else
        {
          styleManager.updateStyle(imgStyle, attrList);
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, IMG_TAG, attrList, XmlWriterSupport.CLOSE);
        }
        result = true;
      }

      return;
    }

    if (rawObject instanceof DrawableWrapper)
    {
      // render it into an Buffered image and make it a PNG file.
      final DrawableWrapper drawable = (DrawableWrapper) rawObject;
      final StrictBounds cb = new StrictBounds(node.getX(), node.getY(), node.getWidth(), node.getHeight());
      final ImageContainer image = RenderUtility.createImageFromDrawable(drawable, cb, node,
          metaData);
      if (image == null)
      {
        //xmlWriter.writeComment("Drawable content [No image generated]:" + source);
        return;
      }

      final String type = RenderUtility.getEncoderType(attributes);
      final float quality = RenderUtility.getEncoderQuality(attributes);

      final String name = contentGenerator.writeImage(image, type, quality, true);
      if (name == null)
      {
        //xmlWriter.writeComment("Drawable content [No image written]:" + source);
        return;
      }

      //xmlWriter.writeComment("Drawable content:" + source);
      // Write image reference ..
      final ImageMap imageMap;
      final AttributeList attrList = new AttributeList();
      attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, SRC_ATTR, name);
      attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, "border", "0");

      final Object imageMapNameOverride = attributes.getAttribute
          (AttributeNames.Html.NAMESPACE, AttributeNames.Html.IMAGE_MAP_OVERRIDE);
      if (imageMapNameOverride != null)
      {
        attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, USEMAP_ATTR, String.valueOf(imageMapNameOverride));
        imageMap = null;
      }
      else
      {
        // only generate a image map, if the user does not specify their own onw via the override.
        // Of course, they would have to provide the map by other means as well.
        imageMap = RenderUtility.extractImageMap(node);

        if (imageMap != null)
        {
          final String mapName = imageMap.getAttribute(HtmlPrinter.XHTML_NAMESPACE, "name");
          if (mapName != null)
          {
            attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, USEMAP_ATTR, "#" + mapName);
          }
          else
          {
            final String generatedName = "generated_" + name + "_map"; //NON-NLS
            imageMap.setAttribute(HtmlPrinter.XHTML_NAMESPACE, "name", generatedName);
            //noinspection MagicCharacter
            attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, USEMAP_ATTR, '#' + generatedName);//NON-NLS
          }
        }
      }

      final Object titleText = attributes.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.TITLE);
      if (titleText != null)
      {
        attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, TITLE_ATTR, String.valueOf(titleText));
      }

      final Object altText = attributes.getAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.ALT);
      if (altText != null)
      {
        attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, ALT_ATTR, String.valueOf(altText));
      }
      // width and height and scaling and so on ..
View Full Code Here

    return attributeList;
  }

  private void writeElementAttributes(final RenderNode element) throws IOException
  {
    final ReportAttributeMap attributes = element.getAttributes();
    final ElementType type = element.getElementType();
    writeAttributes(attributes, type);
  }
View Full Code Here

      attrList.setAttribute(HtmlPrinter.XHTML_NAMESPACE, "valign", translateVerticalAlignment(verticalAlignment));
    }

    if (background != null && content != null)
    {
      final ReportAttributeMap attrs = new ReportAttributeMap(background.getAttributes());
      attrs.putAll(content.getAttributes());
      HtmlPrinter.applyHtmlAttributes(attrs, attrList);
    }
    else if (background != null)
    {
      final ReportAttributeMap attrs = background.getAttributes();
      HtmlPrinter.applyHtmlAttributes(attrs, attrList);
    }
    else if (content != null)
    {
      HtmlPrinter.applyHtmlAttributes(content.getAttributes(), attrList);
View Full Code Here

TOP

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

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.