Examples of TextNavigation


Examples of org.odftoolkit.odfdom.incubator.search.TextNavigation

  }

  @Test
  public void testGetInstance() {
    //get the text content contains "cell"
    TextNavigation search = new TextNavigation("cell", odtdoc);
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.getCurrentItem();
      OdfElement containerEle = item.getContainerElement();
      if (containerEle instanceof OdfTextParagraph) {
        Node ele = containerEle.getParentNode();
        if (ele instanceof TableTableCellElement) {
          OdfTableCell cell = OdfTableCell.getInstance((TableTableCellElementBase) ele);
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

  @Test
  public void testSpan() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is a test paragraph!");
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
      TextHyperlink link = span.applyHyperlink(new URI("http://www.ibm.com"));
      DefaultStyleHandler handler = span.getStyleHandler();
      Font font1Base = new Font("Arial", FontStyle.ITALIC, 10, Color.BLACK, TextLinePosition.THROUGH);
      handler.getTextPropertiesForWrite().setFont(font1Base);
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

        doc.removeParagraph(pp);
      }
     
      doc.addParagraph("This is a test paragraph!");
     
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
     
      span.removeTextContent();
      boolean flag = false;
      Iterator<Paragraph> parai = doc.getParagraphIterator();
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

  public void testAppendTextContent() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is a test paragraph!");
     
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
     
      span.appendTextContent("hello world.");
      Assert.assertEquals("testhello world.", span.getTextContent());
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

  public void testAppendTextContentPara() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is a test paragraph!");
     
      TextNavigation navigation = new TextNavigation("test", doc);
      TextSelection sel = (TextSelection) navigation.nextSelection();
      Span span = Span.newSpan(sel);
     
      span.appendTextContent("hello world.", true);
      Assert.assertEquals("testhello world.", span.getTextContent());
     
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

  }

  @Test
  public void testGetInstance() {
    //get the text content contains "cell"
    TextNavigation search = new TextNavigation("cell", odtdoc);
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      OdfElement containerEle = item.getContainerElement();
      if (containerEle instanceof OdfTextParagraph) {
        Node ele = containerEle.getParentNode();
        if (ele instanceof TableTableCellElement) {
          Cell cell = Cell.getInstance((TableTableCellElementBase) ele);
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

  }

  @Test
  public void testHasNext() {
    search = null;
    search = new TextNavigation("range", doc);

    Assert.assertTrue(search.hasNext());
    Assert.assertTrue(search.hasNext());
    Assert.assertTrue(search.hasNext());
    Assert.assertTrue(search.hasNext());
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

   * 'change' word in the front of all the 'delete' word
   */
  @Test
  public void testPasteAtFrontOf() {
    search = null;
    search = new TextNavigation("delete", doc);
    TextSelection sel = null;

    TextNavigation search1 = new TextNavigation("change", doc);
    sel = (TextSelection) search1.nextSelection();

    int i = 0;
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      i++;
      try {
        sel.pasteAtFrontOf(item);
      } catch (InvalidNavigationException e) {
        Assert.fail(e.getMessage());
      }
    }

    int j = 0;
    search = new TextNavigation("changedelete", doc);
    while (search.hasNext()) {
      search.nextSelection();
      j++;
    }
    Assert.assertTrue(i == j);
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

   * 'change' word at the end of all the 'delete' word
   */
  @Test
  public void testPasteAtEndOf() {
    search = null;
    search = new TextNavigation("delete", doc);
    TextSelection sel = null;

    TextNavigation search1 = new TextNavigation("change", doc);
    sel = (TextSelection) search1.nextSelection();

    int i = 0;
    while (search.hasNext()) {
      TextSelection item = (TextSelection) search.nextSelection();
      i++;
      try {
        sel.pasteAtEndOf(item);
      } catch (InvalidNavigationException e) {
        Assert.fail(e.getMessage());
      }
    }
    int j = 0;
    search = new TextNavigation("deletechange", doc);
    while (search.hasNext()) {
      search.nextSelection();
      j++;
    }
    Assert.assertTrue(i == j);
View Full Code Here

Examples of org.odftoolkit.simple.common.navigation.TextNavigation

   * style
   */
  @Test
  public void testApplyStyle() {
    search = null;
    search = new TextNavigation("delete", doc);
    OdfOfficeAutomaticStyles autoStyles = null;
    try {
      autoStyles = doc.getContentDom().getAutomaticStyles();
    } catch (Exception e1) {
      Assert.fail("Failed with " + e1.getClass().getName() + ": '" + e1.getMessage() + "'");
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.