use of com.haulmont.cuba.gui.xml.XmlInheritanceProcessor in project cuba by cuba-platform.
the class ScreensHelper method getWindowElement.
@Nullable
protected Element getWindowElement(String src) throws FileNotFoundException {
String text = resources.getResourceAsString(src);
if (StringUtils.isNotEmpty(text)) {
try {
Document document = dom4JTools.readDocument(text);
XmlInheritanceProcessor processor = beanLocator.getPrototype(XmlInheritanceProcessor.NAME, document, emptyMap());
Element root = processor.getResultRoot();
if (root.getName().equals(Window.NAME) || root.getName().equals(Fragment.NAME)) {
return root;
}
} catch (RuntimeException e) {
log.error("Can't parse screen file: ", src);
}
} else {
throw new FileNotFoundException("File doesn't exist or empty: " + src);
}
return null;
}
use of com.haulmont.cuba.gui.xml.XmlInheritanceProcessor in project cuba by cuba-platform.
the class ScreensHelper method getWindowElement.
@Nullable
protected Element getWindowElement(String src) throws FileNotFoundException {
String text = resources.getResourceAsString(src);
if (StringUtils.isNotEmpty(text)) {
try {
Document document = Dom4j.readDocument(text);
XmlInheritanceProcessor processor = new XmlInheritanceProcessor(document, EMPTY_MAP);
Element root = processor.getResultRoot();
if (root.getName().equals(Window.NAME))
return root;
} catch (RuntimeException e) {
log.error("Can't parse screen file: ", src);
}
} else {
throw new FileNotFoundException("File doesn't exist or empty: " + src);
}
return null;
}
use of com.haulmont.cuba.gui.xml.XmlInheritanceProcessor in project cuba by cuba-platform.
the class ScreenXmlLoader method createDocument.
protected Document createDocument(String template, Map<String, Object> params) {
Document originalDocument = screenXmlParser.parseDescriptor(template);
XmlInheritanceProcessor processor = beanLocator.getPrototype(XmlInheritanceProcessor.NAME, originalDocument, params);
Element resultRoot = processor.getResultRoot();
return resultRoot.getDocument();
}
Aggregations