Package org.pentaho.reporting.engine.classic.core.layout.process.alignment

Examples of org.pentaho.reporting.engine.classic.core.layout.process.alignment.TextAlignmentProcessor


    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 x2;
    final boolean overflowX = paragraph.getStaticBoxLayoutProperties().isOverflowX();
    if (overflowX)
    {
      x2 = Integer.MAX_VALUE;
    }
    else
    {
      x2 = paragraph.getContentAreaX2();
    }
    final long x1 = paragraph.getContentAreaX1();
    final long lineStart = Math.min(x2, x1 + firstLineIndent);
    final long lineEnd = x2;
    if (lineEnd - lineStart <= 0)
    {
      final long minimumChunkWidth = paragraph.getPool().getMinimumChunkWidth();
      processor.initialize(metaData, sequence, lineStart, lineStart + minimumChunkWidth, pageGrid, overflowX);
      InfiniteMinorAxisLayoutStep.logger.warn("Auto-Corrected zero-width first-line on paragraph " + paragraph.getName());
    }
    else
    {
      processor.initialize(metaData, sequence, lineStart, lineEnd, pageGrid, overflowX);
    }

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

      paragraph.addGeneratedChild(linebox);

      if (processor.hasNext())
      {
        final long innerLineStart = Math.min(x2, x1 + textIndent);
        final long innerLineEnd = x2;
        if (innerLineEnd - innerLineStart <= 0)
        {
          final long minimumChunkWidth = paragraph.getPool().getMinimumChunkWidth();
          processor.updateLineSize(innerLineStart, innerLineStart + minimumChunkWidth);
          InfiniteMinorAxisLayoutStep.logger.warn("Auto-Corrected zero-width text-line on paragraph " + paragraph.getName());
        }
        else
        {
          processor.updateLineSize(innerLineStart, innerLineEnd);
        }
      }
    }

    processor.deinitialize();
  }
View Full Code Here


    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)
          {
            nodeContext.updateX2(lineEnd);
          }
        }

      }
    }

    processor.deinitialize();
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.layout.process.alignment.TextAlignmentProcessor

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.