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

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


        this.borderStrokeRight = HSSFCellStyleProducer.translateStroke(right.getBorderStyle(), right.getWidth());
      }

      if (content != null)
      {
        final StyleSheet styleSheet = content.getStyleSheet();
        final Color textColor = (Color) styleSheet.getStyleProperty(ElementStyleKeys.PAINT);
        final String fontName = (String) styleSheet.getStyleProperty(TextStyleKeys.FONT);
        final short fontSize = (short) styleSheet.getIntStyleProperty(TextStyleKeys.FONTSIZE, 0);
        final boolean bold = styleSheet.getBooleanStyleProperty(TextStyleKeys.BOLD);
        final boolean italic = styleSheet.getBooleanStyleProperty(TextStyleKeys.ITALIC);
        final boolean underline = styleSheet.getBooleanStyleProperty(TextStyleKeys.UNDERLINED);
        final boolean strikethrough = styleSheet.getBooleanStyleProperty(TextStyleKeys.STRIKETHROUGH);
        final HSSFFontWrapper wrapper = new HSSFFontWrapper
            (fontName, fontSize, bold, italic, underline, strikethrough, fontColorProducer.getNearestColor(textColor));
        final Font excelFont = fontFactory.getExcelFont(wrapper);
        this.font = excelFont.getIndex();

        final ElementAlignment horizontal =
            (ElementAlignment) styleSheet.getStyleProperty(ElementStyleKeys.ALIGNMENT);
        this.horizontalAlignment = HSSFCellStyleProducer.convertAlignment(horizontal);
        final ElementAlignment vertical =
            (ElementAlignment) styleSheet.getStyleProperty(ElementStyleKeys.VALIGNMENT);
        this.verticalAlignment = HSSFCellStyleProducer.convertAlignment(vertical);
        final String dataStyle =
            (String) styleSheet.getStyleProperty(ElementStyleKeys.EXCEL_DATA_FORMAT_STRING);
        if (dataStyle != null)
        {
          this.dataStyle = dataFormat.getFormat(dataStyle);
        }
        this.wrapText = isWrapText(styleSheet);
View Full Code Here


  public void testStylesToArray ()
  {
    final ManualBreakIndicatorStyleSheet mbis =
        new ManualBreakIndicatorStyleSheet(BandDefaultStyleSheet.getBandDefaultStyle());
    final StyleSheet manualBreakBoxStyle = new SimpleStyleSheet(mbis);

    final int styleCount = (StyleKey.getDefinedStyleKeyCount());
    assertTrue(styleCount > 0);
    final Object[] objects = manualBreakBoxStyle.toArray();
    assertNotNull(objects);
    assertEquals(objects.length, styleCount);
  }
View Full Code Here

    g2.scale(scale, scale);
    // the clipping bounds are a sub-area of the whole drawable
    // we only want to print a certain area ...

    final StyleSheet style = box.getStyleSheet();
    final String fontName = (String) style.getStyleProperty(TextStyleKeys.FONT);
    final int fontSize = style.getIntStyleProperty(TextStyleKeys.FONTSIZE, 8);
    final boolean bold = style.getBooleanStyleProperty(TextStyleKeys.BOLD);
    final boolean italics = style.getBooleanStyleProperty(TextStyleKeys.ITALIC);
    if (bold && italics)
    {
      g2.setFont(new Font(fontName, Font.BOLD | Font.ITALIC, fontSize));
    }
    else if (bold)
    {
      g2.setFont(new Font(fontName, Font.BOLD, fontSize));
    }
    else if (italics)
    {
      g2.setFont(new Font(fontName, Font.ITALIC, fontSize));
    }
    else
    {
      g2.setFont(new Font(fontName, Font.PLAIN, fontSize));
    }

    g2.setStroke((Stroke) style.getStyleProperty(ElementStyleKeys.STROKE));
    g2.setPaint((Paint) style.getStyleProperty(ElementStyleKeys.PAINT));

    drawable.draw(g2, new Rectangle2D.Double(0, 0, imageWidth, imageHeight));
    g2.dispose();

    try
View Full Code Here

                              final ReportStateKey stateKey)
  {
    final StyleKey styleKey = ElementStyleKeys.PADDING_LEFT;
    if ((parentBox.getNodeType() & LayoutNodeTypes.MASK_BOX_INLINE) == LayoutNodeTypes.MASK_BOX_INLINE)
    {
      final StyleSheet styleSheet = bandCache.getStyleSheet(elementStyle);
      final BoxDefinition boxDefinition = boxDefinitionFactory.getBoxDefinition(styleSheet);
      final InlineRenderBox autoParagraphBox =
          new InlineRenderBox(styleSheet, element.getObjectID(), boxDefinition,
              element.getElementType(), element.getAttributes(), stateKey);
      autoParagraphBox.setName(element.getName());
      autoParagraphBox.getBoxDefinition().setPreferredWidth(RenderLength.AUTO);
      autoParagraphBox.addChilds(renderNodes);
      autoParagraphBox.addChilds(finishNodes);
      autoParagraphBox.close();
      final Object property = styleSheet.getStyleProperty(styleKey);
      parentBox.addChild(autoParagraphBox);
    }
    else
    {
      final StyleSheet styleSheet = bandCache.getStyleSheet(elementStyle);
      final BoxDefinition boxDefinition = boxDefinitionFactory.getBoxDefinition(styleSheet);
      final ParagraphRenderBox autoParagraphBox = new ParagraphRenderBox
          (styleSheet, element.getObjectID(), boxDefinition, element.getElementType(), element.getAttributes(),
              stateKey);
      autoParagraphBox.setRawValue(rawValue);
      autoParagraphBox.setName(element.getName());
      autoParagraphBox.getBoxDefinition().setPreferredWidth(RenderLength.AUTO);
      autoParagraphBox.addChilds(renderNodes);
      autoParagraphBox.addChilds(finishNodes);
      autoParagraphBox.close();
      final Object property = styleSheet.getStyleProperty(styleKey);
      parentBox.addChild(autoParagraphBox);
    }
  }
View Full Code Here

    {
      groupStack.push(new IgnoredContentIndicator());
      return;
    }

    final StyleSheet styleSheet = ElementDefaultStyleSheet.getDefaultStyle();

    final RenderBox box;
    if (insertationPoint == null)
    {
      final SimpleStyleSheet reportStyle = sectionStyleCache.getStyleSheet(styleSheet);
      final BoxDefinition boxDefinition = boxDefinitionFactory.getBoxDefinition(reportStyle);
      box = new BlockRenderBox
          (reportStyle, report.getObjectID(), boxDefinition, SubReportType.INSTANCE, report.getAttributes(), null);
      if (report.getName() != null)
      {
        box.setName("SubReport-Section-" + groupStack.size() + ": name=" + report.getName());
      }
      else
      {
        box.setName("SubReport-Section-" + groupStack.size());
      }

      box.getStaticBoxLayoutProperties().setPlaceholderBox(true);
      addBox(box);
    }
    else
    {
      final RenderNode maybeBox = pageBox.findNodeById(insertationPoint);
      if (maybeBox == null || (maybeBox.getNodeType() & LayoutNodeTypes.MASK_BOX) != LayoutNodeTypes.MASK_BOX)
      {
        box = null;
      }
      else
      {
        box = (RenderBox) maybeBox;
      }
    }

    if (box == null)
    {
      this.groupStack.push(new IgnoredContentIndicator());
    }
    else if (styleSheet.getBooleanStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE))
    {
      this.groupStack.push(new GroupSection(box, bandWithKeepTogetherStyle));
    }
    else
    {
View Full Code Here

    return renderComponentFactory.createTextProducer();
  }

  public void startSubFlow(final ReportElement element)
  {
    final StyleSheet resolverStyleSheet = element.getComputedStyle();

    final RenderBox box;
    if (getMetaData().isFeatureSupported(OutputProcessorFeature.STRICT_COMPATIBILITY))
    {
      final StyleSheet styleSheet = new DesignerSubReportStyleSheet(new SubReportStyleSheet
          (resolverStyleSheet.getBooleanStyleProperty(BandStyleKeys.PAGEBREAK_BEFORE),
              (resolverStyleSheet.getBooleanStyleProperty(BandStyleKeys.PAGEBREAK_AFTER))));

      final SimpleStyleSheet reportStyle = new SimpleStyleSheet(styleSheet);
      final BoxDefinition boxDefinition = getRenderNodeFactory().getBoxDefinition(reportStyle);
View Full Code Here

      {
        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

    {
      lineBreakState.add(TextSequenceElement.INSTANCE, node);
    }
    else if (nodeType == LayoutNodeTypes.TYPE_NODE_SPACER)
    {
      final StyleSheet styleSheet = node.getStyleSheet();
      if (WhitespaceCollapse.PRESERVE.equals(styleSheet.getStyleProperty(TextStyleKeys.WHITE_SPACE_COLLAPSE)) &&
          styleSheet.getBooleanStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT) == false)
      {
        // bug-alert: This condition could indicate a workaround for a logic-flaw in the text-processor
        lineBreakState.add(SpacerSequenceElement.INSTANCE, node);
      }
      else if (lineBreakState.isContainsContent())
View Full Code Here

    if (box.getStaticBoxLayoutProperties().isVisible() == false)
    {
      return false;
    }

    final StyleSheet styleSheet = box.getStyleSheet();
    final Color textColor = (Color) styleSheet.getStyleProperty(ElementStyleKeys.PAINT);
    final HSSFFontWrapper wrapper = new HSSFFontWrapper
        (styleSheet, colorProducer.getNearestColor(textColor));
    final RichTextFormat rtf = new RichTextFormat(getTextLength(), wrapper);

    // Check the style.
View Full Code Here

      int relativeLength = 0;
      // iterate through all inline elements
      for (RichTextSpec.StyledChunk styledChunk : renderableComplexText.getRichText().getStyleChunks())
      {
        // Add style for current styled chunk
        final StyleSheet styleSheet = styledChunk.getStyleSheet();
        final Color textColor = (Color) styleSheet.getStyleProperty(ElementStyleKeys.PAINT);
        final String fontName = (String) styleSheet.getStyleProperty(TextStyleKeys.FONT);
        final short fontSize = (short) styleSheet.getIntStyleProperty(TextStyleKeys.FONTSIZE, 0);
        final boolean bold = styleSheet.getBooleanStyleProperty(TextStyleKeys.BOLD);
        final boolean italic = styleSheet.getBooleanStyleProperty(TextStyleKeys.ITALIC);
        final boolean underline = styleSheet.getBooleanStyleProperty(TextStyleKeys.UNDERLINED);
        final boolean strikethrough = styleSheet.getBooleanStyleProperty(TextStyleKeys.STRIKETHROUGH);
        final HSSFFontWrapper wrapper = new HSSFFontWrapper
            (fontName, fontSize, bold, italic, underline, strikethrough, colorProducer.getNearestColor(textColor));

        if (styledChunk.getOriginatingTextNode() instanceof RenderableComplexText)
        {
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.style.StyleSheet

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.