Examples of RenderNode


Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

    final long computedWidth = box.getComputedWidth();
    final long contentAreaX1 = box.getContentAreaX1();
    long usedX2 = box.getContentAreaX2();
    if (box.getStyleSheet().getBooleanStyleProperty(ElementStyleKeys.USE_MIN_CHUNKWIDTH))
    {
      RenderNode node = box.getFirstChild();
      while (node != null)
      {
        final long x2 = node.getCachedX() + node.getCachedWidth();
        if (x2 > usedX2)
        {
          usedX2 = x2;
        }
        node = node.getNext();
      }
    }
    final long usedContentWidth = (usedX2 - contentAreaX1);

    final long bcw = ProcessUtility.computeBlockContextWidth(box);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode


    long nodeX2 = box.getContentAreaX2();
    if (box.getStyleSheet().getBooleanStyleProperty(ElementStyleKeys.USE_MIN_CHUNKWIDTH))
    {
      RenderNode node = box.getFirstChild();
      while (node != null)
      {
        final long nodeWidth = node.getCachedWidth() + node.getCachedX();
        if (nodeWidth > nodeX2)
        {
          nodeX2 = nodeWidth;
        }
        node = node.getNext();
      }
    }

    // now apply the maximum X2 we just computed ..
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

  protected void processParagraphChilds(final ParagraphRenderBox box)
  {
    if (box.isComplexParagraph())
    {
      final RenderBox lineboxContainer = box.getLineboxContainer();
      RenderNode node = lineboxContainer.getFirstChild();
      while (node != null)
      {
        // all childs of the linebox container must be inline boxes. They
        // represent the lines in the paragraph. Any other element here is
        // a error that must be reported
        if (node.getNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX)
        {
          throw new IllegalStateException("Expected ParagraphPoolBox elements.");
        }

        final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
        if (startLine(inlineRenderBox))
        {
          processBoxChilds(inlineRenderBox);
          finishLine(inlineRenderBox);
        }

        node = node.getNext();
      }
    }
    else
    {
      final ParagraphPoolBox node = box.getPool();
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

      processor.initialize(metaData, sequence, lineStart, lineEnd, pageGrid, overflowX);
    }

    while (processor.hasNext())
    {
      final RenderNode linebox = processor.next();
      if (linebox.getNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX)
      {
        throw new IllegalStateException("Line must not be null");
      }

      paragraph.addGeneratedChild(linebox);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

    // A table row is something special. Although it is a block box,
    // it layouts its children from left to right
    if (parent != null)
    {
      final RenderNode prev = node.getPrev();
      if (prev != null)
      {
        // we have a silbling. Position yourself directly below your silbling ..
        return (marginLeft + prev.getCachedX() + prev.getCachedWidth());
      }
      else
      {
        final StaticBoxLayoutProperties blp = parent.getStaticBoxLayoutProperties();
        final BoxDefinition bdef = parent.getBoxDefinition();
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

    if (value instanceof Image)
    {
      try
      {
        final ImageContainer imageContainer = new DefaultImageReference((Image) value);
        final RenderNode rawSource = textExtractor.getRawSource();
        final StrictBounds contentBounds =
            new StrictBounds(content.getX(), content.getY() + contentOffset, content.getWidth(), content.getHeight());
        createImageCell(rawSource, imageContainer, sheetLayout, rectangle, contentBounds);
      }
      catch (IOException ioe)
      {
        // Should not happen.
        ExcelPrinter.logger.warn("Failed to process AWT-Image in Excel-Export", ioe);
      }
      return false;
    }
    else if (value instanceof ImageContainer)
    {
      final ImageContainer imageContainer = (ImageContainer) value;
      // todo: this is wrong ..
      final RenderNode rawSource = textExtractor.getRawSource();
      final StrictBounds contentBounds =
          new StrictBounds(content.getX(), content.getY() + contentOffset, content.getWidth(), content.getHeight());
      createImageCell(rawSource, imageContainer, sheetLayout, rectangle, contentBounds);
      return false;
    }
    else if (value instanceof DrawableWrapper)
    {
      final DrawableWrapper drawable = (DrawableWrapper) value;
      final RenderNode rawSource = textExtractor.getRawSource();
      final StrictBounds contentBounds = new StrictBounds
          (rawSource.getX(), rawSource.getY() + contentOffset, rawSource.getWidth(), rawSource.getHeight());
      final ImageContainer imageFromDrawable =
          RenderUtility.createImageFromDrawable(drawable, contentBounds, content, metaData);
      createImageCell(rawSource, imageFromDrawable, sheetLayout, rectangle, contentBounds);
      return false;
    }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

      }

      // A breakmark box must be translated into a finished node, so that we consume space without
      // triggering yet another break. The finished node will consume all space up to the next pagebreak.
      final long width = box.getContentAreaX2() - box.getContentAreaX1();
      final RenderNode prevSilbling = box.getPrev();
      if (prevSilbling == null)
      {
        // Node is first, so the parent's y is the next edge we take care of.
        final long y = parent.getY();
        final long y2 = Math.max(pageOffset, box.getY() + box.getHeight());
        parent.replaceChild(box, new FinishedRenderNode(width, y2 - y, 0, 0, true));
      }
      else
      {
        final long y = prevSilbling.getY() + prevSilbling.getHeight();
        final long y2 = Math.max(pageOffset, box.getY() + box.getHeight());
        parent.replaceChild(box, new FinishedRenderNode(width, y2 - y, 0, 0, true));
      }
    }

    if (box.isFinished() == false)
    {
      return true;
    }

    final RenderNode firstNode = box.getFirstChild();
    if (firstNode == null)
    {
      // The cell is empty ..
      return false;
    }

    final long nodeY = firstNode.getY();
    if (nodeY > pageOffset)
    {
      // This box will be visible or will be processed in the future.
      return false;
    }

    if (firstNode.isOpen())
    {
      return true;
    }

    if ((nodeY + firstNode.getHeight()) > pageOffset)
    {
      // this box will span to the next page and cannot be removed ...
      return true;
    }

    // Next, search the last node that is fully invisible. We collapse all
    // invisible node into one big box for efficiency reasons. They wont be
    // visible anyway and thus the result will be the same as if they were
    // still alive ..
    RenderNode last = firstNode;
    while (true)
    {
      final RenderNode next = last.getNext();
      if (next == null)
      {
        break;
      }
      if (next.isOpen())
      {
        // as long as a box is open, it can grow and therefore it cannot be
        // removed ..
        break;
      }

      if ((next.getY() + next.getHeight()) > pageOffset)
      {
        // we cant handle that. This node will be visible. So the current last
        // node is the one we can shrink ..
        break;
      }
      last = next;
    }

    // todo: Aggressive removing by commenting out this if-block does seem to trigger a bug in the code below
    if (last == firstNode)
    {
      if (last.getNodeType() == LayoutNodeTypes.TYPE_NODE_FINISHEDNODE)
      {
        // In this case, we can skip the replace-action below ..
        return true;
      }
    }

    final StaticBoxLayoutProperties sblp = box.getStaticBoxLayoutProperties();
    final long insetsTop = sblp.getBorderTop() + box.getBoxDefinition().getPaddingTop();

    // So lets get started. We remove all nodes between (and inclusive)
    // node and last.
    final long width = box.getContentAreaX2() - box.getContentAreaX1();
    final long lastY2;
    if (last.getNext() == null)
    {
      lastY2 = last.getY() + last.getHeight();
    }
    else
    {
      // in case the next box had been shifted
      lastY2 = last.getNext().getY();
    }
    final long startOfBox = box.getY() + insetsTop;
    final long height = lastY2 - startOfBox;

    // make sure that the finished-box inherits the margins ..
    final long marginsTop = firstNode.getEffectiveMarginTop();
    final long marginsBottom = last.getEffectiveMarginBottom();
    final boolean breakAfter = isBreakAfter(last);
    final FinishedRenderNode replacement = new FinishedRenderNode(width, height, marginsTop, marginsBottom, breakAfter);

    RenderNode removeNode = firstNode;
    while (removeNode != last)
    {
      final RenderNode next = removeNode.getNext();
      if (removeNode.isOpen())
      {
        throw new IllegalStateException("A node is still open. We should not have come that far.");
      }
      box.remove(removeNode);
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

    }

    if ((node.getNodeType() & LayoutNodeTypes.MASK_BOX_BLOCK) == LayoutNodeTypes.MASK_BOX_BLOCK)
    {
      final RenderBox box = (RenderBox) node;
      final RenderNode lastChild = box.getLastChild();
      if (lastChild != null)
      {
        return isBreakAfter(lastChild);
      }
    }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

    processBoxChilds(box.getPool());
  }

  protected final void processBoxChilds(final RenderBox box)
  {
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      startProcessing(node);
      node = node.getNext();
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.model.RenderNode

    breakUtility = new PageBreakPositionList();
  }

  public PaginationResult performPagebreak(final LogicalPageBox pageBox)
  {
    final RenderNode lastChild = pageBox.getLastChild();
    if (lastChild != null)
    {
      final long lastChildY2 = lastChild.getY() + lastChild.getHeight();
      if (lastChildY2 < pageBox.getHeight())
      {
        throw new IllegalStateException
            ("Assertation failed: Block layouting did not proceed: " + lastChildY2 + " < " + pageBox.getHeight());
      }
    }

    this.breakPending = false;
    this.breakAdded = false;
    this.finalVisibleState = null;
    this.pageEnd = pageBox.getHeight();

    final PageBreakPositionList allPreviousBreak = pageBox.getAllVerticalBreaks();

    // Note: For now, we limit both the header and footer to a single physical
    // page. This safes me a lot of trouble for now.
    breakUtility.copyFrom(allPreviousBreak);

    // now process all the other content (excluding the header and footer area)
    if (startBlockLevelBox(pageBox))
    {
      processBoxChilds(pageBox);
    }
    finishBlockLevelBox(pageBox);

    if (lastChild != null)
    {
      final long lastChildY2 = lastChild.getY() + lastChild.getHeight();
      if (lastChildY2 < pageBox.getHeight())
      {
        throw new IllegalStateException
            ("Assertation failed: Pagination violated block-constraints: " + lastChildY2 + " < " + pageBox.getHeight());
      }
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.