-
-
Save FINDarkside/ff4e4dede891cde463da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void parseFields(Element doc, Element parseDoc, EditPanel panel) { | |
if (doc == null) { | |
return; | |
} | |
NodeList panelList = XmlTools.getChildElementsByTagName(parseDoc, "panel"); | |
for (int i = 0; i < panelList.getLength(); i++) { | |
Element panelElement = (Element) panelList.item(i); | |
EditPanel childPanel = new EditPanel(panelElement.getAttribute("name")); | |
parseFields(doc, panelElement, childPanel); | |
if (!childPanel.isEmpty()) { | |
panel.addPanel(childPanel); | |
} | |
} | |
NodeList fieldsList = XmlTools.getChildElementsByTagName(parseDoc, "fields"); | |
NodeList docObjects = XmlTools.getChildElementsByTagName(doc, "object"); | |
for (int i = 0; i < fieldsList.getLength(); i++) { | |
Element fieldsElement = (Element) fieldsList.item(i); | |
if (fieldsElement.getAttribute("root").isEmpty()) { | |
parseFields(doc, fieldsElement, panel); | |
continue; | |
} | |
Element docElement = XmlTools.getElementByNameOrId(docObjects, fieldsElement.getAttribute("root")); | |
parseFields(docElement, fieldsElement, panel); | |
} | |
NodeList parseValues = XmlTools.getChildElementsByTagName(parseDoc, "value"); | |
NodeList docValues = XmlTools.getChildElementsByTagName(doc, "value"); | |
for (int i = 0; i < parseValues.getLength(); i++) { | |
Element targetValue = (Element) parseValues.item(i); | |
Element valueElement = XmlTools.getElementByNameOrId(docValues, targetValue.getAttribute("name")); | |
if (valueElement != null) { | |
String name = targetValue.getTextContent(); | |
if (name != null && !name.isEmpty()) { | |
panel.createTextField(valueElement, name); | |
} else { | |
if (panel.getParent() != null && ((EditPanel) panel.getParent()).getChildPanelCount() != 1) { //Not first child panel = no label | |
panel.createTextField(valueElement, null); | |
} else { | |
panel.createTextField(valueElement); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment