@Test public void testDisplayEditWithNothingSelected() { FormField f = new FormField("HP:0000722", "OCD", "Obsessive-compulsive disorder", "", false, false, false); String output = f.display(DisplayMode.Edit, new String[] { "phenotype", "negative_phenotype" }); Assert.assertNotNull(output); LSInput input = this.domls.createLSInput(); input.setStringData(output); Document doc = XMLUtils.parse(input); Element e = doc.getDocumentElement(); Assert.assertEquals("term-entry", e.getAttribute("class")); e = (Element) e.getFirstChild(); Assert.assertEquals("yes-no-picker", e.getAttribute("class")); e = (Element) e.getFirstChild(); Assert.assertEquals("label", e.getLocalName()); Assert.assertEquals("na", e.getAttribute("class")); Assert.assertEquals("none_HP:0000722", e.getAttribute("for")); e = (Element) e.getFirstChild(); Assert.assertEquals("input", e.getLocalName()); Assert.assertEquals("checkbox", e.getAttribute("type")); Assert.assertEquals("none", e.getAttribute("name")); Assert.assertEquals("HP:0000722", e.getAttribute("value")); Assert.assertEquals("checked", e.getAttribute("checked")); Assert.assertEquals("none_HP:0000722", e.getAttribute("id")); e = (Element) e.getParentNode().getNextSibling(); Assert.assertEquals("label", e.getLocalName()); Assert.assertEquals("yes", e.getAttribute("class")); Assert.assertEquals("phenotype_HP:0000722", e.getAttribute("for")); e = (Element) e.getFirstChild(); Assert.assertEquals("input", e.getLocalName()); Assert.assertEquals("checkbox", e.getAttribute("type")); Assert.assertEquals("phenotype", e.getAttribute("name")); Assert.assertEquals("HP:0000722", e.getAttribute("value")); Assert.assertFalse(e.hasAttribute("checked")); Assert.assertEquals("phenotype_HP:0000722", e.getAttribute("id")); Assert.assertEquals("Obsessive-compulsive disorder", e.getAttribute("title")); e = (Element) e.getParentNode().getNextSibling(); Assert.assertEquals("label", e.getLocalName()); Assert.assertEquals("no", e.getAttribute("class")); Assert.assertEquals("negative_phenotype_HP:0000722", e.getAttribute("for")); e = (Element) e.getFirstChild(); Assert.assertEquals("input", e.getLocalName()); Assert.assertEquals("checkbox", e.getAttribute("type")); Assert.assertEquals("negative_phenotype", e.getAttribute("name")); Assert.assertEquals("HP:0000722", e.getAttribute("value")); Assert.assertFalse(e.hasAttribute("checked")); Assert.assertEquals("negative_phenotype_HP:0000722", e.getAttribute("id")); Assert.assertEquals("Obsessive-compulsive disorder", e.getAttribute("title")); }
@Override public String display(DisplayMode mode, String[] fieldNames) { if (DisplayMode.Edit.equals(mode)) { return generateFormField(fieldNames); } return generateSelection(fieldNames); }
FormField extends AbstractFormElement { @Override public String display(DisplayMode mode, String[] fieldNames) { if (DisplayMode.Edit.equals(mode)) { return generateFormField(fieldNames); } return generateSelection(fieldNames); } }
FormField extends AbstractFormElement { @Override public String display(DisplayMode mode, String[] fieldNames) { if (DisplayMode.Edit.equals(mode)) { return generateFormField(fieldNames); } return generateSelection(fieldNames); } FormField(String value, String title, String hint, String metaData, boolean expandable, boolean yesSelected,
        boolean noSelected); }
FormField extends AbstractFormElement { @Override public String display(DisplayMode mode, String[] fieldNames) { if (DisplayMode.Edit.equals(mode)) { return generateFormField(fieldNames); } return generateSelection(fieldNames); } FormField(String value, String title, String hint, String metaData, boolean expandable, boolean yesSelected,
        boolean noSelected); @Override String display(DisplayMode mode, String[] fieldNames); @Override String toString(); }
FormField extends AbstractFormElement { @Override public String display(DisplayMode mode, String[] fieldNames) { if (DisplayMode.Edit.equals(mode)) { return generateFormField(fieldNames); } return generateSelection(fieldNames); } FormField(String value, String title, String hint, String metaData, boolean expandable, boolean yesSelected,
        boolean noSelected); @Override String display(DisplayMode mode, String[] fieldNames); @Override String toString();  }