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

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


  }

  public void testSequenceBuildingSingle2()
  {
    final SequenceList list = new DefaultSequenceList();
    list.add(new TestInlineSequenceElement(InlineSequenceElement.Classification.START), new SpacerRenderNode());
    list.add(new TestInlineSequenceElement(InlineSequenceElement.Classification.CONTENT), new DummyRenderNode());
    list.add(new TestInlineSequenceElement(InlineSequenceElement.Classification.END), new SpacerRenderNode());

    final ChunkIterator it = new ChunkIterator(list, 0);
    assertNext(it, 0, 3, 30);
    assertFalse(it.hasNext());
  }
View Full Code Here


              if (needToAddSpacing)
              {
                if (spaceWidth > 0)
                {
                  // docmark: Used zero as new height
                  final SpacerRenderNode spacer = new SpacerRenderNode(spaceWidth, 0, false, 1);
                  spacer.setVirtualNode(true);
                  writeContext.addGeneratedChild(spacer);
                }
                needToAddSpacing = false;
              }
              final RenderBox newWriter = (RenderBox) nBox.derive(false);
              newWriter.setVirtualNode(true);
              writeContext.addGeneratedChild(newWriter);
              context = new MergeContext(newWriter, nBox);
            }
          }
          else
          {
            if (needToAddSpacing)
            {
              if (spaceWidth > 0)
              {
                // docmark: Used zero as new height
                final SpacerRenderNode spacer = new SpacerRenderNode(spaceWidth, 0, false, 1);
                spacer.setVirtualNode(true);
                writeContext.addGeneratedChild(spacer);
              }
              needToAddSpacing = false;
            }

            final RenderBox newWriter = (RenderBox) nBox.derive(false);
            newWriter.setVirtualNode(true);
            writeContext.addGeneratedChild(newWriter);
            context = new MergeContext(newWriter, nBox);
          }
        }
        else
        {
          if (needToAddSpacing)
          {
            if (spaceWidth > 0)
            {
              // docmark: Used zero as new height
              final SpacerRenderNode spacer = new SpacerRenderNode(spaceWidth, 0, false, 1);
              spacer.setVirtualNode(true);
              writeContext.addGeneratedChild(spacer);
            }
            needToAddSpacing = false;
          }

          final RenderNode box = nBox.derive(true);
          box.setVirtualNode(true);
          writeContext.addGeneratedChild(box);
          next = nBox.getNext();
        }
      }
      else
      {
        if (needToAddSpacing)
        {
          final RenderNode lastChild = writeContext.getLastChild();
          if (spaceWidth > 0 && lastChild != null &&
              (lastChild.getNodeType() != LayoutNodeTypes.TYPE_NODE_SPACER))
          {
            // docmark: Used zero as new height
            final SpacerRenderNode spacer = new SpacerRenderNode(spaceWidth, 0, false, 1);
            spacer.setVirtualNode(true);
            writeContext.addGeneratedChild(spacer);
          }
          needToAddSpacing = false;
        }
View Full Code Here

        RenderableText text = (RenderableText) lineChild;
        b.append(text.getRawText());
      }
      else if (lineChild instanceof SpacerRenderNode)
      {
        SpacerRenderNode spacer = (SpacerRenderNode) lineChild;
        for (int i = 0; i < spacer.getSpaceCount(); i+= 1)
        b.append(' ');
      }
      else if (lineChild instanceof RenderBox)
      {
        b.append(computePrintedText((RenderBox) lineChild));
View Full Code Here

        manualBreak = true;
      }
    }
    else if (nodeType == LayoutNodeTypes.TYPE_NODE_SPACER)
    {
      final SpacerRenderNode spacer = (SpacerRenderNode) node;
      final int count = Math.max(1, spacer.getSpaceCount());
      for (int i = 0; i < count; i++)
      {
        this.text.append(' ');
      }
    }
View Full Code Here

  public void testSimpleCase()
  {
    final DefaultSequenceList list = new DefaultSequenceList();
    list.add(StartSequenceElement.INSTANCE, new InlineRenderBox());
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode());
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(EndSequenceElement.INSTANCE, new InlineRenderBox());

    final LeftAlignmentProcessor p = new LeftAlignmentProcessor();
    p.initialize(outputProcessorMetaData, list,
View Full Code Here

  public void testComplexCase2()
  {
    final DefaultSequenceList list = new DefaultSequenceList();
    list.add(StartSequenceElement.INSTANCE, new InlineRenderBox());
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(EndSequenceElement.INSTANCE, new InlineRenderBox());

    final LeftAlignmentProcessor p = new LeftAlignmentProcessor();
View Full Code Here

  public void testComplexCase()
  {
    final DefaultSequenceList list = new DefaultSequenceList();
    list.add(StartSequenceElement.INSTANCE, new InlineRenderBox());
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(SpacerSequenceElement.INSTANCE, new SpacerRenderNode
        (StrictGeomUtility.toInternalValue(10), StrictGeomUtility.toInternalValue(10), false, 1));
    list.add(TextSequenceElement.INSTANCE, createText("Test"));
    list.add(EndSequenceElement.INSTANCE, new InlineRenderBox());

    final LeftAlignmentProcessor p = new LeftAlignmentProcessor();
View Full Code Here

        return;
      }

      if (nodeType == LayoutNodeTypes.TYPE_NODE_SPACER)
      {
        final SpacerRenderNode spacer = (SpacerRenderNode) node;
        final int count = Math.max(1, spacer.getSpaceCount());
        for (int i = 0; i < count; i++)
        {
          xmlWriter.writeText(" ");
        }
      }
View Full Code Here

    {
      // This is a forced linebreak, caused by a \n somewhere at the beginning of the text or after a whitespace.
      // If there is a preservable whitespace, the leading margin will be non-zero.
      if (leadingMargin > 0)
      {
        final SpacerRenderNode spacer = new SpacerRenderNode(RenderableText.convert(leadingMargin), 0, true, spaceCount);
        words.add(spacer);
      }
      if (forceLinebreak)
      {
        final ExtendedBaselineInfo info = getBaselineInfo('\n');
///        TextUtility.createBaselineInfo('\n', fontMetrics, baselineInfo);
        final RenderableText text = new RenderableText(layoutContext, elementType, instanceId, attributeMap,
            info, DefaultRenderableTextFactory.EMPTY_GLYPHS, 0, 0, lastLanguage, true);
        words.add(text);
      }
      leadingMargin = 0;
      spaceCount = 0;
      return;
    }

    //final DefaultGlyph[] glyphs = (DefaultGlyph[]) glyphList.toArray(new DefaultGlyph[glyphList.size()]);
    if (leadingMargin > 0)// && words.isEmpty() == false)
    {
      final SpacerRenderNode spacer = new SpacerRenderNode(RenderableText.convert(leadingMargin), 0, true, spaceCount);
      words.add(spacer);
    }

    // Compute a suitable text-metrics object for this text. We simply assume that the first character is representive
    // for all characters of the text chunk. This may be a wrong assumption in complex-text environments but will work
View Full Code Here

TOP

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

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.