Examples of RenderNode


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

    final PageDrawable pageDrawable = prc.getPageDrawable(2);
    assertNotNull(pageDrawable);
    final RenderNode[] renderNodes = pageDrawable.getNodesAt(1, 1, null, null);
    for (int i = 0; i < renderNodes.length; i++)
    {
      RenderNode renderNode = renderNodes[i];
      System.out.println(renderNode);
    }
  }
View Full Code Here

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

    {
    }

    public void reportMouseClicked(final ReportMouseEvent event)
    {
      final RenderNode renderNode = event.getSourceNode();
      final String target = extractLink(renderNode, event);
      if (target == null)
      {
        return;
      }

      final String window = (String) renderNode.getStyleSheet().getStyleProperty(ElementStyleKeys.HREF_WINDOW);
      final String title = (String) renderNode.getStyleSheet().getStyleProperty(ElementStyleKeys.HREF_TITLE);
      final ReportHyperlinkEvent hyEvent =
          new ReportHyperlinkEvent(PreviewPane.this, renderNode, target, window, title);
      fireReportHyperlinkEvent(hyEvent);
    }
View Full Code Here

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

      if (isHyperlinkSystemActive() == false)
      {
        return;
      }

      final RenderNode renderNode = event.getSourceNode();
      final String target = extractLink(renderNode, event);
      if (target == null)
      {
        if (mouseLinkActive)
        {
View Full Code Here

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

      updateParagraphChunkWidth(box);
      return;
    }

    long chunkWidth = 0;
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      final long minimumChunkWidth = node.getMinimumChunkWidth();
      if (chunkWidth < minimumChunkWidth)
      {
        chunkWidth = minimumChunkWidth;
      }
      node = node.getNext();
    }

    if ((box.getNodeType() & LayoutNodeTypes.MASK_BOX_INLINE) == LayoutNodeTypes.MASK_BOX_INLINE)
    {
      box.setMinimumChunkWidth(chunkWidth);
View Full Code Here

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

    {
      chunkBox = lineboxContainer;
    }

    long chunkWidth = 0;
    RenderNode node = chunkBox.getFirstChild();
    while (node != null)
    {
      final long minimumChunkWidth = node.getMinimumChunkWidth();
      if (chunkWidth < minimumChunkWidth)
      {
        chunkWidth = minimumChunkWidth;
      }
      node = node.getNext();
    }
    box.setMinimumChunkWidth(Math.max(chunkWidth, box.getComputedWidth()));
    if (box.getStyleSheet().getBooleanStyleProperty(ElementStyleKeys.USE_MIN_CHUNKWIDTH))
    {
      box.setComputedWidth(Math.max(box.getComputedWidth(), chunkWidth + box.getInsets()));
View Full Code Here

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

    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;
      }
    }
View Full Code Here

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

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

        // Content element: Perform a deep-deriveForAdvance, so that we preserve the
        // possibly existing sub-nodes.
        node.setCachedX(elementPositions[i]);
        node.setCachedWidth(elementDimensions[i]);
      }

      return;
    }
View Full Code Here

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

  public RenderNode next()
  {
    position = getStartOfLine();
    pageSegment = 0;

    final RenderNode retval = super.next();

    position = 0;
    pageSegment = 0;

    return retval;
View Full Code Here

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

    InlineSequenceElement contentElement = null;
    int contentIndex = start;
    for (int i = start; i < endIndex; i++)
    {
      final InlineSequenceElement element = sequenceElements[i];
      final RenderNode node = nodes[i];
      if (element instanceof StartSequenceElement ||
          element instanceof EndSequenceElement)
      {
        width += element.getMaximumWidth(node);
        continue;
      }

      width += element.getMaximumWidth(node);
      contentElement = element;
      contentIndex = i;
    }

    final long nextPosition = getPosition() + width;
    final long lastPageBreak = getPageBreak(getPagebreakCount() - 1);
    // Do we cross a page boundary?
    if (nextPosition > lastPageBreak)
    {
      // On outer break: Stop processing

      // Dont write through to the stored position; but prepare if
      // we have to fallback ..
      long position = getPosition();
      for (int i = start; i < endIndex; i++)
      {
        final InlineSequenceElement element = sequenceElements[i];
        final RenderNode node = nodes[i];
        elementPositions[i] = position;
        final long elementWidth = element.getMaximumWidth(node);
        elementDimensions[i] = elementWidth;
        position += elementWidth;
      }

      // we cross a pagebreak. Stop working on it - we bail out here.

      if (contentElement instanceof TextSequenceElement)
      {
        // the element may be splittable. Test, and if so, give a hint to the
        // outside world ..
        setSkipIndex(endIndex);
        setBreakableIndex(contentIndex);
        return (start);
      }

      // This is the first element and it still does not fit. How evil.
      if (start == 0)
      {
        if (contentElement instanceof InlineBoxSequenceElement)
        {
          final RenderNode node = nodes[contentIndex];
          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());
      contentNode.setCachedWidth(itemElementWidth);
    }

    final long preferredEndingPos = getPosition() + itemElementWidth;
    if (preferredEndingPos > getEndOfLine())
    {
      // We would eat the whole space up to the end of the line and more
      // So lets move that element to the next line instead...

      // But: We could easily end in an endless loop here. So check whether
      // the element is the first in the line
      if (start == 0)
      {
        // As it is guaranteed, that each chunk contains at least one item,
        // checking for start == 0 is safe enough ..
        return endIndex;
      }

      return start;
    }

    for (int i = start; i < contentIndex; i++)
    {
      final InlineSequenceElement element = sequenceElements[i];
      final RenderNode node = nodes[contentIndex];
      final long elementWidth = element.getMaximumWidth(node);
      elementPositions[i] = getPosition();
      elementDimensions[i] = elementWidth;
      addPosition(elementWidth);
    }

    elementPositions[contentIndex] = getPosition();
    elementDimensions[contentIndex] = itemElementWidth;
    setPosition(preferredEndingPos);

    for (int i = contentIndex + 1; i < endIndex; i++)
    {
      final InlineSequenceElement element = sequenceElements[i];
      final RenderNode node = nodes[contentIndex];
      final long elementWidth = element.getMaximumWidth(node);
      elementPositions[i] = getPosition();
      elementDimensions[i] = elementWidth;
      addPosition(elementWidth);
    }
View Full Code Here

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

        return false;
      }
      return true;
    }

    RenderNode child = element.getFirstChild();
    while (child != null)
    {
      final int type = child.getNodeType();
      if ((type & LayoutNodeTypes.MASK_BOX_INLINE) == LayoutNodeTypes.MASK_BOX_INLINE)
      {
        return true;
      }
      if (type == LayoutNodeTypes.TYPE_NODE_TEXT)
      {
        return true;
      }
      child = child.getNext();
    }
    return false;
  }
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.