Examples of RenderBox


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

    }

    // now, build the line and update the array ..
    pendingElements.clear();
    contexts.clear();
    RenderBox firstBox = null;
    RenderBox box = null;
    for (int i = 0; i < lastPosition; i++)
    {
      final RenderNode node = nodes[i];
      final InlineSequenceElement element = sequenceElements[i];
      if (element instanceof EndSequenceElement)
      {
        contexts.pop();
        final long boxX2 = (elementPositions[i] + elementDimensions[i]);
        box.setCachedWidth(boxX2 - box.getCachedX());

        if (contexts.isEmpty())
        {
          box = null;
        }
        else
        {
          final RenderNode tmpnode = box;
          box = (RenderBox) contexts.peek();
          box.addGeneratedChild(tmpnode);
        }
        continue;
      }

      if (element instanceof StartSequenceElement)
      {
        box = (RenderBox) node.derive(false);
        box.setCachedX(elementPositions[i]);
        contexts.push(box);
        if (firstBox == null)
        {
          firstBox = box;
        }
        continue;
      }

      if (box == null)
      {
        throw new IllegalStateException("Invalid sequence: " +
            "Cannot have elements before we open the box context.");
      }

      // Content element: Perform a deep-deriveForAdvance, so that we preserve the
      // possibly existing sub-nodes.
      final RenderNode child = node.derive(true);
      child.setCachedX(elementPositions[i]);
      child.setCachedWidth(elementDimensions[i]);
      if (box.getStaticBoxLayoutProperties().isPreserveSpace() &&
          box.getStyleSheet().getBooleanStyleProperty(TextStyleKeys.TRIM_TEXT_CONTENT) == false)
      {
        // Take a shortcut as we know that we will never have any pending elements if preserve is true and
        // trim-content is false.
        box.addGeneratedChild(child);
        continue;
      }

      if (child.isIgnorableForRendering())
      {
        pendingElements.add(child);
      }
      else
      {
        for (int j = 0; j < pendingElements.size(); j++)
        {
          final RenderNode pendingNode = (RenderNode) pendingElements.get(j);
          box.addGeneratedChild(pendingNode);
        }
        pendingElements.clear();
        box.addGeneratedChild(child);
      }
    }

    // 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)
      {
        break;
      }
    }

    // If there are open contexts, then add the split-result to the new line
    // and update the width of the current line
    RenderBox previousContext = null;
    final int openContexts = contexts.size();
    for (int i = 0; i < openContexts; i++)
    {
      final RenderBox renderBox = (RenderBox) contexts.get(i);
      renderBox.setCachedWidth(getEndOfLine() - box.getCachedX());

      final InlineRenderBox rightBox = (InlineRenderBox) renderBox.split(RenderNode.HORIZONTAL_AXIS);
      sequenceElements[i] = StartSequenceElement.INSTANCE;
      nodes[i] = rightBox;
      if (previousContext != null)
      {
        previousContext.addGeneratedChild(renderBox);
View Full Code Here

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

    // now, update the element's positions and dimensions ..

    if (lastPosition == sequenceFill || lastLineAlignment)
    {
      // First, the simple case: The line's content did fully fit into the linebox. No linebreaks were necessary.
      RenderBox firstBox = null;
      for (int i = 0; i < lastPosition; i++)
      {
        final RenderNode node = nodes[i];
        final InlineSequenceElement element = sequenceElements[i];
        if (element instanceof EndSequenceElement)
        {
          final long boxX2 = (elementPositions[i] + elementDimensions[i]);
          final RenderBox box = (RenderBox) node;
          box.setCachedWidth(boxX2 - box.getCachedX());
          continue;
        }

        if (element instanceof StartSequenceElement)
        {
          final RenderBox box = (RenderBox) node;
          box.setCachedX(elementPositions[i]);
          if (firstBox == null)
          {
            firstBox = box;
          }
          continue;
View Full Code Here

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

      {
        xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "tr",
            createRowAttributes(logicalPage, sheetLayout, row, contentProducer), XmlWriterSupport.OPEN);
        for (int col = 0; col < colCount; col++)
        {
          final RenderBox content = contentProducer.getContent(row, col);
          final int sectionType = contentProducer.getSectionType(row, col);
          if (content == null)
          {
            final CellBackground background = cellBackgroundProducer.getBackgroundAt
                (logicalPage, sheetLayout, col, row, true, sectionType);
            if (background == null)
            {
              if (emptyCellsUseCSS)
              {
                xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", XmlWriterSupport.CLOSE);
              }
              else
              {
                final AttributeList attrs = new AttributeList();
                attrs.setAttribute(HtmlPrinter.XHTML_NAMESPACE, "style", "font-size: 1pt");
                xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", attrs, XmlWriterSupport.OPEN);
                xmlWriter.writeText("&nbsp;");
                xmlWriter.writeCloseTag();
              }
              continue;
            }

            // Background cannot be null at this point ..
            final String[] anchor = background.getAnchors();
            if (anchor.length == 0 && emptyCellsUseCSS)
            {
              final AttributeList cellAttributes = createCellAttributes(1, 1, null, background, null, null);
              xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.CLOSE);
            }
            else
            {
              final AttributeList cellAttributes =
                  createCellAttributes(1, 1, null, background, HtmlPrinter.EMPTY_CELL_ATTRNAMES,
                      HtmlPrinter.EMPTY_CELL_ATTRVALS);
              xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.OPEN);
              for (int i = 0; i < anchor.length; i++)
              {
                xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor[i], XmlWriterSupport.CLOSE);
              }
              xmlWriter.writeText("&nbsp;");
              xmlWriter.writeCloseTag();

            }
            continue;
          }

          if (content.isCommited() == false)
          {
            throw new InvalidReportStateException(
                "Uncommited content encountered: " + row + ", " + col + ' ' + content);
          }

          final long contentOffset = contentProducer.getContentOffset(row, col);

          final long colPos = sheetLayout.getXPosition(col);
          final long rowPos = sheetLayout.getYPosition(row);
          if (content.getX() != colPos || (content.getY() + contentOffset) != rowPos)
          {
            // A spanned cell ..
            if (content.isFinished())
            {
              continue;
            }
          }

          final int colSpan = sheetLayout.getColSpan(col, content.getX() + content.getWidth());
          final int rowSpan = sheetLayout.getRowSpan(row, content.getY() + content.getHeight() + contentOffset);

          final CellBackground realBackground = cellBackgroundProducer.getBackgroundAt
              (logicalPage, sheetLayout, col, row, colSpan, rowSpan, true, sectionType);


          final AttributeList cellAttributes = createCellAttributes(colSpan, rowSpan, content, realBackground, null,
              null);
          xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "td", cellAttributes, XmlWriterSupport.OPEN);

          final Object rawContent = content.getAttributes().getAttribute(AttributeNames.Html.NAMESPACE,
              AttributeNames.Html.EXTRA_RAW_CONTENT);
          if (rawContent != null)
          {
            xmlWriter.writeText(String.valueOf(rawContent));
          }

          if (realBackground != null)
          {
            final String[] anchors = realBackground.getAnchors();
            for (int i = 0; i < anchors.length; i++)
            {
              final String anchor = anchors[i];
              xmlWriter.writeTag(HtmlPrinter.XHTML_NAMESPACE, "a", "name", anchor, XmlWriterSupport.CLOSE);
            }
          }

          if (Boolean.TRUE.equals(content.getAttributes().getAttribute(AttributeNames.Html.NAMESPACE,
              AttributeNames.Html.SURPRESS_CONTENT)) == false)
          {
            // the style of the content-box itself is already contained in the <td> tag. So there is no need
            // to duplicate the style here
            if (textExtractor.performOutput(content, true) == false)
            {
              if (emptyCellsUseCSS == false)
              {
                xmlWriter.writeText("&nbsp;");
              }
            }
          }

          final Object rawFooterContent = content.getAttributes().getAttribute(AttributeNames.Html.NAMESPACE,
              AttributeNames.Html.EXTRA_RAW_FOOTER_CONTENT);
          if (rawFooterContent != null)
          {
            xmlWriter.writeText(String.valueOf(rawFooterContent));
          }

          xmlWriter.writeCloseTag();
          content.setFinished(true);
        }
        xmlWriter.writeCloseTag();
      }

View Full Code Here

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

          if ((node.getNodeType() & LayoutNodeTypes.MASK_BOX) == LayoutNodeTypes.MASK_BOX)
          {
            // OK, limit the size of the box to the maximum line width and
            // revalidate it.
            final long contentPosition = elementPositions[contentIndex];
            final RenderBox box = (RenderBox) node;
            final long maxWidth = (getEndOfLine() - contentPosition);
            computeInlineBlock(box, contentPosition, maxWidth);

            elementDimensions[endIndex - 1] = node.getCachedWidth();
          }
        }
        setSkipIndex(endIndex);
      }
      return (start);
    }

    final long innerPagebreak = getPageBreak(getPageSegment());
    if (nextPosition > innerPagebreak)
    {
      // It is an inner pagebreak and the current element would not fit into the remaining space.
      // Move the element to the next page segment (but only if the start is not on
      setPosition(innerPagebreak);
      setPageSegment(getPageSegment() + 1);
    }


    // No, it is an ordinary advance ..
    // Check, whether we hit an item-sequence element
    if (contentElement instanceof InlineBoxSequenceElement == false)
    {
      for (int i = start; i < endIndex; i++)
      {
        final RenderNode node = nodes[i];
        final InlineSequenceElement element = sequenceElements[i];
        elementPositions[i] = getPosition();
        final long elementWidth = element.getMaximumWidth(node);
        elementDimensions[i] = elementWidth;
        addPosition(elementWidth);
      }
      return endIndex;
    }

    // Handle the ItemSequence element.

    // This is a bit more complicated. So we encountered an inline-block
    // element here. That means, the element will try to occuppy its
    // maximum-content-width.
//    Log.debug("Advance block at index " + contentIndex);
//    final long ceWidth = contentElement.getMinimumWidth();
//    final long extraSpace = contentElement.getMaximumWidth();
//    Log.debug("Advance block: Min " + ceWidth);
//    Log.debug("Advance block: Max " + extraSpace);

    final RenderNode contentNode = nodes[contentIndex];
    final long itemElementWidth = contentElement.getMaximumWidth(contentNode);

    if ((contentNode.getNodeType() & LayoutNodeTypes.MASK_BOX) == LayoutNodeTypes.MASK_BOX)
    {
      final RenderBox box = (RenderBox) contentNode;
      computeInlineBlock(box, getPosition(), itemElementWidth);
    }
    else
    {
      contentNode.setCachedX(getPosition());
View Full Code Here

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

   * @param box the box for which the block-context width should be computed.
   * @return the block context width.
   */
  public static long computeBlockContextWidth(final RenderNode box)
  {
    final RenderBox parentBlockContext = box.getParent();
    if (parentBlockContext == null)
    {
      // page cannot have borders ...
      final int type = box.getNodeType();
      if ((type & LayoutNodeTypes.MASK_BOX_PAGEAREA) == LayoutNodeTypes.MASK_BOX_PAGEAREA)
      {
        final PageAreaBox pageAreaBox = (PageAreaBox) box;
        final LogicalPageBox pageBox = pageAreaBox.getLogicalPage();
        if (pageBox == null)
        {
          return 0;
        }
        return pageBox.getPageWidth();
      }
      if ((type & LayoutNodeTypes.TYPE_BOX_LOGICALPAGE) == LayoutNodeTypes.TYPE_BOX_LOGICALPAGE)
      {
        final LogicalPageBox logicalPage = (LogicalPageBox) box;
        return logicalPage.getPageWidth();
      }
      return 0;
    }

    // A row or inline-box never establishes a context on its own; it always transfers the parent's block-render context.
    // The parent's computed width is used as block context ..
    return parentBlockContext.getStaticBoxLayoutProperties().getBlockContextWidth();
  }
View Full Code Here

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

        // removed the parent of a render node.
        throw new IllegalStateException
            ("Assertation error: A rollback-process encountered a render-node it should not have encountered.");
      }

      final RenderBox box = (RenderBox) child;
      if (box.isAppliedSeen() == false)
      {
        // must be a new box. Go away, evil new box ...
        final RenderNode next = child.getNext();
        parent.removeGenerated(box);
        parent.resetCacheState(deepDirty);
        child = next;
        continue;
      }

      if (box.isAppliedOpen() || box.getAppliedContentRefCount() > 0)
      {
        box.reopenAfterRollback(deepDirty);
        needDeepDive = true;
      }
      child = child.getNext();
    }
    return needDeepDive;
View Full Code Here

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

        {
          return;
        }
        ellipseDrawn = true;

        final RenderBox parent = node.getParent();
        if (parent != null)
        {
          final RenderBox textEllipseBox = parent.getTextEllipseBox();
          if (textEllipseBox != null)
          {
            processBoxChilds(textEllipseBox);
          }
        }
        return;
      }
    }

    if (isTextLineOverflow())
    {
      if (node.isNodeVisible(drawArea) == false)
      {
        return;
      }

      final long ellipseSize = extractEllipseSize(node);
      final long x1 = node.getX();
      final long x2 = x1 + node.getWidth();
      final long effectiveAreaX2 = (contentAreaX2 - ellipseSize);
      if (x2 <= effectiveAreaX2)
      {
        // the text will be fully visible.
        drawText((RenderableText) node);
      }
      else if (x1 >= contentAreaX2)
      {
        // Skip, the node will not be visible.
      }
      else
      {
        // The text node that is printed will overlap with the ellipse we need to print.
        drawText((RenderableText) node, effectiveAreaX2);
        final RenderBox parent = node.getParent();
        if (parent != null)
        {
          final RenderBox textEllipseBox = parent.getTextEllipseBox();
          if (textEllipseBox != null)
          {
            processBoxChilds(textEllipseBox);
          }
        }
View Full Code Here

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

  {
    if (node == null)
    {
      return 0;
    }
    final RenderBox parent = node.getParent();
    if (parent == null)
    {
      return 0;
    }
    final RenderBox textEllipseBox = parent.getTextEllipseBox();
    if (textEllipseBox == null)
    {
      return 0;
    }
    return textEllipseBox.getWidth();
  }
View Full Code Here

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

//      DebugLog.log("First child is active. Wont delete");
      return;
    }
    if ((first.getNodeType() & LayoutNodeTypes.MASK_BOX) == LayoutNodeTypes.MASK_BOX)
    {
      final RenderBox nextBox = (RenderBox) first;
      if (nextBox.isDeepFinished() == false)
      {
//        DebugLog.log("First child is not deep-finished. Wont delete");
        return;
      }
    }

    RenderNode last = first;
    while (true)
    {
      final RenderNode next = last.getNext();
      if (next == null)
      {
        break;
      }
      if ((next.getNodeType() & LayoutNodeTypes.MASK_BOX) == LayoutNodeTypes.MASK_BOX &&
          (next.getNodeType() & LayoutNodeTypes.MASK_BOX_INLINE) != LayoutNodeTypes.MASK_BOX_INLINE)
      {
        final RenderBox nextBox = (RenderBox) next;
        if (next.isFinished() == false && nextBox.isDeepFinished() == false)
        {
          break;
        }
      }
      if (next.isBreakAfter())
View Full Code Here

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

  protected void processParagraphChilds(final ParagraphRenderBox box)
  {
    this.contentAreaX1 = box.getContentAreaX1();
    this.contentAreaX2 = box.getContentAreaX2();

    RenderBox lineBox = (RenderBox) box.getFirstChild();
    while (lineBox != null)
    {
      processTextLine(lineBox, contentAreaX1, contentAreaX2);
      lineBox = (RenderBox) lineBox.getNext();
    }
  }
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.