}
doc.appendChild(presetE);
}
private PreviewPreset readXML(Document document) {
DefaultPreset defaultPreset = new DefaultPreset();//For retrieving property class if it is not in the xml (old serialization)
Element presetE = document.getDocumentElement();
Map<String, Object> propertiesMap = new HashMap<String, Object>();
String presetName = presetE.getAttribute("name");
NodeList propertyList = presetE.getElementsByTagName("previewproperty");
for (int i = 0; i < propertyList.getLength(); i++) {
Node n = propertyList.item(i);
if (n.getNodeType() == Node.ELEMENT_NODE) {
Element propertyE = (Element) n;
String name = propertyE.getAttribute("name");
String valueClassName = propertyE.hasAttribute(name) ? propertyE.getAttribute("class") : null;
String stringValue = propertyE.getTextContent();
Class valueClass = null;
if (valueClassName != null) {
try {
valueClass = Class.forName(valueClassName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} else {
Object defaultValue = defaultPreset.getProperties().get(name);
if (defaultValue != null) {
valueClass = defaultValue.getClass();
}
}
if (valueClass != null) {