@Test public void testUpdateCondition() { try { TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(TEST_DOCUMENT)); VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_con_variable"); Paragraph varParagraph = doc.addParagraph("test_con_variable:"); simpleVariableField.updateField("true", varParagraph.getOdfElement()); 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()); } catch (Exception e) { Logger.getLogger(ConditionFieldTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(e.getMessage()); } }
public void updateCondition(String condition) { conditionalTextElement.setTextConditionAttribute("ooow:" + condition); }
ConditionField extends Field { public void updateCondition(String condition) { conditionalTextElement.setTextConditionAttribute("ooow:" + condition); } }
ConditionField extends Field { public void updateCondition(String condition) { conditionalTextElement.setTextConditionAttribute("ooow:" + condition); } ConditionField(OdfElement odfElement, String condition, String trueText, String falseText, boolean isHiddenTextField); }
ConditionField extends Field { public void updateCondition(String condition) { conditionalTextElement.setTextConditionAttribute("ooow:" + condition); } ConditionField(OdfElement odfElement, String condition, String trueText, String falseText, boolean isHiddenTextField); void updateCondition(String condition); void updateTrueText(String text); void updateFalseText(String text); @Override OdfElement getOdfElement(); @Override FieldType getFieldType(); }
ConditionField extends Field { public void updateCondition(String condition) { conditionalTextElement.setTextConditionAttribute("ooow:" + condition); } ConditionField(OdfElement odfElement, String condition, String trueText, String falseText, boolean isHiddenTextField); void updateCondition(String condition); void updateTrueText(String text); void updateFalseText(String text); @Override OdfElement getOdfElement(); @Override FieldType getFieldType();  }