Fix parsing issues with auto complete

This commit is contained in:
George Kalampokis 2020-08-03 17:01:06 +03:00
parent cd5295437b
commit edf64328d9
1 changed files with 18 additions and 13 deletions

View File

@ -128,7 +128,10 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
if (data != null) { if (data != null) {
this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete"); this.multiAutoComplete = (Boolean) ((Map<Boolean, Object>) data).get("multiAutoComplete");
List<Map<String, Object>> dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autoCompleteSingleDataList"); List<Map<String, Object>> dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autocompleteSingle");
if (dataList == null) {
dataList = (List<Map<String, Object>>) ((Map<String, Object>) data).get("autoCompleteSingleDataList");
}
this.autoCompleteSingleDataList = new ArrayList<>(); this.autoCompleteSingleDataList = new ArrayList<>();
@ -174,19 +177,21 @@ public class AutoCompleteData extends ComboBoxData<AutoCompleteData> {
List<Map<String, Object>> autoCompletes = new ArrayList<>(); List<Map<String, Object>> autoCompletes = new ArrayList<>();
NodeList autoCompleteSingles = item.getChildNodes(); NodeList autoCompleteSingles = item.getChildNodes();
for (int i = 0; i < autoCompleteSingles.getLength(); i++) { for (int i = 0; i < autoCompleteSingles.getLength(); i++) {
if (autoCompleteSingles.item(i) instanceof Element && !((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) { if (autoCompleteSingles.item(i) instanceof Element) {
Element node = (Element) autoCompleteSingles.item(i); if (!((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) {
if (!node.hasChildNodes()) { Element node = (Element) autoCompleteSingles.item(i);
node.appendChild(node); if (!node.hasChildNodes()) {
} node.appendChild(node);
}
autoCompletes.add(singleToMap(node)); autoCompletes.add(singleToMap(node));
} else if (((Element) autoCompleteSingles.item(i)).getTagName().equals("option")) { } else {
Element node = item.getOwnerDocument().createElement("autocompleteSingle"); Element node = item.getOwnerDocument().createElement("autocompleteSingle");
node.appendChild(autoCompleteSingles.item(i)); node.appendChild(autoCompleteSingles.item(i));
node.setAttribute("url", item.getAttribute("url")); node.setAttribute("url", item.getAttribute("url"));
node.setAttribute("optionsRoot", item.getAttribute("optionsRoot")); node.setAttribute("optionsRoot", item.getAttribute("optionsRoot"));
autoCompletes.add(singleToMap(node)); autoCompletes.add(singleToMap(node));
}
} }
} }
dataMap.put("autocompleteSingle", autoCompletes); dataMap.put("autocompleteSingle", autoCompletes);