@Test public void testAddXml() throws ParserConfigurationException { Options options = new Options(); options.add(Integer.valueOf(1), "txt", false); options.add(Integer.valueOf(2), "txt2", false); DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.newDocument(); Element root = doc.createElement("root"); doc.appendChild(root); options.addXml(root, 0); Node node = root.getFirstChild(); assertNotNull("no child was added", node); assertEquals("option", node.getNodeName()); assertEquals("1", node.getAttributes().getNamedItem("value").getNodeValue()); assertEquals("txt", node.getTextContent()); node = node.getNextSibling(); assertNotNull("no child was added", node); assertEquals("option", node.getNodeName()); assertEquals("2", node.getAttributes().getNamedItem("value").getNodeValue()); assertEquals("txt2", node.getTextContent()); }
public void addXml(Element element, long flags) { for(OptionEntry e:list){ String value = String.valueOf(e.getValue()); Element opt = XMLUtil.addElement(element, "option", e.getText()); opt.setAttribute("value", value); if (e.isActive()==false) opt.setAttribute("disabled", "true"); } }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { public void addXml(Element element, long flags) { for(OptionEntry e:list){ String value = String.valueOf(e.getValue()); Element opt = XMLUtil.addElement(element, "option", e.getText()); opt.setAttribute("value", value); if (e.isActive()==false) opt.setAttribute("disabled", "true"); } } }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { public void addXml(Element element, long flags) { for(OptionEntry e:list){ String value = String.valueOf(e.getValue()); Element opt = XMLUtil.addElement(element, "option", e.getText()); opt.setAttribute("value", value); if (e.isActive()==false) opt.setAttribute("disabled", "true"); } } Options();  Options(Options other);  Options(OptionEntry [] entries);  Options(Class<?> enumType); }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { public void addXml(Element element, long flags) { for(OptionEntry e:list){ String value = String.valueOf(e.getValue()); Element opt = XMLUtil.addElement(element, "option", e.getText()); opt.setAttribute("value", value); if (e.isActive()==false) opt.setAttribute("disabled", "true"); } } Options();  Options(Options other);  Options(OptionEntry [] entries);  Options(Class<?> enumType); @Override Options clone(); OptionEntry getEntry(Object value); String get(Object value); boolean isActive(Object value); Object getValueAt(int i); String getTextAt(int i); Set<Object> getValues(); void set(Object value, String text, boolean active, InsertPos pos); void set(Object value, String text, InsertPos pos); void set(Object value, String text); void add(Object value, String text, boolean active); @Override boolean add(OptionEntry option); @Override void clear(); @Override boolean contains(Object value); boolean containsNull(); boolean exists(Object value); @Override boolean isEmpty(); @Override Iterator<OptionEntry> iterator(); @Override boolean remove(Object value); @Override int size(); @Override Object[] toArray(); @Override String toString(); void addXml(Element element, long flags); }
Options extends AbstractSet<OptionEntry> implements Cloneable, Serializable { public void addXml(Element element, long flags) { for(OptionEntry e:list){ String value = String.valueOf(e.getValue()); Element opt = XMLUtil.addElement(element, "option", e.getText()); opt.setAttribute("value", value); if (e.isActive()==false) opt.setAttribute("disabled", "true"); } } Options();  Options(Options other);  Options(OptionEntry [] entries);  Options(Class<?> enumType); @Override Options clone(); OptionEntry getEntry(Object value); String get(Object value); boolean isActive(Object value); Object getValueAt(int i); String getTextAt(int i); Set<Object> getValues(); void set(Object value, String text, boolean active, InsertPos pos); void set(Object value, String text, InsertPos pos); void set(Object value, String text); void add(Object value, String text, boolean active); @Override boolean add(OptionEntry option); @Override void clear(); @Override boolean contains(Object value); boolean containsNull(); boolean exists(Object value); @Override boolean isEmpty(); @Override Iterator<OptionEntry> iterator(); @Override boolean remove(Object value); @Override int size(); @Override Object[] toArray(); @Override String toString(); void addXml(Element element, long flags);  }