public class MyClass implements Tagged, XMLElement { private Tagged tagged; private XMLElement xmlElement; public MyClass(/*...*/) { tagged = new TaggedImpl(); xmlElement = new XMLElementImpl(); } @Override public void someTaggedMethod() { tagged.someTaggedMethod(); } }
@Override public void makeXMLData(IXMLElement conditionRoot) { XMLElementImpl packel = new XMLElementImpl("name", conditionRoot); packel.setContent(this.name); conditionRoot.addChild(packel); }
@Override public void makeXMLData(IXMLElement conditionRoot) { XMLElementImpl javael = new XMLElementImpl("java", conditionRoot); conditionRoot.addChild(javael); XMLElementImpl classel = new XMLElementImpl("class", javael); classel.setContent(this.classname); javael.addChild(classel); if (this.methodname != null) { XMLElementImpl methodel = new XMLElementImpl("method", javael); methodel.setContent(this.methodname); javael.addChild(methodel); } if (this.fieldname != null) { XMLElementImpl fieldel = new XMLElementImpl("field", javael); fieldel.setContent(this.fieldname); javael.addChild(fieldel); } XMLElementImpl returnvalel = new XMLElementImpl("returnvalue", javael); returnvalel.setContent(this.returnvalue); returnvalel.setAttribute("type", this.returnvaluetype); javael.addChild(returnvalel); }
@Override public IXMLElement createConditionElement(Condition condition, IXMLElement root) { XMLElementImpl xml = new XMLElementImpl("condition", root); xml.setAttribute("id", condition.getId()); xml.setAttribute("type", condition.getClass().getCanonicalName()); return xml; }
@Override public void makeXMLData(IXMLElement conditionRoot) { XMLElementImpl el1 = new XMLElementImpl(this.contentType.getAttribute(), conditionRoot); el1.setContent(this.source); conditionRoot.addChild(el1); XMLElementImpl el2 = new XMLElementImpl(VALUE_ELEMENT_NAME, conditionRoot); el2.setContent(this.value); el2.setAttribute(VALUE_ATTR_REGEX_NAME, Boolean.toString(isRegEx)); el2.setAttribute(VALUE_ATTR_CASEINSENSITIVE_NAME, Boolean.toString(isCaseInsensitive)); conditionRoot.addChild(el2); }
@Override public List<IXMLElement> getChildrenNamed(String name) { List<IXMLElement> res = new ArrayList<IXMLElement>(); for (IXMLElement child : getChildren()) { if (child.getName() != null && child.getName().equals(name)) { res.add(new XMLElementImpl(child.getElement())); } } return res; }
@Override public void writeRulesXML(OutputStream out) { XMLWriter xmlOut = new XMLWriter(); xmlOut.setOutput(out); XMLElementImpl conditionsel = new XMLElementImpl("conditions"); for (Condition condition : conditionsMap.values()) { IXMLElement conditionEl = createConditionElement(condition, conditionsel); condition.makeXMLData(conditionEl); conditionsel.addChild(conditionEl); } logger.fine("Writing generated conditions specification"); try { xmlOut.write(conditionsel); } catch (XMLException e) { throw new IzPackException(e); } }
@Override public List<IXMLElement> getChildren() { initChildrenList(); return childrenList; }
@Override public String getAttribute(String name) { return this.getAttribute(name, null); }
@Override public int getChildrenCount() { initChildrenList(); return childrenList.size(); }
@Override public IXMLElement getFirstChildNamed(String name) { XMLElementImpl res = null; NodeList nodeList = element.getElementsByTagName(name); if (nodeList.getLength() > 0) { res = new XMLElementImpl(nodeList.item(0)); } return res; }
@Override public void makeXMLData(IXMLElement conditionRoot) { XMLElementImpl nameEl = new XMLElementImpl("name", conditionRoot); nameEl.setContent(this.variablename); conditionRoot.addChild(nameEl); XMLElementImpl valueEl = new XMLElementImpl("value", conditionRoot); valueEl.setContent(this.value); conditionRoot.addChild(valueEl); }
@Override public IXMLElement getChildAtIndex(int index) { initChildrenList(); return childrenList.get(index); }
private IXMLElement searchFirstElement(DOMResult domResult) { for (Node child = domResult.getNode().getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() == Node.ELEMENT_NODE) { return new XMLElementImpl(child); } } return null; }
/** * {@inheritDoc} */ @Override public void makeXMLData(IXMLElement conditionRoot) { XMLElementImpl requiredUserEl = new XMLElementImpl("requiredusername", conditionRoot); requiredUserEl.setContent(this.requiredUsername); conditionRoot.addChild(requiredUserEl); }
private void initChildrenList() { if (hasChanged) { hasChanged = false; childrenList = new ArrayList<IXMLElement>(); for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() == Node.ELEMENT_NODE) { childrenList.add(new XMLElementImpl(child)); } } } }
@Override public void makeXMLData(IXMLElement conditionRoot) { XMLElementImpl nameXml = new XMLElementImpl("arg1", conditionRoot); nameXml.setContent(this.operand1); conditionRoot.addChild(nameXml); XMLElementImpl valueXml = new XMLElementImpl("arg2", conditionRoot); valueXml.setContent(this.operand2); conditionRoot.addChild(valueXml); XMLElementImpl opXml = new XMLElementImpl("operator", conditionRoot); opXml.setContent(this.operator.getAttribute()); conditionRoot.addChild(opXml); } }
dataElement = new XMLElementImpl(AUTO_KEY_CREATE_MENU_SHORTCUTS, panelRoot); dataElement = new XMLElementImpl(AUTO_KEY_PROGRAM_GROUP, panelRoot); dataElement.setContent(getGroupName()); xmlData.add(dataElement); dataElement = new XMLElementImpl(AUTO_KEY_CREATE_DESKTOP_SHORTCUTS, panelRoot); dataElement.setContent(Boolean.toString(createDesktopShortcuts)); xmlData.add(dataElement); dataElement = new XMLElementImpl(AUTO_KEY_CREATE_STARTUP_SHORTCUTS, panelRoot); dataElement.setContent(Boolean.toString(createStartupShortcuts)); xmlData.add(dataElement); dataElement = new XMLElementImpl(AUTO_KEY_SHORTCUT_TYPE, panelRoot); String userTypeString = AUTO_KEY_SHORTCUT_TYPE_VALUE_USER; if (getUserType() == Shortcut.ALL_USERS)
@Override public void makeXMLData(IXMLElement conditionRoot) { XMLElementImpl el = new XMLElementImpl(this.contentType.getAttribute(), conditionRoot); el.setContent(this.content); conditionRoot.addChild(el); }
/** * Serialize state to XML and insert under panelRoot. * * @param installData The installation installData GUI. * @param rootElement The XML root element of the panels blackbox tree. */ @Override public void createInstallationRecord(InstallData installData, IXMLElement rootElement) { HashSet<String> omitFromAutoSet = new HashSet<String>(); Map<String, String> entries = generateEntries(installData, views, omitFromAutoSet); IXMLElement dataElement; for (String key : entries.keySet()) { dataElement = new XMLElementImpl(AUTO_KEY_ENTRY, rootElement); dataElement.setAttribute(AUTO_ATTRIBUTE_KEY, key); String value = (omitFromAutoSet.contains(key) ? "" : entries.get(key)); dataElement.setAttribute(AUTO_ATTRIBUTE_VALUE, value); rootElement.addChild(dataElement); } }