Package org.jfree.layouting.renderer.model

Examples of org.jfree.layouting.renderer.model.RenderNode


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

    final RenderNode retval = super.next();

    position = 0;
    pageSegment = 0;

    return retval;
View Full Code Here


        // This is the first element and it still does not fit. How evil.
        if (start == 0)
        {
          if (contentElement instanceof InlineNodeSequenceElement)
          {
            final RenderNode node = contentElement.getNode();
            if (node instanceof RenderBox)
            {
              // OK, limit the size of the box to the maximum line width and
              // revalidate it.
              final RenderBox box = (RenderBox) node;
              final long maxWidth = (getEndOfLine() - getPosition());
              computeInlineBlock(box, getPosition(), maxWidth);

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

    }

    // No, it is an ordinary advance ..
    // Check, whether we hit an item-sequence element
    if (contentElement instanceof InlineNodeSequenceElement == false)
    {
      for (int i = start; i < endIndex; i++)
      {
        final InlineSequenceElement element = sequenceElements[i];
        elementPositions[i] = getPosition();
        final long elementWidth = element.getMaximumWidth();
        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 long itemElementWidth = contentElement.getMaximumWidth();

    final RenderNode node = contentElement.getNode();
    if (node instanceof RenderBox)
    {
      final RenderBox box = (RenderBox) node;
      computeInlineBlock(box, getPosition(), itemElementWidth);
    }
    else
    {
      node.setX(getPosition());
      node.setWidth(itemElementWidth);
    }

    final long preferredEndingPos = getPosition() + itemElementWidth;
    if (preferredEndingPos > getEndOfLine())
    {
View Full Code Here

    }

    // do something ..
    // for now, we ignore most of the stuff, and assume that orphans and
    // widows count for paragraphs and tables, and not for the ordinary stuff.
    final RenderNode firstNode = findNonFinishedVisibleFirst (box);
    if (firstNode instanceof RenderBox)
    {
      final RenderBox firstBox = (RenderBox) firstNode;
      box.setOrphansSize(firstBox.getOrphansSize());
    }
    else if (firstNode != null)
    {
      box.setOrphansSize(firstNode.getHeight());
    }

    final RenderNode lastNode = findNonFinishedVisibleLast(box);
    if (lastNode instanceof RenderBox)
    {
      final RenderBox lastBox = (RenderBox) lastNode;
      box.setWidowsSize(lastBox.getOrphansSize());
    }
    else if (lastNode != null)
    {
      box.setWidowsSize(lastNode.getHeight());
    }
  }
View Full Code Here

    }
  }

  private RenderNode findNonFinishedVisibleFirst (final RenderBox box)
  {
    RenderNode node = box.getVisibleFirst();
    while (node instanceof FinishedRenderNode)
    {
      node = node.getVisibleNext();
    }
    return node;
  }
View Full Code Here

    return node;
  }

  private RenderNode findNonFinishedVisibleLast (final RenderBox box)
  {
    RenderNode node = box.getVisibleLast();
    while (node instanceof FinishedRenderNode)
    {
      node = node.getVisiblePrev();
    }
    return node;
  }
View Full Code Here

    // A table row is different. It behaves as if it is a linebox.
    long orphanSize = 0;
    long widowSize = 0;
    int linecount = 0;

    RenderNode node = box.getVisibleFirst();
    while (node != null)
    {
      if (node instanceof RenderBox == false)
      {
        node = node.getVisibleNext();
        continue;
      }

      final RenderBox cellBox = (RenderBox) node;
      orphanSize = Math.max (cellBox.getOrphansSize(), orphanSize);
      widowSize = Math.max (cellBox.getWidowsSize(), widowSize);
      linecount = Math.max (cellBox.getLineCount(), linecount);
      node = node.getVisibleNext();
    }

    box.setOrphansSize(orphanSize);
    box.setWidowsSize(widowSize);
    box.setLineCount(linecount);
View Full Code Here

  private void finishTable(final TableRenderBox box)
  {
    // Tables are simple right now. Just grab whatever you get ..
    // ignore non-renderable stuff ..

    RenderNode node = box.getVisibleFirst();
    if (node instanceof RenderBox)
    {
      // This is not very valid now.
      final RenderBox firstBox = (RenderBox) node;
      box.setOrphansSize(firstBox.getOrphansSize());
View Full Code Here

  }

  private void finishParagraph(final ParagraphRenderBox box)
  {
    int lineCount = 0;
    RenderNode node = box.getVisibleFirst();
    while (node != null)
    {
      // Each node is a line.
      lineCount += 1;
      if (lineCount == box.getOrphans())
      {
        break;
      }
      node = node.getVisibleNext();
    }

    if (node == null)
    {
      box.setOrphansSize(box.getHeight());
    }
    else
    {
      final long nodeY2 = (node.getY() + node.getHeight());
      box.setOrphansSize(nodeY2 - box.getY());
    }

    lineCount = 0;
    node = box.getVisibleLast();
    while (node != null)
    {
      // Each node is a line.
      lineCount += 1;
      if (lineCount == box.getWidows())
      {
        break;
      }
      node = node.getVisiblePrev();
    }

    if (node == null)
    {
      box.setWidowsSize(box.getHeight());
    }
    else
    {
      final long nodeY2 = (node.getY() + node.getHeight());
      final long paragraphY2 = box.getY() + box.getHeight();
      box.setWidowsSize(paragraphY2 - nodeY2);
    }
  }
View Full Code Here

   * @param box
   * @return
   */
  protected boolean startBlockLevelBox(final RenderBox box)
  {
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      if (node.isIgnorableForRendering())
      {
        node = node.getNext();
      }
      if ((node.getY() + node.getHeight()) <= contentStart)
      {
        final RenderNode next = node.getNext();
        box.remove(node);
        node = next;
      }
      else if (node.getY() >= contentEnd)
      {
        final RenderNode next = node.getNext();
        box.remove(node);
        node = next;
      }
      else
      {
View Full Code Here

      return;
    }
    if (breakState.getSuspendItem() != null ||
        node instanceof RenderableText == false)
    {
      final RenderNode child = node.deriveFrozen(false);
      breakState.getInsertationPoint().addGeneratedChild(child);
      return;
    }

    final RenderableText text = (RenderableText) node;
    final RenderNode child = text.deriveFrozen(false);
    breakState.getInsertationPoint().addGeneratedChild(child);

    if (text.isForceLinebreak() == false)
    {
      return;
View Full Code Here

TOP

Related Classes of org.jfree.layouting.renderer.model.RenderNode

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.