Examples of StyleSheet


Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

      if (attrs.isEmpty() == false)
      {
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, attrs, XmlWriterSupport.OPEN);
      }

      final StyleSheet styleSheet = node.getStyleSheet();
      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);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

    final long contentWidth = content.getContentWidth();
    final long nodeWidth = rc.getWidth();
    final long contentHeight = content.getContentHeight();
    final long nodeHeight = rc.getHeight();

    final StyleSheet styleSheet = rc.getStyleSheet();
    if (styleSheet.getBooleanStyleProperty(ElementStyleKeys.SCALE))
    {
      if (styleSheet.getBooleanStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO) &&
          (contentWidth > 0 && contentHeight > 0))
      {
        final double scaleFactor = Math.min(nodeWidth / (double) contentWidth, nodeHeight / (double) contentHeight);

        styleBuilder.append(WIDTH_STYLE, pointConverter.format
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

    // Remove all spacers and other non printable content that might
    // look ugly at the beginning of a new line ..
    for (; lastPosition < sequenceFill; lastPosition++)
    {
      final RenderNode node = nodes[lastPosition];
      final StyleSheet styleSheet = node.getStyleSheet();
      if (WhitespaceCollapse.PRESERVE.equals(styleSheet.getStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE)) &&
          styleSheet.getBooleanStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT) == false)
      {
        break;
      }

      if (node.isIgnorableForRendering() == false)
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

    final ExtendedBaselineInfo extendedBaselineInfo = box.getStaticBoxLayoutProperties().getNominalBaselineInfo();
    if (extendedBaselineInfo == null)
    {
      throw new IllegalStateException("Baseline info must not be null at this point");
    }
    final StyleSheet styleSheet = box.getNodeLayoutProperties().getStyleSheet();
    final double value = styleSheet.getDoubleStyleProperty(TextStyleKeys.LINEHEIGHT, 0);
    final long afterEdge = extendedBaselineInfo.getBaseline(ExtendedBaselineInfo.AFTER_EDGE);
    if (value <= 0)
    {
      box.getPool().setLineHeight(afterEdge);
    }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet


  private void computeBreakIndicator(final RenderBox box)
  {

    final StyleSheet styleSheet = box.getStyleSheet();
    final RenderBox parent = box.getParent();
    if (parent != null)
    {
      final boolean breakBefore = styleSheet.getBooleanStyleProperty(BandStyleKeys.PAGEBREAK_BEFORE);
      final boolean breakAfter = box.isBreakAfter();
      if ((breakBefore) && (parent.getNodeType() != LayoutNodeTypes.TYPE_BOX_PARAGRAPH))
      {
        box.setManualBreakIndicator(RenderBox.DIRECT_MANUAL_BREAK);
        applyIndirectManualBreakIndicator(parent);
        return;
      }
      if (breakAfter && (parent.getNodeType() != LayoutNodeTypes.TYPE_BOX_PARAGRAPH))
      {
        applyIndirectManualBreakIndicator(parent);
      }
    }

    final boolean fixedPosition = RenderLength.AUTO.equals
        (styleSheet.getStyleProperty(BandStyleKeys.FIXED_POSITION, RenderLength.AUTO)) == false;
    if (fixedPosition)
    {
      applyIndirectManualBreakIndicator(box);
    }
    else
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

    sblp.setBorderTop(border.getTop().getWidth());
    sblp.setBorderLeft(border.getLeft().getWidth());
    sblp.setBorderBottom(border.getBottom().getWidth());
    sblp.setBorderRight(border.getRight().getWidth());

    final StyleSheet style = box.getStyleSheet();
    if (box.getNodeType() == LayoutNodeTypes.TYPE_BOX_LINEBOX)
    {
      sblp.setAvoidPagebreakInside(true);
    }
    else
    {
      sblp.setAvoidPagebreakInside(style.getBooleanStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE, false));
    }

    sblp.setDominantBaseline(-1);
    sblp.setOrphans(style.getIntStyleProperty(ElementStyleKeys.ORPHANS, 0));
    sblp.setWidows(style.getIntStyleProperty(ElementStyleKeys.WIDOWS, 0));

    final ExtendedBaselineInfo baselineInfo = metaData.getBaselineInfo('x', style);
    if (baselineInfo == null)
    {
      throw new IllegalStateException();
    }
    sblp.setNominalBaselineInfo(baselineInfo);
    sblp.setFontFamily(metaData.getNormalizedFontFamilyName((String) style.getStyleProperty(TextStyleKeys.FONT)));

    final Object collapse = style.getStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE);
    sblp.setPreserveSpace(WhitespaceCollapse.PRESERVE.equals(collapse));
    sblp.setOverflowX(style.getBooleanStyleProperty(ElementStyleKeys.OVERFLOW_X, overflowXSupported));
    sblp.setOverflowY(style.getBooleanStyleProperty(ElementStyleKeys.OVERFLOW_Y, overflowYSupported));
    sblp.setInvisibleConsumesSpace(style.getBooleanStyleProperty
        (ElementStyleKeys.INVISIBLE_CONSUMES_SPACE, box.getNodeType() == LayoutNodeTypes.TYPE_BOX_ROWBOX));
    sblp.setVisible(style.getBooleanStyleProperty(ElementStyleKeys.VISIBLE));
    box.setStaticBoxPropertiesAge(box.getChangeTracker());
    computeBreakIndicator(box);
    return true;
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

    if (styleBuilder == null)
    {
      styleBuilder = new StyleBuilder();
    }

    final StyleSheet styleSheet = box.getStyleSheet();
    final Color textColor = (Color) styleSheet.getStyleProperty(ElementStyleKeys.PAINT);
    final Color backgroundColor = (Color) styleSheet.getStyleProperty(ElementStyleKeys.BACKGROUND_COLOR);

    styleBuilder.clear();
    if (includeBorder)
    {
      if (backgroundColor != null)
      {
        styleBuilder.append("background-color", HtmlColors.getColorString(backgroundColor));
      }

      final BoxDefinition boxDefinition = box.getBoxDefinition();
      final Border border = boxDefinition.getBorder();
      final BorderEdge top = border.getTop();
      if (top != null)
      {
        styleBuilder.appendRaw("border-top", styleBuilder.printEdgeAsCSS(top));
      }
      final BorderEdge left = border.getLeft();
      if (left != null)
      {
        styleBuilder.appendRaw("border-left", styleBuilder.printEdgeAsCSS(left));
      }
      final BorderEdge bottom = border.getBottom();
      if (bottom != null)
      {
        styleBuilder.appendRaw("border-bottom", styleBuilder.printEdgeAsCSS(bottom));
      }
      final BorderEdge right = border.getRight();
      if (right != null)
      {
        styleBuilder.appendRaw("border-right", styleBuilder.printEdgeAsCSS(right));
      }

      final long paddingTop = boxDefinition.getPaddingTop();
      final long paddingLeft = boxDefinition.getPaddingLeft();
      final long paddingBottom = boxDefinition.getPaddingBottom();
      final long paddingRight = boxDefinition.getPaddingRight();
      if (paddingTop > 0)
      {
        styleBuilder.append("padding-top", styleBuilder.getPointConverter().format
            (fixLengthForSafari(StrictGeomUtility.toExternalValue(paddingTop), fixLength)), "pt");
      }
      if (paddingLeft > 0)
      {
        styleBuilder.append("padding-left", styleBuilder.getPointConverter().format
            (fixLengthForSafari(StrictGeomUtility.toExternalValue(paddingLeft), fixLength)), "pt");
      }
      if (paddingBottom > 0)
      {
        styleBuilder.append("padding-bottom", styleBuilder.getPointConverter().format
            (fixLengthForSafari(StrictGeomUtility.toExternalValue(paddingBottom), fixLength)), "pt");
      }
      if (paddingRight > 0)
      {
        styleBuilder.append("padding-right", styleBuilder.getPointConverter().format
            (fixLengthForSafari(StrictGeomUtility.toExternalValue(paddingRight), fixLength)), "pt");
      }
    }
    if (textColor != null)
    {
      styleBuilder.append("color", HtmlColors.getColorString(textColor));
    }
    styleBuilder.appendRaw("font-family", translateFontFamily(box));
    styleBuilder.append("font-size", styleBuilder.getPointConverter().format
        (fixLengthForSafari(styleSheet.getDoubleStyleProperty(TextStyleKeys.FONTSIZE, 0), fixLength)), "pt");
    if (styleSheet.getBooleanStyleProperty(TextStyleKeys.BOLD))
    {
      styleBuilder.append("font-weight", "bold");
    }
    else
    {
      styleBuilder.append("font-weight", "normal");
    }

    if (styleSheet.getBooleanStyleProperty(TextStyleKeys.ITALIC))
    {
      styleBuilder.append("font-style", "italic");
    }
    else
    {
      styleBuilder.append("font-style", "normal");
    }

    final boolean underlined = styleSheet.getBooleanStyleProperty(TextStyleKeys.UNDERLINED);
    final boolean strikeThrough = styleSheet.getBooleanStyleProperty(TextStyleKeys.STRIKETHROUGH);
    if (underlined && strikeThrough)
    {
      styleBuilder.append("text-decoration", "underline line-through");
    }
    else if (strikeThrough)
    {
      styleBuilder.append("text-decoration", "line-through");
    }
    if (underlined)
    {
      styleBuilder.append("text-decoration", "underline");
    }
    else
    {
      styleBuilder.append("text-decoration", "none");
    }

    final ElementAlignment align = (ElementAlignment) styleSheet.getStyleProperty(ElementStyleKeys.ALIGNMENT);
    styleBuilder.append("text-align", translateHorizontalAlignment(align));

    final double wordSpacing = styleSheet.getDoubleStyleProperty(TextStyleKeys.WORD_SPACING, 0);
    styleBuilder.append("word-spacing", styleBuilder.getPointConverter().format
        (fixLengthForSafari(wordSpacing, fixLength)), "pt");

    final double minLetterSpacing = styleSheet.getDoubleStyleProperty(TextStyleKeys.X_MIN_LETTER_SPACING, 0);
    final double maxLetterSpacing = styleSheet.getDoubleStyleProperty(TextStyleKeys.X_MAX_LETTER_SPACING, 0);
    styleBuilder.append("letter-spacing", styleBuilder.getPointConverter().format
        (fixLengthForSafari(Math.min(minLetterSpacing, maxLetterSpacing), fixLength)), "pt");

    if (includeWhitespaceCollapse)
    {
      final WhitespaceCollapse wsCollapse = (WhitespaceCollapse)
          styleSheet.getStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE);
      if (WhitespaceCollapse.PRESERVE.equals(wsCollapse))
      {
        if (useWhitespacePreWrap)
        {
          // this style does not work for IE6 and IE7, but heck, in that case they just behave as if normal mode is
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

      {
        return true;
      }
      final ShapeDrawable drawable = (ShapeDrawable) rawbackend;
      final Shape rawObject = drawable.getShape();
      final StyleSheet styleSheet = element.getStyleSheet();
      if (shapesAsContent == false)
      {
        return false;
      }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

    this.imageCache = imageCache;
  }

  protected void processLinksAndAnchors(final RenderNode box)
  {
    final StyleSheet styleSheet = box.getStyleSheet();
    if (drawPdfScript(box) == false)
    {
      final String target = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TARGET);
      final String title = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TITLE);
      if (target != null || title != null)
      {
        final String window = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_WINDOW);
        drawHyperlink(box, target, window, title);
      }
    }

    final String anchor = (String) styleSheet.getStyleProperty(ElementStyleKeys.ANCHOR_NAME);
    if (anchor != null)
    {
      drawAnchor(box);
    }

    final String bookmark = (String) styleSheet.getStyleProperty(BandStyleKeys.BOOKMARK);
    if (bookmark != null)
    {
      drawBookmark(box, bookmark);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.style.StyleSheet

    final PdfContentByte cb;
    PdfTextSpec textSpec = (PdfTextSpec) getTextSpec();
    if (textSpec == null)
    {
      final StyleSheet layoutContext = renderableText.getStyleSheet();

      // The code below may be weird, but at least it is predictable weird.
      final String fontName = getMetaData().getNormalizedFontFamilyName
          ((String) layoutContext.getStyleProperty(TextStyleKeys.FONT));
      final String encoding = (String) layoutContext.getStyleProperty(TextStyleKeys.FONTENCODING);
      final float fontSize = (float) layoutContext.getDoubleStyleProperty(TextStyleKeys.FONTSIZE, 10);

      final boolean embed = globalEmbed || layoutContext.getBooleanStyleProperty(TextStyleKeys.EMBEDDED_FONT);
      final boolean bold = layoutContext.getBooleanStyleProperty(TextStyleKeys.BOLD);
      final boolean italics = layoutContext.getBooleanStyleProperty(TextStyleKeys.ITALIC);

      final BaseFontFontMetrics fontMetrics = outputProcessorMetaData.getBaseFontFontMetrics
          (fontName, fontSize, bold, italics, encoding, embed, false);

      final PdfGraphics2D g2 = (PdfGraphics2D) getGraphics();
      final Color cssColor = (Color) layoutContext.getStyleProperty(ElementStyleKeys.PAINT);
      g2.setPaint(cssColor);
      g2.setFillPaint();
      g2.setStrokePaint();
      //final float translateY = (float) affineTransform.getTranslateY();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.