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

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


  }

  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();
      final int nodeType = parent.getLayoutNodeType();
      if ((breakBefore) && (nodeType != LayoutNodeTypes.TYPE_BOX_PARAGRAPH))
      {
        box.setManualBreakIndicator(RenderBox.BreakIndicator.DIRECT_MANUAL_BREAK);
        applyIndirectManualBreakIndicator(parent);
        return;
      }
      if (breakAfter && (nodeType != 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

  }

  private void computeResolvedStyleProperties(final RenderBox box, final StaticBoxLayoutProperties sblp)
  {
    final StyleSheet style = box.getStyleSheet();

    NodeLayoutProperties nlp = box.getNodeLayoutProperties();
    if (designTime)
    {
      // at design-time elements can be generated that are not visible in the final output
      // the report designer needs them to create a smooth design experience.
      RenderBox parent = box.getParent();
      if (parent == null)
      {
        nlp.setVisible(style.getBooleanStyleProperty(ElementStyleKeys.VISIBLE));
      }
      else if (parent.isEmptyNodesHaveSignificance() == false)
      {
        nlp.setVisible(style.getBooleanStyleProperty(ElementStyleKeys.VISIBLE));
      }
    }

    final int nodeType = box.getLayoutNodeType();
    if ((nodeType & LayoutNodeTypes.MASK_BOX_INLINE) == LayoutNodeTypes.MASK_BOX_INLINE)
    {
      sblp.setAvoidPagebreakInside(true);
    }
    else if (nodeType == LayoutNodeTypes.TYPE_BOX_TABLE_ROW || nodeType == LayoutNodeTypes.TYPE_BOX_ROWBOX)
    {
      sblp.setAvoidPagebreakInside(style.getBooleanStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE, true));
    }
    else
    {
      sblp.setAvoidPagebreakInside(style.getBooleanStyleProperty(ElementStyleKeys.AVOID_PAGEBREAK_INSIDE, false));
    }

    sblp.setDominantBaseline(-1);

    if (widowsEnabled)
    {
      sblp.setOrphans(style.getIntStyleProperty(ElementStyleKeys.ORPHANS, 0));
      sblp.setWidows(style.getIntStyleProperty(ElementStyleKeys.WIDOWS, 0));

      final boolean orphanOptOut = style.getBooleanStyleProperty(ElementStyleKeys.WIDOW_ORPHAN_OPT_OUT, true);
      sblp.setWidowOrphanOptOut(orphanOptOut);
    }
    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, nodeType == LayoutNodeTypes.TYPE_BOX_ROWBOX));
    sblp.setVisible(style.getBooleanStyleProperty(ElementStyleKeys.VISIBLE));

    final RenderBox parent = box.getParent();
    if (parent != null &&
        style.getDoubleStyleProperty(ElementStyleKeys.MIN_WIDTH, 0) == 0 &&
        style.getDoubleStyleProperty(ElementStyleKeys.WIDTH, 0) == 0)
    {
      // todo: Should that flag also take paddings and borders of the parent into account?
      // They alter the available space for the childs, and thus it would make sense to establish a new
      // context for resolving percentage-widths
View Full Code Here

    // 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

      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 (edge == null)
      {
        return;
      }
      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

    if (box.getBoxDefinition().getBorder().isEmpty() == false)
    {
      return MARKER_DEFINITION;
    }

    final StyleSheet styleSheet = box.getStyleSheet();
    if (styleSheet.getStyleProperty(ElementStyleKeys.BACKGROUND_COLOR) != null)
    {
      return MARKER_DEFINITION;
    }

    if (styleSheet.getStyleProperty(ElementStyleKeys.ANCHOR_NAME) != null)
    {
      return MARKER_DEFINITION;
    }
    return null;
  }
View Full Code Here

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

    final StyleSheet styleSheet = box.getStyleSheet();
    final String target = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TARGET);
    if (target != null)
    {
      textExtractorHelper.handleLinkOnElement(styleSheet, target);
      processStack = new HtmlTextExtractorState(processStack, true);
    }
View Full Code Here

    {
      return null;
    }
    final RenderableReplacedContentBox contentBox = (RenderableReplacedContentBox) box;

    final StyleSheet styleSheet = box.getStyleSheet();
    final RenderableReplacedContent rpc = contentBox.getContent();
    final Object rawContentObject = rpc.getRawObject();
    if (rawContentObject instanceof DrawableWrapper == false)
    {
      return null;
    }
    final DrawableWrapper wrapper = (DrawableWrapper) rawContentObject;
    final Object rawbackend = wrapper.getBackend();
    if (rawbackend instanceof ShapeDrawable == false)
    {
      return null;
    }
    final ShapeDrawable drawable = (ShapeDrawable) rawbackend;
    final Shape rawObject = drawable.getShape();

    final boolean draw = styleSheet.getBooleanStyleProperty(ElementStyleKeys.DRAW_SHAPE);
    if (draw && rawObject instanceof Line2D)
    {
      final int lineType;
      final long coordinate;
      final Line2D line = (Line2D) rawObject;

      final boolean vertical = line.getX1() == line.getX2();
      final boolean horizontal = line.getY1() == line.getY2();
      if (vertical && horizontal)
      {
        return null;
      }
      if (vertical)
      {
        lineType = SheetLayoutTableCellDefinition.LINE_HINT_VERTICAL;
        coordinate = StrictGeomUtility.toInternalValue(line.getX1()) + box.getX();
      }
      else if (horizontal)
      {
        lineType = SheetLayoutTableCellDefinition.LINE_HINT_HORIZONTAL;
        coordinate = StrictGeomUtility.toInternalValue(line.getY1()) + box.getY() + shift;
      }
      else
      {
        return null;
      }

      return new SheetLayoutTableCellDefinition(lineType, coordinate);
    }

    if (rawObject instanceof Rectangle2D ||
        (ellipseAsRectangle && rawObject instanceof Ellipse2D))
    {
      if (draw)
      {
        final BorderEdge edge = ProcessUtility.produceBorderEdge(box.getStyleSheet());
        if (edge != null)
        {
          return MARKER_DEFINITION;
        }
      }
      if (styleSheet.getBooleanStyleProperty(ElementStyleKeys.FILL_SHAPE))
      {
        return MARKER_DEFINITION;
      }

      return null;
    }

    if (rawObject instanceof RoundRectangle2D)
    {
      if (draw)
      {
        // the beast has a border ..
        final BorderEdge edge = ProcessUtility.produceBorderEdge(box.getStyleSheet());
        if (edge != null)
        {
          return MARKER_DEFINITION;
        }
      }
      if (styleSheet.getBooleanStyleProperty(ElementStyleKeys.FILL_SHAPE))
      {
        return MARKER_DEFINITION;
      }

      return null;
View Full Code Here

        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, DIV_TAG, attrs, XmlWriterSupport.OPEN);
      }

      textExtractorHelper.writeLocalAnchor(node.getStyleSheet());

      final StyleSheet styleSheet = node.getStyleSheet();
      final String target = (String) styleSheet.getStyleProperty(ElementStyleKeys.HREF_TARGET);
      if (target != null)
      {
        textExtractorHelper.handleLinkOnElement(styleSheet, target);
      }
View Full Code Here

    final ReportAttributeMap attrs = node.getAttributes();
    final long width = node.getWidth();
    final long height = node.getHeight();
    final long contentWidth = rc.getContentWidth();
    final long contentHeight = rc.getContentHeight();
    final StyleSheet styleSheet = node.getStyleSheet();

    final Object rawObject = rc.getRawObject();
    // We have to do three things here. First, we have to check what kind
    // of content we deal with.
    if (textExtractorHelper.processRenderableReplacedContent(attrs, styleSheet, width, height, contentWidth, contentHeight, rawObject))
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.