Package org.odftoolkit.simple.common.field.Field

Examples of org.odftoolkit.simple.common.field.Field.FieldType


      VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_simple_variable");
      Assert.assertNotNull(simpleVariableField);
      TextSpanElement newTextSpanElement = doc.newParagraph("Update Simple Variable Field:").newTextSpanElement();
      simpleVariableField.updateField("simple variable content", newTextSpanElement);
     
      FieldType fieldType = simpleVariableField.getFieldType();
      Assert.assertNotNull(fieldType);
      Assert.assertEquals(FieldType.SIMPLE_VARIABLE_FIELD, fieldType);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
View Full Code Here


  public void testGetFieldType() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      SubjectField subjectField = Fields.createSubjectField(doc.newParagraph("The Subject:"));
     
      FieldType fieldType = subjectField.getFieldType();
      Assert.assertNotNull(subjectField);
      Assert.assertEquals(fieldType, FieldType.SUBJECT_FIELD);
    } catch (Exception e) {
      Logger.getLogger(SubjectFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
View Full Code Here

  public void testGetFieldType() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      TitleField titleField = Fields.createTitleField(doc.newParagraph("The Title:"));
      Assert.assertNotNull(titleField);
      FieldType fType = titleField.getFieldType();
      Assert.assertEquals(fType, FieldType.TITLE_FIELD);
    } catch (Exception e) {
      Logger.getLogger(TitleFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

      VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_simple_variable");
      Assert.assertNotNull(simpleVariableField);
      TextSpanElement newTextSpanElement = doc.newParagraph("Update Simple Variable Field:").newTextSpanElement();
      simpleVariableField.updateField("simple variable content", newTextSpanElement);
     
      FieldType fieldType = simpleVariableField.getFieldType();
      Assert.assertNotNull(fieldType);
      Assert.assertEquals(FieldType.SIMPLE_VARIABLE_FIELD, fieldType);
      newTextSpanElement = doc.newParagraph("Show Simple Variable Field:").newTextSpanElement();
      simpleVariableField.displayField(newTextSpanElement);
      simpleVariableField.updateField("aaaa", newTextSpanElement);
View Full Code Here

      Paragraph newParagraph = doc.addParagraph("Condition Field Test:");
      ConditionField conditionField = Fields.createConditionField(newParagraph.getOdfElement(), "test_con_variable == \"true\"",
          "trueText", "falseText");
      Assert.assertNotNull(conditionField);
     
      FieldType fieldType = conditionField.getFieldType();
      Assert.assertEquals(FieldType.CONDITION_FIELD, fieldType);

      // test hide field
      newParagraph = doc.addParagraph("Hide Text Field Test:");
      conditionField = Fields.createHiddenTextField(newParagraph.getOdfElement(), "test_con_variable == \"true\"", "hiddenText");
      FieldType fieldType1 = conditionField.getFieldType();
      Assert.assertEquals(FieldType.HIDDEN_TEXT_FIELD, fieldType1);
    } catch (Exception e) {
      Logger.getLogger(ConditionFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

  @Test
  public void testGetFieldType() {
    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(TEST_DOCUMENT));
      ChapterField chapterField = Fields.createChapterField(doc.newParagraph("Chapter:"));
      FieldType fieldType = chapterField.getFieldType();
      Assert.assertNotNull(fieldType);
      Assert.assertEquals(FieldType.CHAPTER_FIELD, fieldType);
    } catch (Exception e) {
      Logger.getLogger(ChapterFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
View Full Code Here

  public void testGetFieldType() {
    try {
      TextDocument doc = TextDocument.newTextDocument();
      PageNumberField numberField = Fields.createCurrentPageNumberField(doc.newParagraph("Current Page Number:"));
      Assert.assertNotNull(numberField);
      FieldType fieldType = numberField.getFieldType();
      Assert.assertNotNull(fieldType);
      Assert.assertEquals(fieldType, FieldType.CURRENT_PAGE_NUMBER_FIELD);
      numberField.setDisplayPage(DisplayType.PREVIOUS_PAGE);
      FieldType fieldType1 = numberField.getFieldType();
      Assert.assertEquals(fieldType1, FieldType.PREVIOUS_PAGE_NUMBER_FIELD);
      numberField.setDisplayPage(DisplayType.NEXT_PAGE);
      FieldType fieldType2 = numberField.getFieldType();
      Assert.assertEquals(fieldType2, FieldType.NEXT_PAGE_NUMBER_FIELD);
     
    } catch (Exception e) {
      Logger.getLogger(PageNumberFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
View Full Code Here

    OdfElement parentElement = getContainerElement();
    Paragraph orgparagraph = Paragraph.getInstanceof((TextParagraphElementBase) parentElement);
    TextDocument document = (TextDocument) orgparagraph.getOwnerDocument();
   
    FieldSelection nextFieldSelection=new FieldSelection(this);
    FieldType fieldType = orgField.getFieldType();
 
    switch (fieldType) {
    case DATE_FIELD:
      newfield=nextFieldSelection.replaceWithSimpleField(fieldType);
      break;
View Full Code Here

TOP

Related Classes of org.odftoolkit.simple.common.field.Field.FieldType

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.