Package org.pentaho.reporting.libraries.xmlns.common

Examples of org.pentaho.reporting.libraries.xmlns.common.AttributeList


    if (parentList == null && style.getDefinedPropertyNamesArray().length == 0)
    {
      return;
    }

    final AttributeList attList = new AttributeList();
    if (writeName)
    {
      attList.setAttribute(BundleNamespaces.STYLE, "name", style.getName());
    }

    if (parentList != null)
    {
      attList.setAttribute(BundleNamespaces.STYLE, "parent", parentList);
    }

    writer.writeTag(namespace, tagName, attList, XmlWriterSupport.OPEN);

    StyleWriterUtility.writeBandStyles(writer, style);
View Full Code Here


    if (style == null)
    {
      throw new NullPointerException();
    }

    final AttributeList bandStyleAtts = new AttributeList();

    if (style.isLocalKey(ElementStyleKeys.BACKGROUND_COLOR))
    {
      final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BACKGROUND_COLOR);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "background-color", ColorValueConverter.colorToString(
          value));
    }

    if (style.isLocalKey(ElementStyleKeys.PADDING_TOP) &&
        style.isLocalKey(ElementStyleKeys.PADDING_LEFT) &&
        style.isLocalKey(ElementStyleKeys.PADDING_BOTTOM) &&
        style.isLocalKey(ElementStyleKeys.PADDING_RIGHT))
    {
      final double paddingTop = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_TOP, 0);
      final double paddingLeft = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_LEFT, 0);
      final double paddingBottom = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_BOTTOM, 0);
      final double paddingRight = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_RIGHT, 0);
      if (paddingTop == paddingLeft &&
          paddingTop == paddingRight &&
          paddingTop == paddingBottom)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding", absoluteLengthFormat.format(paddingTop));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-top", absoluteLengthFormat.format(paddingTop));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-left", absoluteLengthFormat.format(paddingLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-bottom", absoluteLengthFormat.format(
            paddingBottom));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-right", absoluteLengthFormat.format(paddingRight));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.PADDING_TOP))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_TOP, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-top", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.PADDING_LEFT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_LEFT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-left", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.PADDING_BOTTOM))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_BOTTOM, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-bottom", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.PADDING_RIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.PADDING_RIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "padding-right", absoluteLengthFormat.format(value));
      }
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_LEFT_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_WIDTH))
    {
      final double top = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_WIDTH, 0);
      final double left = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_LEFT_WIDTH, 0);
      final double bottom = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_WIDTH, 0);
      final double right = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_RIGHT_WIDTH, 0);
      if (top == left &&
          top == right &&
          top == bottom)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-width", absoluteLengthFormat.format(top));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-width", absoluteLengthFormat.format(top));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-width", absoluteLengthFormat.format(left));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-width", absoluteLengthFormat.format(bottom));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-width", absoluteLengthFormat.format(right));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_LEFT_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_LEFT_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_RIGHT_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-width", absoluteLengthFormat.format(value));
      }
    }
    if (style.isLocalKey(ElementStyleKeys.BORDER_BREAK_WIDTH))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BREAK_WIDTH, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-break-width", absoluteLengthFormat.format(value));
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_COLOR) &&
        style.isLocalKey(ElementStyleKeys.BORDER_LEFT_COLOR) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_COLOR) &&
        style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_COLOR))
    {
      final Color top = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_TOP_COLOR);
      final Color left = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_COLOR);
      final Color bottom = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_COLOR);
      final Color right = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_COLOR);
      if (ObjectUtilities.equal(top, left) &&
          ObjectUtilities.equal(top, right) &&
          ObjectUtilities.equal(top, bottom))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-color", ColorValueConverter.colorToString(top));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-color", ColorValueConverter.colorToString(
            top));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-color", ColorValueConverter.colorToString(
            left));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-color", ColorValueConverter.colorToString(
            bottom));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-color", ColorValueConverter.colorToString(
            right));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_TOP_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-color", ColorValueConverter.colorToString(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_LEFT_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-color", ColorValueConverter.colorToString(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-color", ColorValueConverter.colorToString(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_COLOR))
      {
        final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_COLOR);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-color", ColorValueConverter.colorToString(
            value));
      }
    }
    if (style.isLocalKey(ElementStyleKeys.BORDER_BREAK_COLOR))
    {
      final Color value = (Color) style.getStyleProperty(ElementStyleKeys.BORDER_BREAK_COLOR);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-break-color", ColorValueConverter.colorToString(
          value));
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_STYLE) &&
        style.isLocalKey(ElementStyleKeys.BORDER_LEFT_STYLE) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_STYLE) &&
        style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_STYLE))
    {
      final Object top = style.getStyleProperty(ElementStyleKeys.BORDER_TOP_STYLE);
      final Object left = style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_STYLE);
      final Object bottom = style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_STYLE);
      final Object right = style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_STYLE);
      if (ObjectUtilities.equal(top, left) &&
          ObjectUtilities.equal(top, right) &&
          ObjectUtilities.equal(top, bottom))
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-style", top.toString());
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-style", top.toString());
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-style", left.toString());
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-style", bottom.toString());
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-style", right.toString());
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_TOP_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-style", value.toString());
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_LEFT_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_LEFT_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-left-style", value.toString());
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_BOTTOM_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-style", value.toString());
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_RIGHT_STYLE))
      {
        final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_RIGHT_STYLE);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-right-style", value.toString());
      }
    }
    if (style.isLocalKey(ElementStyleKeys.BORDER_BREAK_STYLE))
    {
      final Object value = style.getStyleProperty(ElementStyleKeys.BORDER_BREAK_STYLE);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-break-style", value.toString());
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH))
    {
      final double bottomLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH, 0);
      final double bottomRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH, 0);
      final double topLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH, 0);
      final double topRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH, 0);
      if (bottomLeft == bottomRight &&
          bottomLeft == topRight &&
          bottomLeft == topLeft)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-radius-width", absoluteLengthFormat.format(
            bottomLeft));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-radius-width", absoluteLengthFormat.format(
            topLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-radius-width", absoluteLengthFormat.format(
            topRight));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-radius-width",
            absoluteLengthFormat.format(bottomLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-radius-width",
            absoluteLengthFormat.format(bottomRight));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-width", absoluteLengthFormat.format(value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-width", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-width", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_WIDTH, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-width", absoluteLengthFormat.format(
            value));
      }
    }

    if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT) &&
        style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT) &&
        style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT))
    {
      final double bottomLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT, 0);
      final double bottomRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT, 0);
      final double topLeft = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT, 0);
      final double topRight = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT, 0);
      if (bottomLeft == bottomRight &&
          bottomLeft == topRight &&
          bottomLeft == topLeft)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-radius-height", absoluteLengthFormat.format(
            bottomLeft));
      }
      else
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-radius-height", absoluteLengthFormat.format(
            topLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-radius-height",
            absoluteLengthFormat.format(topRight));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-radius-height",
            absoluteLengthFormat.format(bottomLeft));
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-radius-height",
            absoluteLengthFormat.format(bottomRight));
      }
    }
    else
    {
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_LEFT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-left-height", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_TOP_RIGHT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-top-right-height", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_LEFT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-left-height", absoluteLengthFormat.format(
            value));
      }
      if (style.isLocalKey(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT))
      {
        final double value = style.getDoubleStyleProperty(ElementStyleKeys.BORDER_BOTTOM_RIGHT_RADIUS_HEIGHT, 0);
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "border-bottom-right-height", absoluteLengthFormat.format(
            value));
      }
    }

    if (bandStyleAtts.isEmpty() == false)
    {
      writer.writeTag(BundleNamespaces.STYLE, "border-styles", bandStyleAtts, XmlWriterSupport.CLOSE);
    }
  }
View Full Code Here

    try
    {
      if ((box.getNodeType() & LayoutNodeTypes.MASK_BOX_PAGEAREA) == LayoutNodeTypes.MASK_BOX_PAGEAREA)
      {
        final AttributeList list = createBoxAttributeList(box);
        list.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "type", box.getName());
        xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "page-area", list, XmlWriter.OPEN);
      }
      else if (box.getNodeType() == LayoutNodeTypes.TYPE_BOX_PARAGRAPH)
      {
        xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "p", createBoxAttributeList(box), XmlWriter.OPEN);
View Full Code Here

    try
    {
      if (node.getNodeType() == LayoutNodeTypes.TYPE_NODE_TEXT)
      {
        final RenderableText text = (RenderableText) node;
        final AttributeList attributeList = new AttributeList();
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "x",
            String.valueOf(StrictGeomUtility.toExternalValue(node.getX())));
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "y",
            String.valueOf(StrictGeomUtility.toExternalValue(node.getY())));
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "width",
            String.valueOf(StrictGeomUtility.toExternalValue(node.getWidth())));
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "height",
            String.valueOf(StrictGeomUtility.toExternalValue(node.getHeight())));
        xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "text", attributeList, XmlWriter.OPEN);
        xmlWriter.writeTextNormalized(text.getRawText(), true);
        xmlWriter.writeCloseTag();

      }
      else if (node.getNodeType() == LayoutNodeTypes.TYPE_NODE_SPACER)
      {
        final SpacerRenderNode spacer = (SpacerRenderNode) node;
        final AttributeList attributeList = new AttributeList();
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "width",
            String.valueOf(StrictGeomUtility.toExternalValue(node.getWidth())));
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "height",
            String.valueOf(StrictGeomUtility.toExternalValue(node.getHeight())));
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "preserve",
            String.valueOf(spacer.isDiscardable() == false));
        xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "spacer", attributeList, XmlWriter.CLOSE);
      }
    }
    catch (IOException e)
View Full Code Here

  protected void processRenderableContent(final RenderableReplacedContentBox node)
  {
    try
    {
      final RenderableReplacedContent prc = node.getContent();
      final AttributeList attributeList = new AttributeList();
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "x",
          String.valueOf(StrictGeomUtility.toExternalValue(node.getX())));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "y",
          String.valueOf(StrictGeomUtility.toExternalValue(node.getY())));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "width",
          String.valueOf(StrictGeomUtility.toExternalValue(node.getWidth())));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "height",
          String.valueOf(StrictGeomUtility.toExternalValue(node.getHeight())));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "source", String.valueOf(prc.getSource()));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "content-width",
          String.valueOf(StrictGeomUtility.toExternalValue(prc.getContentWidth())));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "content-height",
          String.valueOf(StrictGeomUtility.toExternalValue(prc.getContentHeight())));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "requested-width",
          convertRenderLength(prc.getRequestedWidth()));
      attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "requested-height",
          convertRenderLength(prc.getRequestedHeight()));

      final Object o = prc.getRawObject();
      if (o != null)
      {
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "raw-object-type",
            o.getClass().getName());
      }
      else
      {
        attributeList.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "raw-object-type", "null");
      }
      xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "replaced-content", attributeList, XmlWriter.OPEN);
      writeElementAttributes(node);
      xmlWriter.writeCloseTag();
    }
View Full Code Here

    if (style == null)
    {
      throw new NullPointerException();
    }

    final AttributeList bandStyleAtts = new AttributeList();
    if (style.isLocalKey(ElementStyleKeys.POS_X))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.POS_X, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "x", formatLength(value));
    }
    if (style.isLocalKey(ElementStyleKeys.POS_Y))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.POS_Y, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "y", formatLength(value));
    }
    if (style.isLocalKey(ElementStyleKeys.MIN_WIDTH))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.MIN_WIDTH, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "min-width", formatLength(value));
    }
    if (style.isLocalKey(ElementStyleKeys.MIN_HEIGHT))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.MIN_HEIGHT, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "min-height", formatLength(value));
    }
    if (style.isLocalKey(ElementStyleKeys.WIDTH))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.WIDTH, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "width", formatLength(value));
    }
    if (style.isLocalKey(ElementStyleKeys.HEIGHT))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.HEIGHT, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "height", formatLength(value));
    }
    if (style.isLocalKey(ElementStyleKeys.MAX_WIDTH))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.MAX_WIDTH, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "max-width", formatLength(value));
    }
    if (style.isLocalKey(ElementStyleKeys.MAX_HEIGHT))
    {
      final double value = style.getDoubleStyleProperty(ElementStyleKeys.MAX_HEIGHT, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "max-height", formatLength(value));
    }
    if (bandStyleAtts.isEmpty() == false)
    {
      writer.writeTag(BundleNamespaces.STYLE, "spatial-styles", bandStyleAtts, XmlWriterSupport.CLOSE);
    }
  }
View Full Code Here

    if (style == null)
    {
      throw new NullPointerException();
    }

    final AttributeList bandStyleAtts = new AttributeList();
    if (style.isLocalKey(TextStyleKeys.FONT))
    {
      final String value = (String) style.getStyleProperty(TextStyleKeys.FONT);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "font-face", value);
    }
    if (style.isLocalKey(TextStyleKeys.BOLD))
    {
      final boolean value = style.getBooleanStyleProperty(TextStyleKeys.BOLD);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "bold", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.ITALIC))
    {
      final boolean value = style.getBooleanStyleProperty(TextStyleKeys.ITALIC);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "italic", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.EMBEDDED_FONT))
    {
      final boolean value = style.getBooleanStyleProperty(TextStyleKeys.EMBEDDED_FONT);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "embedded", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.UNDERLINED))
    {
      final boolean value = style.getBooleanStyleProperty(TextStyleKeys.UNDERLINED);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "underline", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.STRIKETHROUGH))
    {
      final boolean value = style.getBooleanStyleProperty(TextStyleKeys.STRIKETHROUGH);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "strikethrough", String.valueOf(value));
    }
    if (style.isLocalKey(ElementStyleKeys.EXCEL_WRAP_TEXT))
    {
      final boolean value = style.getBooleanStyleProperty(ElementStyleKeys.EXCEL_WRAP_TEXT);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "excel-text-wrapping", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.TRIM_TEXT_CONTENT))
    {
      final boolean value = style.getBooleanStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "trim-text-content", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.FONTENCODING))
    {
      final String value = (String) style.getStyleProperty(TextStyleKeys.FONTENCODING);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "encoding", value);
    }
    if (style.isLocalKey(TextStyleKeys.RESERVED_LITERAL))
    {
      final String value = (String) style.getStyleProperty(TextStyleKeys.RESERVED_LITERAL);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "ellipsis", value);
    }
    if (style.isLocalKey(TextStyleKeys.FONTSIZE))
    {
      final int value = style.getIntStyleProperty(TextStyleKeys.FONTSIZE, 0);
      if (value > 0)
      {
        bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "font-size", String.valueOf(value));
      }
    }
    if (style.isLocalKey(TextStyleKeys.LINEHEIGHT))
    {
      final double value = style.getDoubleStyleProperty(TextStyleKeys.LINEHEIGHT, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "line-height", formatLength(value));
    }
    if (style.isLocalKey(TextStyleKeys.WORD_SPACING))
    {
      final int value = style.getIntStyleProperty(TextStyleKeys.WORD_SPACING, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "word-spacing", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.X_MIN_LETTER_SPACING))
    {
      final int value = style.getIntStyleProperty(TextStyleKeys.X_MIN_LETTER_SPACING, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "min-letter-spacing", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.X_OPTIMUM_LETTER_SPACING))
    {
      final int value = style.getIntStyleProperty(TextStyleKeys.X_OPTIMUM_LETTER_SPACING, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "optimum-letter-spacing", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.X_MAX_LETTER_SPACING))
    {
      final int value = style.getIntStyleProperty(TextStyleKeys.X_MAX_LETTER_SPACING, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "max-letter-spacing", String.valueOf(value));
    }
    if (style.isLocalKey(TextStyleKeys.FONT_SMOOTH))
    {
      final Object value = style.getStyleProperty(TextStyleKeys.FONT_SMOOTH);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "font-smooth", value.toString());
    }
    if (style.isLocalKey(TextStyleKeys.TEXT_WRAP))
    {
      final Object value = style.getStyleProperty(TextStyleKeys.TEXT_WRAP);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "text-wrap", value.toString());
    }
    if (style.isLocalKey(TextStyleKeys.WHITE_SPACE_COLLAPSE))
    {
      final Object value = style.getStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "whitespace-collapse", value.toString());
    }
    if (style.isLocalKey(TextStyleKeys.VERTICAL_TEXT_ALIGNMENT))
    {
      final Object value = style.getStyleProperty(TextStyleKeys.VERTICAL_TEXT_ALIGNMENT);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "whitespace-collapse", value.toString());
    }
    if (style.isLocalKey(TextStyleKeys.TEXT_INDENT))
    {
      final double value = style.getDoubleStyleProperty(TextStyleKeys.TEXT_INDENT, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "text-indent", formatFloat(value));
    }
    if (style.isLocalKey(TextStyleKeys.FIRST_LINE_INDENT))
    {
      final double value = style.getDoubleStyleProperty(TextStyleKeys.FIRST_LINE_INDENT, 0);
      bandStyleAtts.setAttribute(BundleNamespaces.STYLE, "first-line-indent", formatFloat(value));
    }
    if (bandStyleAtts.isEmpty() == false)
    {
      writer.writeTag(BundleNamespaces.STYLE, "text-styles", bandStyleAtts, XmlWriterSupport.CLOSE);
    }
  }
View Full Code Here

   * @throws ReportWriterException if there is a problem writing the report.
   */
  private void writeElement(final Element element)
      throws IOException, ReportWriterException
  {
    final AttributeList attList = new AttributeList();
    if (element.getName().startsWith(Element.ANONYMOUS_ELEMENT_PREFIX) == false)
    {
      attList.setAttribute(ExtParserModule.NAMESPACE, "name", element.getName());
    }

    final XmlWriter writer = getXmlWriter();
    writer.writeTag(ExtParserModule.NAMESPACE, ReportDescriptionWriter.ELEMENT_TAG, attList, XmlWriterSupport.OPEN);

View Full Code Here

            EncodingRegistry.getPlatformDefaultEncoding());

    final Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, encoding));
    this.xmlWriter = new XmlWriter(writer, td);
    this.xmlWriter.writeXmlDeclaration(encoding);
    final AttributeList attrs = new AttributeList();
    attrs.addNamespaceDeclaration("", XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE);
    xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "layout-output", attrs, XmlWriter.OPEN);
  }
View Full Code Here

        (page.getWidth() - page.getImageableWidth() - page.getImageableX());
    final float marginTop = (float) StrictGeomUtility.toExternalValue(page.getImageableY());
    final float marginBottom = (float) StrictGeomUtility.toExternalValue
        (page.getHeight() - page.getImageableHeight() - page.getImageableY());

    final AttributeList pageAttributes = new AttributeList();
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "page-x", pointConverter.format(
        page.getGlobalX()));
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "page-y", pointConverter.format(
        page.getGlobalY()));
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "page-width", pointConverter.format(width));
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "page-height", pointConverter.format(
        height));
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "margin-top", pointConverter.format(
        marginTop));
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "margin-left", pointConverter.format(
        marginLeft));
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "margin-bottom", pointConverter.format(
        marginBottom));
    pageAttributes.setAttribute(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "margin-right", pointConverter.format(
        marginRight));

    xmlWriter.writeTag(XmlDocumentWriter.LAYOUT_OUTPUT_NAMESPACE, "physical-page", pageAttributes, XmlWriter.OPEN);

    // and now process the box ..
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.xmlns.common.AttributeList

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.