Package org.jfree.report.structure

Examples of org.jfree.report.structure.Element


    private static void performFontFaceProcessing(final OfficeStyle style,
            final OfficeStylesCollection stylesCollection,
            final OfficeStylesCollection predefCollection)
            throws ReportProcessingException
    {
        final Element textProperties = style.getTextProperties();
        if (textProperties == null)
        {
            return;
        }

        try
        {
            final FontFaceDeclsSection currentFonts = stylesCollection.getFontFaceDecls();
            final FontFaceDeclsSection predefFonts = predefCollection.getFontFaceDecls();

            final String fontName = (String) textProperties.getAttribute(OfficeNamespaces.STYLE_NS, "font-name");
            if (fontName != null && !currentFonts.containsFont(fontName))
            {
                final FontFaceElement element = predefFonts.getFontFace(fontName);
                if (element != null)
                {
                    currentFonts.addFontFace((FontFaceElement) element.clone());
                }
            }

            final String fontNameAsian = (String) textProperties.getAttribute(OfficeNamespaces.STYLE_NS,
                    "font-name-asian");
            if (fontNameAsian != null && !currentFonts.containsFont(fontNameAsian))
            {
                final FontFaceElement element = predefFonts.getFontFace(
                        fontNameAsian);
                if (element != null)
                {
                    currentFonts.addFontFace((FontFaceElement) element.clone());
                }
            }

            final String fontNameComplex = (String) textProperties.getAttribute(OfficeNamespaces.STYLE_NS,
                    "font-name-complex");
            if (fontNameComplex != null && !currentFonts.containsFont(fontNameComplex))
            {
                final FontFaceElement element = predefFonts.getFontFace(
                        fontNameComplex);
View Full Code Here


        for (int i = 0; i < styles.length; i++)
        {
            final OfficeStyle officeStyle = styles[i];
            if (officeStyle.getStyleFamily().equals(styleFamily))
            {
                final Element section = officeStyle.findFirstChild(OfficeNamespaces.STYLE_NS, sectionName);
                if (section != null)
                {
                    int j = 0;
                    for (; j < propertyNamespace.size(); j++)
                    {
                        final String ns = (String) propertyNamespace.get(j);
                        final String prop = (String) propertyName.get(j);
                        final Object obj = section.getAttribute(ns, prop);
                        final Object value = propertyValues.get(j);
                        if (obj == null || value == null)
                        {
                            continue;
                        }
View Full Code Here

        if (style == null)
        {
            return null; // no such style

        }
        final Element section = style.findFirstChild(OfficeNamespaces.STYLE_NS, sectionName);
        if (section != null)
        {
            final Object attribute = section.getAttribute(propertyNamespace, propertyName);
            if (attribute != null)
            {
                return String.valueOf(attribute);
            }
        }
View Full Code Here

      if (commonStyles.containsStyle("graphic", "Graphics") == false)
      {
        final OfficeStyle graphicsDefaultStyle = new OfficeStyle();
        graphicsDefaultStyle.setStyleFamily("graphic");
        graphicsDefaultStyle.setStyleName("Graphics");
        final Element graphicProperties = produceFirstChild(graphicsDefaultStyle, OfficeNamespaces.STYLE_NS, "graphic-properties");
        graphicProperties.setAttribute(OfficeNamespaces.TEXT_NS, "anchor-type", "paragraph");
        graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "x", "0cm");
        graphicProperties.setAttribute(OfficeNamespaces.SVG_NS, "y", "0cm");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap", "dynamic");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "number-wrapped-paragraphs", "no-limit");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "wrap-contour", "false");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-pos", "top");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "vertical-rel", "paragraph");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "horizontal-pos", "center");
        graphicProperties.setAttribute(OfficeNamespaces.STYLE_NS, "horizontal-rel", "paragraph");
        commonStyles.addStyle(graphicsDefaultStyle);
      }

      // Make sure that later generated styles do not overwrite existing styles.
      fillStyleNameGenerator(predefinedStylesCollection);
View Full Code Here

            final double clipWidth = normalizedImageWidth.getValue() - imageAreaWidthVal.getValue();
            final double clipHeight = normalizedImageHeight.getValue() - imageAreaHeightVal.getValue();
            if (clipWidth > 0 && clipHeight > 0)
            {
              final OfficeStyle imageStyle = deriveStyle("graphic", "Graphics");
              final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, "graphic-properties");
              final StringBuffer buffer = new StringBuffer();
              buffer.append("rect(");
              buffer.append(clipHeight / 2);
              buffer.append(imageAreaHeightVal.getType().getType());
              buffer.append(" ");
              buffer.append(clipWidth / 2);
              buffer.append(imageAreaWidthVal.getType().getType());
              buffer.append(" ");
              buffer.append(clipHeight / 2);
              buffer.append(imageAreaHeightVal.getType().getType());
              buffer.append(" ");
              buffer.append(clipWidth / 2);
              buffer.append(imageAreaWidthVal.getType().getType());
              buffer.append(")");
              graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString());

              styleName = imageStyle.getStyleName();
              getStylesCollection().getAutomaticStyles().addStyle(imageStyle);
            }
            else if (clipWidth > 0)
            {
              final OfficeStyle imageStyle = deriveStyle("graphic", "Graphics");
              final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, "graphic-properties");
              final StringBuffer buffer = new StringBuffer();
              buffer.append("rect(0cm ");
              buffer.append(clipWidth / 2);
              buffer.append(imageAreaWidthVal.getType().getType());
              buffer.append(" 0cm ");
              buffer.append(clipWidth / 2);
              buffer.append(imageAreaWidthVal.getType().getType());
              buffer.append(")");
              graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString());

              styleName = imageStyle.getStyleName();
              getStylesCollection().getAutomaticStyles().addStyle(imageStyle);
              imageAreaHeightVal = normalizedImageHeight;
            }
            else if (clipHeight > 0)
            {
              final OfficeStyle imageStyle = deriveStyle("graphic", "Graphics");
              final Element graphProperties = produceFirstChild(imageStyle, OfficeNamespaces.STYLE_NS, "graphic-properties");
              final StringBuffer buffer = new StringBuffer();
              buffer.append("rect(");
              buffer.append(clipHeight / 2);
              buffer.append(imageAreaHeightVal.getType().getType());
              buffer.append(" 0cm ");
              buffer.append(clipHeight / 2);
              buffer.append(imageAreaHeightVal.getType().getType());
              buffer.append(" 0cm)");
              graphProperties.setAttribute(OfficeNamespaces.FO_NS, "clip", buffer.toString());

              styleName = imageStyle.getStyleName();
              getStylesCollection().getAutomaticStyles().addStyle(imageStyle);
              imageAreaWidthVal = normalizedImageWidth;
            }
View Full Code Here

    return null;
  }

  private String computeValueStyle()
  {
    final Element tce = getParentTableCell();
    if (tce == null)
    {
      return null;
    }

    final String cellStyleName = (String) tce.getAttribute(OfficeNamespaces.TABLE_NS, "style-name");
    if (cellStyleName == null)
    {
      return null;
    }
    final OfficeDocument document = getDocument();
View Full Code Here

    return (String) style.getAttribute(OfficeNamespaces.STYLE_NS, "data-style-name");
  }

  private String computeValueType()
  {
    final Element tce = getParentTableCell();
    if (tce == null)
    {
      // NO particular format means: Fallback to string and hope and pray ..
      throw new IllegalStateException("A formatted text element must be a child of a Table-Cell.");
    }

    final String type = (String) tce.getAttribute(OfficeNamespaces.OFFICE_NS, "value-type");
    if (type == null)
    {
      Log.error("The Table-Cell does not have a office:value attribute defined. Your content will be messed up.");
      return "string";
    }
View Full Code Here

  {
    final OfficeStylesCollection contentStyles = getContentStylesCollection();
    final OfficeStyle style = contentStyles.getStyle("table-row", rowStyle);
    if (style != null)
    {
      final Element element = style.getTableRowProperties();
      if (element != null)
      {
        final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height");
        if (height != null)
        {
          return parseLength(height);
        }
      }

      final String styleParent = style.getStyleParent();
      if (styleParent != null)
      {
        return computeRowHeight(styleParent);
      }
    }

    final OfficeStylesCollection globalStyles = getGlobalStylesCollection();
    final OfficeStyle globalStyle = globalStyles.getStyle("table-row", rowStyle);
    if (globalStyle != null)
    {
      final Element element = globalStyle.getTableRowProperties();
      if (element != null)
      {
        final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height");
        if (height != null)
        {
          return parseLength(height);
        }
      }
      final String styleParent = globalStyle.getStyleParent();
      if (styleParent != null)
      {
        return computeRowHeight(styleParent);
      }
    }

    final OfficeStylesCollection predefStyles = getPredefinedStylesCollection();
    final OfficeStyle predefStyle = predefStyles.getStyle("table-row", rowStyle);
    if (predefStyle != null)
    {
      final Element element = predefStyle.getTableRowProperties();
      if (element != null)
      {
        final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "row-height");
        if (height != null)
        {
          return parseLength(height);
        }
      }
View Full Code Here

  {
    final OfficeStylesCollection contentStyles = getContentStylesCollection();
    final OfficeStyle style = contentStyles.getStyle("table-column", colStyle);
    if (style != null)
    {
      final Element element = style.getTableColumnProperties();
      if (element != null)
      {
        final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "column-width");
        if (height != null)
        {
          return parseLength(height);
        }
      }

      final String styleParent = style.getStyleParent();
      if (styleParent != null)
      {
        return computeRowHeight(styleParent);
      }
    }

    final OfficeStylesCollection globalStyles = getGlobalStylesCollection();
    final OfficeStyle globalStyle = globalStyles.getStyle("table-column", colStyle);
    if (globalStyle != null)
    {
      final Element element = globalStyle.getTableColumnProperties();
      if (element != null)
      {
        final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "column-width");
        if (height != null)
        {
          return parseLength(height);
        }
      }
      final String styleParent = globalStyle.getStyleParent();
      if (styleParent != null)
      {
        return computeRowHeight(styleParent);
      }
    }

    final OfficeStylesCollection predefStyles = getPredefinedStylesCollection();
    final OfficeStyle predefStyle = predefStyles.getStyle("table-column", colStyle);
    if (predefStyle != null)
    {
      final Element element = predefStyle.getTableColumnProperties();
      if (element != null)
      {
        final String height = (String) element.getAttribute(OfficeNamespaces.STYLE_NS, "column-width");
        if (height != null)
        {
          return parseLength(height);
        }
      }
View Full Code Here

  protected Element produceFirstChild(final Section style,
                                      final String nameSpace,
                                      final String type)
  {
    Element paragraphProps = style.findFirstChild(nameSpace, type);
    if (paragraphProps == null)
    {
      paragraphProps = new Section();
      paragraphProps.setNamespace(nameSpace);
      paragraphProps.setType(type);
      style.addNode(paragraphProps);
    }
    return paragraphProps;
  }
View Full Code Here

TOP

Related Classes of org.jfree.report.structure.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.