Examples of RichTextSpec


Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

    RenderNode[] elementsByNodeType = MatchFactory.findElementsByNodeType(first, LayoutNodeTypes.TYPE_NODE_COMPLEX_TEXT);
    assertEquals(1, elementsByNodeType.length);
    assertTrue(elementsByNodeType[0] instanceof RenderableComplexText);

    RenderableComplexText text = (RenderableComplexText) elementsByNodeType[0];
    RichTextSpec richText = text.getRichText();
    assertEquals(4, richText.getStyleChunks().size());
    assertEquals("Label@LabelLabel", richText.getText());

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

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

  private void assertContainsImage(RenderNode[] elementsByNodeType)
  {
    for (RenderNode renderNode : elementsByNodeType)
    {
      RenderableComplexText t = (RenderableComplexText) renderNode;
      RichTextSpec richText = t.getRichText();
      for (RichTextSpec.StyledChunk styledChunk : richText.getStyleChunks())
      {
        if (styledChunk.getAttributes().containsKey(TextAttribute.CHAR_REPLACEMENT))
        {
          return;
        }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

  }

  @Test
  public void testSubString() throws Exception
  {
    RichTextSpec spec = createText();

    RichTextSpec substring = spec.substring(0, 15);
    Assert.assertEquals(spec, substring);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

  }

  @Test
  public void testSubStringStart() throws Exception
  {
    RichTextSpec spec = createText();

    RichTextSpec substring = spec.substring(0, 5);
    Assert.assertEquals(spec.getText().substring(0, 5), substring.getText());
    Assert.assertEquals(2, substring.getStyleChunks().size());
    Assert.assertEquals(spec.getStyleChunks().get(0), substring.getStyleChunks().get(0));
    RichTextSpec.StyledChunk actual = substring.getStyleChunks().get(1);
    Assert.assertEquals("de", actual.getText());
    Assert.assertEquals(3, actual.getStart());
    Assert.assertEquals(5, actual.getEnd());
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

  }

  @Test
  public void testSubStringEnd() throws Exception
  {
    RichTextSpec spec = createText();

    RichTextSpec substring = spec.substring(10, 15);
    Assert.assertEquals(spec.getText().substring(10, 15), substring.getText());
    Assert.assertEquals(2, substring.getStyleChunks().size());

    RichTextSpec.StyledChunk actual = substring.getStyleChunks().get(0);
    Assert.assertEquals("kl", actual.getText());
    Assert.assertEquals(0, actual.getStart());
    Assert.assertEquals(2, actual.getEnd());

    RichTextSpec.StyledChunk act2 = substring.getStyleChunks().get(1);
    Assert.assertEquals("MNO", act2.getText());
    Assert.assertEquals(2, act2.getStart());
    Assert.assertEquals(5, act2.getEnd());
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

  }

  @Test
  public void testSubStringMiddle() throws Exception
  {
    RichTextSpec spec = createText();

    RichTextSpec substring = spec.substring(10, 14);
    Assert.assertEquals(spec.getText().substring(10, 14), substring.getText());
    Assert.assertEquals(2, substring.getStyleChunks().size());

    RichTextSpec.StyledChunk actual = substring.getStyleChunks().get(0);
    Assert.assertEquals("kl", actual.getText());
    Assert.assertEquals(0, actual.getStart());
    Assert.assertEquals(2, actual.getEnd());

    RichTextSpec.StyledChunk act2 = substring.getStyleChunks().get(1);
    Assert.assertEquals("MN", act2.getText());
    Assert.assertEquals(2, act2.getStart());
    Assert.assertEquals(4, act2.getEnd());
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

  }

  @Test
  public void testSubStringMiddleAtBoundary() throws Exception
  {
    RichTextSpec spec = createText();

    RichTextSpec substring = spec.substring(3, 6);
    Assert.assertEquals(spec.getText().substring(3, 6), substring.getText());
    Assert.assertEquals(1, substring.getStyleChunks().size());

    RichTextSpec.StyledChunk act2 = substring.getStyleChunks().get(0);
    Assert.assertEquals("def", act2.getText());
    Assert.assertEquals(0, act2.getStart());
    Assert.assertEquals(3, act2.getEnd());
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

        new ReportAttributeMap<Object>(), ElementDefaultStyleSheet.getDefaultStyle(), new InstanceID(), "GHI"));
    chunks.add(new RichTextSpec.StyledChunk(9, 12, new SpacerRenderNode(), attrs,
        new ReportAttributeMap<Object>(), ElementDefaultStyleSheet.getDefaultStyle(), new InstanceID(), "jkl"));
    chunks.add(new RichTextSpec.StyledChunk(12, 15, new SpacerRenderNode(), attrs,
        new ReportAttributeMap<Object>(), ElementDefaultStyleSheet.getDefaultStyle(), new InstanceID(), "MNO"));
    return new RichTextSpec("ABCdefGHIjklMNO", TextDirection.LTR, chunks);
  }
View Full Code Here

Examples of org.pentaho.reporting.engine.classic.core.layout.process.text.RichTextSpec

  }

  private Phrase createPhrase(final RenderableComplexText node)
  {
    Phrase p = new Phrase();
    RichTextSpec text = node.getRichText();
    for (RichTextSpec.StyledChunk c : text.getStyleChunks())
    {
      TypedMapWrapper<Attribute, Object> attributes = new TypedMapWrapper<Attribute, Object>(c.getAttributes());
      final Number size = attributes.get(TextAttribute.SIZE, 10f, Number.class);
      final PdfTextSpec pdfTextSpec = computeFont(c);
      final int style = computeStyle(attributes, pdfTextSpec);
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.