Package org.jfree.layouting.renderer.model

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


    xmlWriter.writeComment("Marker-Box");
    xmlWriter.writeTag(Namespaces.XHTML_NAMESPACE,
        "span", attList, XmlWriter.OPEN);

    // the next child is a block-level child ..
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      // process that node as well. It should be a paragraph ..
      if (node instanceof ParagraphRenderBox)
      {
        processParagraphChilds((ParagraphRenderBox) node);
      }
      else if (node instanceof RenderBox)
      {
        processBoxChilds((RenderBox) node);
      }
      else
      {
        startProcessing(node);
      }

      final RenderNode next = node.getNext();
      if (next == null)
      {
        break;
      }
      if (next.isIgnorableForRendering() == false)
      {
        xmlWriter.writeTag(Namespaces.XHTML_NAMESPACE, "br", XmlWriter.CLOSE);
      }
      node = next;
    }
View Full Code Here


    return true;
  }

  protected void processParagraphChilds(final ParagraphRenderBox box)
  {
    RenderNode node = box.getFirstChild();
    while (node != null)
    {
      // A paragraph always has only its line-boxes as direct childs.
      processBoxChilds((RenderBox) node);
      final RenderNode next = node.getNext();
      if (next == null)
      {
        break;
      }
      try
View Full Code Here

      return new RenderNode[0];
    }
    final RenderNode[] reval = new RenderNode[val.length];
    for (int i = 0; i < val.length; i++)
    {
      final RenderNode node = val[i];
      reval[i] = node.derive(true);
    }
    return val;
  }
View Full Code Here

      BorderShapeFactory borderShapeFactory = new BorderShapeFactory(box);
      borderShapeFactory.generateBorder(g2);
    }


    RenderNode childs = box.getFirstChild();
    while (childs != null)
    {
      if (childs instanceof RenderBox)
      {
        drawBox(g2, (RenderBox) childs, level + 1);
      }
      else if (childs instanceof RenderableText)
      {
        drawText(g2, (RenderableText) childs);
      }
      else if (childs instanceof RenderableReplacedContent)
      {
        drawReplacedContent(g2, (RenderableReplacedContent) childs);
      }
      childs = childs.getNext();
    }
  }
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

    // Todo: Include orphan and widow stuff ..

    // First: Check the number of lines. (Should have been precomputed)
    // Second: Check whether and where the orphans- and widows-rules apply
    // Third: Shift the lines.
    RenderNode node = box.getVisibleFirst();
    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 instanceof ParagraphPoolBox == false)
      {
        throw new IllegalStateException("Encountered " + node.getClass());
      }
      final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
      if (startLine(inlineRenderBox))
      {
        processBoxChilds(inlineRenderBox);
      }
      finishLine(inlineRenderBox);

      node = node.getVisibleNext();
    }
  }
View Full Code Here

  }

  private void processTableSection(final TableRenderBox box,
                                   final CSSConstant role)
  {
    RenderNode rowGroupNode = box.getFirstChild();
    while (rowGroupNode != null)
    {
      if (rowGroupNode instanceof TableSectionRenderBox == false)
      {
        rowGroupNode = rowGroupNode.getNext();
        continue;
      }

      final TableSectionRenderBox sectionBox =
          (TableSectionRenderBox) rowGroupNode;
      if (role.equals
          (sectionBox.getDisplayRole()) == false)
      {
        // not a header ..
        rowGroupNode = rowGroupNode.getNext();
        continue;
      }

      startProcessing(rowGroupNode);
      rowGroupNode = rowGroupNode.getNext();
    }
  }
View Full Code Here

  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++)
      {
        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

    }
  }

  private long computeShift(final AlignContext child, final BoxAlignContext box)
  {
    final RenderNode node = child.getNode();
    final CSSValue baselineShift = node.getBaselineShift();

    if (baselineShift == null ||
        BaselineShift.BASELINE.equals(baselineShift))
    {
      return 0;
    }

    if (BaselineShift.SUB.equals(baselineShift))
    {
      // Not sure whether this is correct, but at least it looks better
      // than the other alternatives available ..
      return child.getBaselineDistance(ExtendedBaselineInfo.ALPHABETHIC) -
          child.getBaselineDistance(ExtendedBaselineInfo.MATHEMATICAL);
    }

    if (BaselineShift.SUPER.equals(baselineShift))
    {
      return box.getBaselineDistance(ExtendedBaselineInfo.MATHEMATICAL) -
          box.getBaselineDistance(ExtendedBaselineInfo.ALPHABETHIC);
    }

    final RenderLength baselineShiftResolved = node.getBaselineShiftResolved();
    if (baselineShiftResolved != null)
    {
      return baselineShiftResolved.resolve(lineHeight);
    }
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.