use of com.twinsoft.convertigo.beans.common.FormatedContent in project convertigo by convertigo.
the class ApplicationComponent method preconfigure.
@Override
public void preconfigure(Element element) throws Exception {
super.preconfigure(element);
try {
NodeList properties = element.getElementsByTagName("property");
// migration of componentScriptContent from String to FormatedContent
Element propElement = (Element) XMLUtils.findNodeByAttributeValue(properties, "name", "componentScriptContent");
if (propElement != null) {
Element valueElement = (Element) XMLUtils.findChildNode(propElement, Node.ELEMENT_NODE);
if (valueElement != null) {
Document document = valueElement.getOwnerDocument();
Object content = XMLUtils.readObjectFromXml(valueElement);
if (content instanceof String) {
FormatedContent formated = new FormatedContent((String) content);
Element newValueElement = (Element) XMLUtils.writeObjectToXml(document, formated);
propElement.replaceChild(newValueElement, valueElement);
hasChanged = true;
Engine.logBeans.warn("(ApplicationComponent) 'componentScriptContent' has been updated for the object \"" + getName() + "\"");
}
}
}
} catch (Exception e) {
throw new EngineException("Unable to preconfigure the application component \"" + getName() + "\".", e);
}
}
use of com.twinsoft.convertigo.beans.common.FormatedContent in project convertigo by convertigo.
the class UIStyle method preconfigure.
@Override
public void preconfigure(Element element) throws Exception {
super.preconfigure(element);
try {
NodeList properties = element.getElementsByTagName("property");
// migration of styleContent from String to FormatedContent
Element propElement = (Element) XMLUtils.findNodeByAttributeValue(properties, "name", "styleContent");
if (propElement != null) {
Element valueElement = (Element) XMLUtils.findChildNode(propElement, Node.ELEMENT_NODE);
if (valueElement != null) {
Document document = valueElement.getOwnerDocument();
Object content = XMLUtils.readObjectFromXml(valueElement);
if (content instanceof String) {
FormatedContent formated = new FormatedContent((String) content);
Element newValueElement = (Element) XMLUtils.writeObjectToXml(document, formated);
propElement.replaceChild(newValueElement, valueElement);
hasChanged = true;
Engine.logBeans.warn("(UIStyle) 'styleContent' has been updated for the object \"" + getName() + "\"");
}
}
}
} catch (Exception e) {
throw new EngineException("Unable to preconfigure the style component \"" + getName() + "\".", e);
}
}
Aggregations