Examples of StyleSheet


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

    return true;
  }

  private RenderBox processTextEllipse(final RenderBox box, final long x2)
  {
    final StyleSheet style = box.getStyleSheet();
    final String reslit = (String) style.getStyleProperty(TextStyleKeys.RESERVED_LITERAL, ellipseOverride);
    if (reslit == null || "".equals(reslit))
    {
      // oh, no ellipse. Thats nice.
      return null;
    }

    final RenderBox textEllipse = (RenderBox) box.derive(false);
    final ReportAttributeMap map = box.getAttributes();
    final TextCache.Result result = textCache.get
        (style.getId(), style.getChangeTracker(), map.getChangeTracker(), reslit);
    if (result != null)
    {
      textEllipse.addGeneratedChilds(result.getText());
      textEllipse.addGeneratedChilds(result.getFinish());
      performTextEllipseLayout(textEllipse, x2);
      return textEllipse;
    }
    if (buffer != null)
    {
      buffer.setCursor(0);
    }

    buffer = Utf16LE.getInstance().decodeString(reslit, buffer);
    bufferArray = buffer.getBuffer(bufferArray);

    textFactory.startText();
    final RenderNode[] renderNodes = textFactory.createText
        (bufferArray, 0, buffer.getLength(), style, box.getElementType(), box.getInstanceId(), map);
    final RenderNode[] finishNodes = textFactory.finishText();

    textEllipse.addGeneratedChilds(renderNodes);
    textEllipse.addGeneratedChilds(finishNodes);
    textCache.store(style.getId(), style.getChangeTracker(),
        map.getChangeTracker(), reslit, style, map, renderNodes, finishNodes);
    performTextEllipseLayout(textEllipse, x2);
    return textEllipse;
  }
View Full Code Here

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

      return;
    }
    final ShapeDrawable drawable = (ShapeDrawable) rawbackend;
    final Shape shape = drawable.getShape();

    final StyleSheet styleSheet = node.getStyleSheet();
    final boolean draw = styleSheet.getBooleanStyleProperty(ElementStyleKeys.DRAW_SHAPE);
    if (draw && shape instanceof Line2D)
    {
      final Line2D line = (Line2D) shape;

      final boolean vertical = line.getX1() == line.getX2();
      final boolean horizontal = line.getY1() == line.getY2();
      if (vertical && horizontal)
      {
        // not a valid line ..
        return;
      }
      if (vertical == false && horizontal == false)
      {
        // not a valid line ..
        return;
      }
      if (retval == null)
      {
        retval = new CellBackground();
      }
      final BorderEdge edge = ProcessUtility.produceBorderEdge(styleSheet);
      if (vertical)
      {
        if (line.getX1() == 0)
        {
          if ((backgroundHint & BACKGROUND_LEFT) == BACKGROUND_LEFT)
          {
            retval.setLeft(edge);
          }
          else if ((backgroundHint & BACKGROUND_RIGHT) == BACKGROUND_RIGHT)
          {
            final RenderBox nodeParent = node.getParent();
            if (nodeParent != null && (nodeParent.getX() + nodeParent.getWidth()) == (nodeX + nodeWidth))
            {
              retval.setRight(edge);
            }
          }
        }
        else
        {
          if ((backgroundHint & BACKGROUND_RIGHT) == BACKGROUND_RIGHT)
          {
            retval.setRight(edge);
          }
        }
      }
      else
      {
        if (line.getY1() == 0)
        {
          if ((backgroundHint & BACKGROUND_TOP) == BACKGROUND_TOP)
          {
            retval.setTop(edge);
          }
          else if ((backgroundHint & BACKGROUND_BOTTOM) == BACKGROUND_BOTTOM)
          {
            final RenderBox nodeParent = node.getParent();
            if (nodeParent != null && (nodeParent.getY() + nodeParent.getHeight()) == (nodeY + nodeHeight))
            {
              retval.setBottom(edge);
            }
          }
        }
        else
        {
          if ((backgroundHint & BACKGROUND_BOTTOM) == BACKGROUND_BOTTOM)
          {
            retval.setBottom(edge);
          }
        }
      }
      return;
    }


    final boolean fill = styleSheet.getBooleanStyleProperty(ElementStyleKeys.FILL_SHAPE);
    if (draw == false && fill == false)
    {
      return;
    }

    if (shape instanceof Rectangle2D ||
        (ellipseAsRectangle && shape instanceof Ellipse2D))
    {
      if (retval == null)
      {
        retval = new CellBackground();
      }

      if (draw)
      {
        // the beast has a border ..
        final BorderEdge edge = ProcessUtility.produceBorderEdge(styleSheet);
        if (edge != null)
        {
          if ((backgroundHint & BACKGROUND_TOP) == BACKGROUND_TOP)
          {
            retval.setTop(edge);
          }
          if ((backgroundHint & BACKGROUND_LEFT) == BACKGROUND_LEFT)
          {
            retval.setLeft(edge);
          }
          if ((backgroundHint & BACKGROUND_BOTTOM) == BACKGROUND_BOTTOM)
          {
            retval.setBottom(edge);
          }
          if ((backgroundHint & BACKGROUND_RIGHT) == BACKGROUND_RIGHT)
          {
            retval.setRight(edge);
          }
        }
      }
      if (fill && ((backgroundHint & BACKGROUND_AREA) == BACKGROUND_AREA))
      {

        final Color color = (Color) styleSheet.getStyleProperty(ElementStyleKeys.FILL_COLOR);
        if (color != null)
        {
          retval.addBackground(color);
        }
        else
        {
          retval.addBackground((Color) styleSheet.getStyleProperty(ElementStyleKeys.PAINT));
        }
      }
      return;
    }

    if (shape instanceof RoundRectangle2D)
    {
      final RoundRectangle2D rr = (RoundRectangle2D) shape;
      if (retval == null)
      {
        retval = new CellBackground();
      }

      if (draw)
      {
        // the beast has a border ..
        final BorderEdge edge = ProcessUtility.produceBorderEdge(styleSheet);
        if (edge != null)
        {
          if ((backgroundHint & BACKGROUND_TOP) == BACKGROUND_TOP)
          {
            retval.setTop(edge);
          }
          if ((backgroundHint & BACKGROUND_LEFT) == BACKGROUND_LEFT)
          {
            retval.setLeft(edge);
          }
          if ((backgroundHint & BACKGROUND_BOTTOM) == BACKGROUND_BOTTOM)
          {
            retval.setBottom(edge);
          }
          if ((backgroundHint & BACKGROUND_RIGHT) == BACKGROUND_RIGHT)
          {
            retval.setRight(edge);
          }
        }
      }
      if (fill && ((backgroundHint & BACKGROUND_AREA) == BACKGROUND_AREA))
      {
        final Color color = (Color) styleSheet.getStyleProperty(ElementStyleKeys.FILL_COLOR);
        if (color != null)
        {
          retval.addBackground(color);
        }
        else
        {
          retval.addBackground((Color) styleSheet.getStyleProperty(ElementStyleKeys.PAINT));
        }
      }

      final long arcHeight = StrictGeomUtility.toInternalValue(rr.getArcHeight());
      final long arcWidth = StrictGeomUtility.toInternalValue(rr.getArcWidth());
View Full Code Here

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

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

  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

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

    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

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

                              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

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

    {
      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

Examples of org.pentaho.reporting.libraries.css.model.StyleSheet

      throws CSSException
  {
    initParseContext(source);
    if (this.styleSheet == null)
    {
      this.styleSheet = new StyleSheet();
      this.styleSheet.setSource(getSource());
    }
  }
View Full Code Here

Examples of org.sgx.yuigwt.yui.stylesheet.StyleSheet

        console.log("selected color: "+e.value());
      }
    });
    selList2.render(parent.appendChild("<div id=\"divcolorpicker\"></div>"));
   
    StyleSheet sty = Y.newStyleSheet();
   
    //the main color label
    sty.set("#divcolorpicker .itsa-selectlist-selectedmain div",
        Style.create().width("12px").height("10px").marginLeft("18px"));
   
    sty.set("#divcolorpicker .itsa-selectlist-ullist div",
        Style.create().width("15px").height("15px"));
   
    //the main icon
    sty.set("#divcolorpicker .itsa-icon-textcolor",
        Style.create().backgroundPosition("1px -215px").width("16px"));
   
    sty.set("#divcolorpicker .itsa-selectlist-ullist li",
        Style.create().display("inline-block")
        .padding("2px").border("solid 1px #FFF"));
  }
});
}
View Full Code Here

Examples of org.w3c.dom.stylesheets.StyleSheet

        NodeList nl = getElementsByTagName("style");
        Vector shs = new Vector();
        for (int count = 0; count < nl.getLength(); count++) {
            Node el = (Node) nl.item(count);
            SVGStyleElementImpl sse = (SVGStyleElementImpl) el;
            StyleSheet sheet = sse.getStyleSheet();
            shs.addElement(sheet);
        }
        return new StyleSheetListImpl(shs);
    }
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.