Examples of OdfStylesDom


Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

      search = new TextNavigation("ReplaceDateTarget", doc);
      // count the initial date field count. should be 1.
      OdfContentDom contentDom = doc.getContentDom();
      NodeList nodeList = contentDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        //fieldSelection.replaceWithSimpleField(Field.FieldType.FIXED_DATE_FIELD);
        fieldSelection.replaceWithSimpleField(Field.FieldType.DATE_FIELD)// 1
        //fieldSelection.replaceWithSimpleField(Field.FieldType.TIME_FIELD);  //3
        i++;
      }
     
      nodeList = contentDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextDateElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
    } catch (Exception e) {
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

          Node nfix = nameMap.getNamedItem("text:fixed");
          nfix.setNodeValue("false");
        }
      }
     
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextTimeElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        //fieldSelection.replaceWithSimpleField(Field.FieldType.FIXED_DATE_FIELD);
        fieldSelection.replaceWithSimpleField(Field.FieldType.TIME_FIELD);
        i++;
      }
      nodeList = contentDom.getElementsByTagName(TextTimeElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextTimeElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

      search = new TextNavigation("ReplaceDateTarget", doc);
      // count the initial date field count. should be 1.
      OdfContentDom contentDom = doc.getContentDom();
      NodeList nodeList = contentDom.getElementsByTagName(TextTimeElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextTimeElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.FIXED_TIME_FIELD);
        i++;
      }
      nodeList = contentDom.getElementsByTagName(TextTimeElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextTimeElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
    } catch (Exception e) {
      Logger.getLogger(FieldSelectionTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

        nfix.setNodeValue("previous");
      }
     
      NodeList nodeList = contentDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.PREVIOUS_PAGE_NUMBER_FIELD);
        i++;
      }
      nodeList = contentDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
     
      //validate
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

        nfix.setNodeValue("current");
      }
     
      NodeList nodeList = contentDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.CURRENT_PAGE_NUMBER_FIELD);
        i++;
      }
     
      //value
      nodeList = contentDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

        nfix.setNodeValue("next");
      }
     
      NodeList nodeList = contentDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.NEXT_PAGE_NUMBER_FIELD);
        i++;
      }
     
      //validate
      nodeList = contentDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextPageNumberElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

      // count the initial date field count. should be 1.
      OdfContentDom contentDom = doc.getContentDom();
     
      NodeList nodeList = contentDom.getElementsByTagName(TextPageCountElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextPageCountElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.PAGE_COUNT_FIELD);
        i++;
      }
     
      //validate
      nodeList = contentDom.getElementsByTagName(TextPageCountElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextPageCountElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

      // count the initial date field count. should be 1.
      OdfContentDom contentDom = doc.getContentDom();
     
      NodeList nodeList = contentDom.getElementsByTagName(TextTitleElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextTitleElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.TITLE_FIELD);
        i++;
      }
     
      //validate
      nodeList = contentDom.getElementsByTagName(TextTitleElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextTitleElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

      // count the initial date field count. should be 1.
      OdfContentDom contentDom = doc.getContentDom();
     
      NodeList nodeList = contentDom.getElementsByTagName(TextSubjectElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextSubjectElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.SUBJECT_FIELD);
        i++;
      }
     
      //validate
      nodeList = contentDom.getElementsByTagName(TextSubjectElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextSubjectElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
View Full Code Here

Examples of org.odftoolkit.odfdom.dom.OdfStylesDom

      // count the initial date field count. should be 1.
      OdfContentDom contentDom = doc.getContentDom();
     
      NodeList nodeList = contentDom.getElementsByTagName(TextAuthorNameElement.ELEMENT_NAME.getQName());
      int i = nodeList.getLength();
      OdfStylesDom styleDom = doc.getStylesDom();
      nodeList = styleDom.getElementsByTagName(TextAuthorNameElement.ELEMENT_NAME.getQName());
      i += nodeList.getLength();
      // replace all the 3 "ReplaceDateTarget" to FixedDateField.
      while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        FieldSelection fieldSelection = new FieldSelection(item);
        fieldSelection.replaceWithSimpleField(Field.FieldType.AUTHOR_NAME_FIELD);
        i++;
      }
     
      //validate
      nodeList = contentDom.getElementsByTagName(TextAuthorNameElement.ELEMENT_NAME.getQName());
      int j = nodeList.getLength();
      nodeList = styleDom.getElementsByTagName(TextAuthorNameElement.ELEMENT_NAME.getQName());
      j += nodeList.getLength();
      Assert.assertEquals(j, i);
     
      //save
      doc.save(ResourceUtilities.newTestOutputFile(SAVE_FILE_REPLACE));
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.