Examples of ParagraphRenderBox


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

    LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage(report, 0);

    RenderNode second = MatchFactory.findElementByName(logicalPageBox, "second");
    assertTrue(second instanceof ParagraphRenderBox);
    ParagraphRenderBox p = (ParagraphRenderBox) second;
    assertTrue(p.getPool().getFirstChild().getNext() instanceof RenderableReplacedContentBox);

    ParagraphLineBreakStep step = new ParagraphLineBreakStep();
    step.compute(logicalPageBox);

    RenderNode[] elementsByNodeType = MatchFactory.findElementsByNodeType(p, LayoutNodeTypes.TYPE_NODE_COMPLEX_TEXT);
View Full Code Here

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

      RenderBox parent = node.getParent().getParent();
      if (parent instanceof SectionRenderBox == false)
      {
        return false;
      }
      ParagraphRenderBox para = (ParagraphRenderBox) node;
      Object attribute = para.getAttributes().getAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE);
      if (ObjectUtilities.equal(text, attribute))
      {
        return true;
      }
      return false;
View Full Code Here

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

    report.getReportConfiguration().setConfigProperty(ClassicEngineCoreModule.COMPLEX_TEXT_CONFIG_OVERRIDE_KEY, "true");
    report.getStyle().setStyleProperty(TextStyleKeys.WORDBREAK, true);

    LogicalPageBox logicalPageBox = DebugReportRunner.layoutSingleBand(report, report.getReportHeader(), false, false);

    ParagraphRenderBox outerBox = (ParagraphRenderBox) MatchFactory.findElementByName(logicalPageBox, "outer-box");
    assertNotNull(outerBox);
    assertEquals(0, outerBox.getY());
    assertTrue(outerBox.getHeight() > StrictGeomUtility.toInternalValue(14));
    assertTrue(outerBox.isComplexParagraph());

    BlockRenderBox pool = (BlockRenderBox) outerBox.getLineboxContainer();
    assertTrue(pool.getFirstChild() != pool.getLastChild());
    assertTrue(pool.getFirstChild().getNext() == pool.getLastChild());
    assertStructure((RenderBox) pool.getFirstChild());
    assertStructure((RenderBox) pool.getLastChild());
View Full Code Here

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

    {
      final BlockRenderBox footerArea = logicalPage.getFooterArea();
      final RenderNode p1 = getElementByName(footerArea, "P2");
      assertNotNull(p1);
      assertTrue(p1 instanceof ParagraphRenderBox);
      final ParagraphRenderBox p = (ParagraphRenderBox) p1;
      final RenderNode firstChild = p.getPool().getFirstChild();
      if (complexText)
      {
        assertTrue(firstChild instanceof RenderableComplexText);
        final RenderableComplexText text = (RenderableComplexText) firstChild;
        final int val = Integer.parseInt(text.getRawText());
View Full Code Here

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

    final MinorAxisNodeContext nodeContext = getNodeContext();
    final PageGrid pageGrid = getPageGrid();
    final OutputProcessorMetaData metaData = getMetaData();
    breakState.add(EndSequenceElement.INSTANCE, inlineRenderBox);

    final ParagraphRenderBox paragraph = breakState.getParagraph();

    final ElementAlignment textAlignment = paragraph.getTextAlignment();
    final long textIndent = paragraph.getTextIndent();
    final long firstLineIndent = paragraph.getFirstLineIndent();
    // This aligns all direct childs. Once that is finished, we have to
    // check, whether possibly existing inner-paragraphs are still valid
    // or whether moving them violated any of the inner-pagebreak constraints.
    final TextAlignmentProcessor processor = create(textAlignment);

    final SequenceList sequence = breakState.getSequence();

    final long lineEnd;
    final boolean overflowX = paragraph.getStaticBoxLayoutProperties().isOverflowX();
    if (overflowX)
    {
      lineEnd = nodeContext.getX1() + AbstractMinorAxisLayoutStep.OVERFLOW_DUMMY_WIDTH;
    }
    else
    {
      lineEnd = nodeContext.getX2();
    }

    long lineStart = Math.min(lineEnd, nodeContext.getX1() + firstLineIndent);
    if (lineEnd - lineStart <= 0)
    {
      final long minimumChunkWidth = paragraph.getPool().getMinimumChunkWidth();
      processor.initialize(metaData, sequence, lineStart, lineStart + minimumChunkWidth, pageGrid, overflowX);
      nodeContext.updateX2(lineStart + minimumChunkWidth);
      logger.warn("Auto-Corrected zero-width first-line on paragraph - " + paragraph.getName());
    }
    else
    {
      processor.initialize(metaData, sequence, lineStart, lineEnd, pageGrid, overflowX);
      if (overflowX == false)
      {
        nodeContext.updateX2(lineEnd);
      }
    }

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

      paragraph.addGeneratedChild(linebox);

      if (processor.hasNext())
      {
        lineStart = Math.min(lineEnd, nodeContext.getX1() + textIndent);

        if (lineEnd - lineStart <= 0)
        {
          final long minimumChunkWidth = paragraph.getPool().getMinimumChunkWidth();
          processor.updateLineSize(lineStart, lineStart + minimumChunkWidth);
          nodeContext.updateX2(lineStart + minimumChunkWidth);
          logger.warn("Auto-Corrected zero-width text-line on paragraph continuation - " + paragraph.getName());
        }
        else
        {
          processor.updateLineSize(lineStart, lineEnd);
          if (overflowX == false)
View Full Code Here

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

      }
      else if ((nodeType & LayoutNodeTypes.MASK_BOX_BLOCK) == LayoutNodeTypes.MASK_BOX_BLOCK)
      {
        if (nodeType == LayoutNodeTypes.TYPE_BOX_PARAGRAPH)
        {
          final ParagraphRenderBox box = (ParagraphRenderBox) node;
          if (startBlockBox(box))
          {
            processParagraphChilds(box);
          }
          finishBlockBox(box);
        }
        else if (nodeType == LayoutNodeTypes.TYPE_BOX_LOGICALPAGE)
        {
          final LogicalPageBox box = (LogicalPageBox) node;
          if (startBlockBox(box))
          {
            startProcessing(box.getWatermarkArea());
            startProcessing(box.getHeaderArea());
            processBoxChilds(box);
            startProcessing(box.getRepeatFooterArea());
            startProcessing(box.getFooterArea());
          }
          finishBlockBox(box);
        }
        else
        {
View Full Code Here

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

  protected boolean startBlockBox(final BlockRenderBox box)
  {
    if (box.getNodeType() == LayoutNodeTypes.TYPE_BOX_PARAGRAPH)
    {
      final ParagraphRenderBox paragraphBox = (ParagraphRenderBox) box;
      final long poolChangeTracker = paragraphBox.getPool().getChangeTracker();
      final boolean unchanged = poolChangeTracker == paragraphBox.getLineBoxAge();

      if (unchanged || paragraphBox.getPool().getFirstChild() == null)
      {
        // If the paragraph is unchanged (no new elements have been added to the pool) then we can take a
        // shortcut. The childs of this paragraph will also be unchanged (as any structural change would have increased
        // the change-tracker).
        //
        // We treat an empty paragraph (pool has no childs) as unchanged at any time.
        paragraphNesting.push(ParagraphLineBreakStep.LEAF_BREAK_STATE);
        breakState = ParagraphLineBreakStep.LEAF_BREAK_STATE;
        return false;
      }

      // When the paragraph has changed, this can only be caused by someone adding a new node to the paragraph
      // or to one of the childs.

      // Paragraphs can be nested whenever a Inline-Level element declares to be a Block-Layouter. (This is an
      // Inline-Block or Inline-Table case in CSS)

      // It is guaranteed, that if a child is changed, the parent is marked as changed as well.
      // So we have only two cases to deal with: (1) The child is unchanged (2) the child is changed.

      if (breakState == null)
      {
        final ParagraphPoolBox paragraphPoolBox = paragraphBox.getPool();
        final RenderNode firstChild = paragraphPoolBox.getFirstChild();
        if (firstChild == null)
        {
          paragraphBox.setPoolSize(0);
          paragraphBox.setLineBoxAge(paragraphPoolBox.getChangeTracker());
          breakState = ParagraphLineBreakStep.LEAF_BREAK_STATE;
          return false;
        }
        if (firstChild == paragraphPoolBox.getLastChild())
        {
          if ((firstChild.getLayoutNodeType() & LayoutNodeTypes.MASK_BOX) != LayoutNodeTypes.MASK_BOX)
          {
            // Optimize away: A single text-element or other content in a linebox. No need to dive deeper.
            paragraphBox.setPoolSize(1);
            paragraphBox.setLineBoxAge(paragraphPoolBox.getChangeTracker());
            breakState = ParagraphLineBreakStep.LEAF_BREAK_STATE;
            return false;
          }
        }
        if (paragraphBox.isComplexParagraph())
        {
          final ParagraphLinebreaker item = new FullLinebreaker(paragraphBox);
          paragraphNesting.push(item);
          breakState = item;
        }
View Full Code Here

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

  private RenderNode extractOriginalPool(RenderNode n)
  {
    if (n instanceof ParagraphRenderBox)
    {
      ParagraphRenderBox para = (ParagraphRenderBox) n;
      return para.getPool();
    }
    if (n.getParent() == null)
    {
      Assert.fail();
      return null;
View Full Code Here

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

    }

    final int layoutNodeType = box.getLayoutNodeType();
    if (layoutNodeType == LayoutNodeTypes.TYPE_BOX_PARAGRAPH)
    {
      final ParagraphRenderBox paragraphBox = (ParagraphRenderBox) box;
      // We cant cache that ... the shift operations later would misbehave
      // One way around would be to at least store the layouted offsets
      // (which should be immutable as long as the line did not change its
      // contents) and to reapply them on each run. This is cheaper than
      // having to compute the whole v-align for the whole line.
View Full Code Here

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

    if (breakState.isActive() == false)
    {
      final int nodeType = box.getNodeType();
      if (nodeType == LayoutNodeTypes.TYPE_BOX_PARAGRAPH)
      {
        final ParagraphRenderBox paragraphBox = (ParagraphRenderBox) box;
        // We cant cache that ... the shift operations later would misbehave
        // One way around would be to at least store the layouted offsets
        // (which should be immutable as long as the line did not change its
        // contents) and to reapply them on each run. This is cheaper than
        // having to compute the whole v-align for the whole line.
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.