Package org.odftoolkit.odfdom.dom.element.text

Examples of org.odftoolkit.odfdom.dom.element.text.TextConditionalTextElement


      Paragraph newParagraph = doc.addParagraph("Condition Field Test:");
      ConditionField conditionField = Fields.createConditionField(newParagraph.getOdfElement(), "test_con_variable == \"true\"",
          "trueText", "falseText");
      Assert.assertNotNull(conditionField);
      conditionField.updateCondition("test_con_variable == \"false\"");
      TextConditionalTextElement textCondEle = (TextConditionalTextElement) conditionField.getOdfElement();
      Assert.assertEquals("ooow:test_con_variable == \"false\"", textCondEle.getTextConditionAttribute());
      //save
      //doc.save(ResourceUtilities.getAbsolutePath(TEST_DOCUMENT));
    } catch (Exception e) {
      Logger.getLogger(ConditionFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
View Full Code Here


          "trueText", "falseText");
      Assert.assertNotNull(conditionField);
      conditionField.updateTrueText("trueTextUpdate");
     
      //validate
      TextConditionalTextElement conditionalTextElement = (TextConditionalTextElement) conditionField.getOdfElement();
      conditionalTextElement.getTextStringValueIfTrueAttribute();
      Assert.assertEquals("trueTextUpdate", conditionalTextElement.getTextStringValueIfTrueAttribute());
     
      //save
      //doc.save(ResourceUtilities.getAbsolutePath(TEST_DOCUMENT));
    } catch (Exception e) {
      Logger.getLogger(ConditionFieldTest.class.getName()).log(Level.SEVERE, null, e);
View Full Code Here

     
      conditionField.updateCondition("test_con_variable == \"false\"");
      conditionField.updateFalseText("falseTextUpdate");

      //validate
      TextConditionalTextElement conditionalTextElement = (TextConditionalTextElement) conditionField.getOdfElement();
      conditionalTextElement.getTextStringValueIfFalseAttribute();
      Assert.assertEquals("falseTextUpdate", conditionalTextElement.getTextStringValueIfFalseAttribute());
    } catch (Exception e) {
      Logger.getLogger(ConditionFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

      ConditionField conditionField = Fields.createConditionField(newParagraph.getOdfElement(), "test_con_variable == \"true\"",
          "trueText", "falseText");
      Assert.assertNotNull(conditionField);

      // validate
      TextConditionalTextElement conditionalTextElement = (TextConditionalTextElement) conditionField.getOdfElement();
      conditionalTextElement.getTextStringValueIfFalseAttribute();
      Assert.assertEquals("falseText", conditionalTextElement.getTextStringValueIfFalseAttribute());
     
    } catch (Exception e) {
      Logger.getLogger(ConditionFieldTest.class.getName()).log(Level.SEVERE, null, e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

      nextFieldSelection.replaceWithVariableField(variableField);
      newfield=variableField;
      break;
    case CONDITION_FIELD:
      ConditionField conditionField = (ConditionField)orgField;
      TextConditionalTextElement textConditionalTextElement =(TextConditionalTextElement) conditionField.getOdfElement();
      String StringValueIfFalse=textConditionalTextElement.getTextStringValueIfFalseAttribute();
      String StringValueIfTrue=textConditionalTextElement.getTextStringValueIfTrueAttribute();
      String StringCondition=textConditionalTextElement.getTextConditionAttribute();
      boolean CurrentValue=textConditionalTextElement.getTextCurrentValueAttribute();
      ConditionField newdConditionField = nextFieldSelection.replaceWithConditionField(StringCondition, StringValueIfTrue, StringValueIfFalse);
      TextConditionalTextElement newTextConditionalTextElement=(TextConditionalTextElement)newdConditionField.getOdfElement();
      newTextConditionalTextElement.setTextCurrentValueAttribute(CurrentValue);
      newfield=newdConditionField;
      break;
    case HIDDEN_TEXT_FIELD:
      ConditionField conditionFieldHIDDEN = (ConditionField)orgField;
      TextConditionalTextElement textConditionalTextElementHIDDEN =(TextConditionalTextElement) conditionFieldHIDDEN.getOdfElement();
      String StringValueIfFalseHIDDEN=textConditionalTextElementHIDDEN.getTextStringValueIfFalseAttribute();
      String StringConditionHIDDEN=textConditionalTextElementHIDDEN.getTextConditionAttribute();
      boolean CurrentValueHIDDEN=textConditionalTextElementHIDDEN.getTextCurrentValueAttribute();
      ConditionField newdConditionFieldHIDDEN = nextFieldSelection.replaceWithHiddenTextField(StringConditionHIDDEN, StringValueIfFalseHIDDEN);
      TextConditionalTextElement newTextConditionalTextElementHIDDEN=(TextConditionalTextElement)newdConditionFieldHIDDEN.getOdfElement();
      newTextConditionalTextElementHIDDEN.setTextCurrentValueAttribute(CurrentValueHIDDEN);
      newfield=newdConditionFieldHIDDEN;
      break;
    case REFERENCE_FIELD:
    default: throw new IllegalArgumentException("Simple Java API for ODF doesn't support this type now.");
    }
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.text.TextConditionalTextElement

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.