Package org.pentaho.reporting.engine.classic.core.layout.model

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


        if (node.getNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX)
        {
          throw new IllegalStateException("Expected ParagraphPoolBox elements.");
        }

        final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
        if (startLine(inlineRenderBox))
        {
          processBoxChilds(inlineRenderBox);
          finishLine(inlineRenderBox);
        }

        node = node.getNext();
      }
    }
    else
    {
      final ParagraphPoolBox node = box.getPool();
      // 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 (startLine(node))
      {
View Full Code Here


      // 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.getNodeType() & 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())
View Full Code Here

      // Already perfectly aligned.
      return;
    }

    RenderNode node = paragraph.getFirstChild();
    ParagraphPoolBox prev = null;
    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.getNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX)
      {
        throw new IllegalStateException("Encountered " + node.getClass());
      }

      final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
      // Process the current line.
      final long y = inlineRenderBox.getCachedY();
      final long height = inlineRenderBox.getCachedHeight();
      if (y + height <= paragraphBottom)
      {

        // Node will fit, so we can allow it ..
        prev = inlineRenderBox;
        node = node.getNext();
        continue;
      }

      // Encountered a paragraph that will not fully fit into the paragraph.
      // Merge it with the previous line-paragraph.
      final ParagraphPoolBox mergedLine = rebuildLastLine(prev, inlineRenderBox);

      // now remove all pending lineboxes (they should be empty anyway).
      while (node != null)
      {
        final RenderNode oldNode = node;
        node = node.getNext();
        paragraph.remove(oldNode);
      }

      if (mergedLine == null)
      {
        return;
      }

      final ElementAlignment textAlignment = paragraph.getLastLineAlignment();
      final LastLineTextAlignmentProcessor proc = create(textAlignment);

      // Now Build the sequence list that holds all nodes for the horizontal alignment computation.
      // The last line will get a special "last-line" horizontal alignment. This is quite usefull if
      // we are working with justified text and want the last line to be left-aligned.
      final SequenceList sequenceList = createHorizontalSequenceList(mergedLine);
      final long lineStart = paragraph.getContentAreaX1();
      final long lineEnd;

      if (overflowX)
      {
        lineEnd = Integer.MAX_VALUE;
      }
      else
      {
        lineEnd = paragraph.getContentAreaX2();
      }

      if (lineEnd - lineStart <= 0)
      {
        final long minimumChunkWidth = paragraph.getMinimumChunkWidth();
        proc.initialize(metaData, sequenceList, lineStart, lineStart + minimumChunkWidth, pageGrid, overflowX);
        RevalidateAllAxisLayoutStep.logger.warn("Revalidate: Auto-Corrected zero-width linebox.");
      }
      else
      {
        proc.initialize(metaData, sequenceList, lineStart, lineEnd, pageGrid, overflowX);
      }
      proc.performLastLineAlignment();
      proc.deinitialize();

      // Now Perform the vertical layout for the last line of the paragraph.
      final BoxAlignContext valignContext = createVerticalAlignContext(mergedLine);
      final StaticBoxLayoutProperties blp = mergedLine.getStaticBoxLayoutProperties();
      final BoxDefinition bdef = mergedLine.getBoxDefinition();
      final long insetTop = (blp.getBorderTop() + bdef.getPaddingTop());

      final long contentAreaY1 = mergedLine.getCachedY() + insetTop;
      final long lineHeight = mergedLine.getLineHeight();
      verticalAlignmentProcessor.align(valignContext, contentAreaY1, lineHeight);

      // And finally make sure that the paragraph box itself obeys to the defined vertical box alignment.
      performVerticalBlockAlignment(paragraph);
      return;
View Full Code Here

        if (paragraphContainer.getNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX)
        {
          throw new IllegalStateException("Expected ParagraphPoolBox elements.");
        }

        final ParagraphPoolBox paragraph = (ParagraphPoolBox) paragraphContainer;
        addGeneratedComplexTextLines(box, paragraph, layoutContext);

        paragraphContainer = paragraphContainer.getNext();
      }
    }
    else
    {
      final ParagraphPoolBox lineBoxContainer = (ParagraphPoolBox) box.getEffectiveLineboxContainer();
      final StyleSheet layoutContext = box.getStyleSheet();

      addGeneratedComplexTextLines(box, lineBoxContainer, layoutContext);
    }
  }
View Full Code Here

        if (node.getNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX)
        {
          throw new IllegalStateException("Expected ParagraphPoolBox elements.");
        }

        final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
        if (startLine(inlineRenderBox))
        {
          processBoxChilds(inlineRenderBox);
          finishLine(inlineRenderBox, breakState);
        }

        node = node.getNext();
      }
    }
    else
    {
      final ParagraphPoolBox node = box.getPool();

      if (node.getFirstChild() == null)
      {
        return;
      }

      // all childs of the linebox container must be inline boxes. They
View Full Code Here

      // 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())
View Full Code Here

      // Already perfectly aligned.
      return;
    }

    RenderNode node = paragraph.getFirstChild();
    ParagraphPoolBox prev = null;
    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
View Full Code Here

      return;
    }

    final boolean overflowX = paragraph.getStaticBoxLayoutProperties().isOverflowX();
    RenderNode node = paragraph.getFirstChild();
    ParagraphPoolBox prev = null;
    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.getNodeType() != LayoutNodeTypes.TYPE_BOX_LINEBOX)
      {
        throw new IllegalStateException("Encountered " + node.getClass());
      }

      final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
      // Process the current line.
      final long y = inlineRenderBox.getCachedY();
      final long height = inlineRenderBox.getCachedHeight();
      if (y + height <= paragraphBottom)
      {

        // Node will fit, so we can allow it ..
        prev = inlineRenderBox;
        node = node.getNext();
        continue;
      }

      // Encountered a line that will not fully fit into the paragraph.
      // Merge it with the previous line-paragraph.
      final ParagraphPoolBox mergedLine = rebuildLastLine(prev, inlineRenderBox);

      // now remove all pending lineboxes (they should be empty anyway).
      while (node != null)
      {
        final RenderNode oldNode = node;
        node = node.getNext();
        paragraph.remove(oldNode);
      }

      if (mergedLine == null)
      {
        return;
      }

      final ElementAlignment textAlignment = paragraph.getLastLineAlignment();
      final LastLineTextAlignmentProcessor proc = create(textAlignment);

      // Now Build the sequence list that holds all nodes for the horizontal alignment computation.
      // The last line will get a special "last-line" horizontal alignment. This is quite usefull if
      // we are working with justified text and want the last line to be left-aligned.
      final SequenceList sequenceList = createHorizontalSequenceList(mergedLine);
      final long lineStart = paragraph.getContentAreaX1();
      final long lineEnd;

      if (overflowX)
      {
        lineEnd = OVERFLOW_DUMMY_WIDTH;
      }
      else
      {
        lineEnd = paragraph.getContentAreaX2();
      }

      if (lineEnd - lineStart <= 0)
      {
        final long minimumChunkWidth = paragraph.getMinimumChunkWidth();
        proc.initialize(metaData, sequenceList, lineStart, lineStart + minimumChunkWidth, pageGrid, overflowX);
        logger.warn("Auto-Corrected zero-width linebox."); // NON-NLS
      }
      else
      {
        proc.initialize(metaData, sequenceList, lineStart, lineEnd, pageGrid, overflowX);
      }
      proc.performLastLineAlignment();
      proc.deinitialize();

      // Now Perform the vertical layout for the last line of the paragraph.
      final BoxAlignContext valignContext = createVerticalAlignContext(mergedLine);
      final StaticBoxLayoutProperties blp = mergedLine.getStaticBoxLayoutProperties();
      final BoxDefinition bdef = mergedLine.getBoxDefinition();
      final long insetTop = (blp.getBorderTop() + bdef.getPaddingTop());

      final long contentAreaY1 = mergedLine.getCachedY() + insetTop;
      final long lineHeight = mergedLine.getLineHeight();
      verticalAlignmentProcessor.align(valignContext, contentAreaY1, lineHeight);

      // And finally make sure that the paragraph box itself obeys to the defined vertical box alignment.
      performVerticalBlockAlignment(paragraph);
      return;
View Full Code Here

      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
        final ParagraphPoolBox inlineRenderBox = (ParagraphPoolBox) node;
        if (startLine(inlineRenderBox))
        {
          processBoxChilds(inlineRenderBox);
          finishLine(inlineRenderBox);
        }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.layout.model.ParagraphPoolBox

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.