}
protected PageConfig parseToPageConfig(Element pageEle) {
String parentP = XMLUtil.getAttribute(pageEle, "parent");
String qualifierP = XMLUtil.getAttribute(pageEle, "qualifier");
PageConfig pageConfig = new PageConfig(parentP, qualifierP);
List<Element> placeholderEles = XMLUtil.getChildElements(pageEle, "placeholder");
for(Element placeholderEle : placeholderEles) {
String nameP = XMLUtil.getAttribute(placeholderEle, "name");
List<Element> widgetEles = XMLUtil.getChildElements(placeholderEle, "widget");
for(Element widgetEle : widgetEles) {
String nameW = XMLUtil.getAttribute(widgetEle, "name");
String pathW = XMLUtil.getAttribute(widgetEle, "path");
String cssClassW = XMLUtil.getAttribute(widgetEle, "cssClass");
String cacheW = XMLUtil.getAttribute(widgetEle, "cache");
WidgetConfig widgetConfig = new WidgetConfig(nameW, pathW, cssClassW, cacheW);
//
Element titleEle = XMLUtil.getChildElement(widgetEle, "title");
if(titleEle!=null) {
String titleW = XMLUtil.getValue(titleEle);
widgetConfig.setTitle(titleW);
}
//
Element prefsEle = XMLUtil.getChildElement(widgetEle, "prefs");
if(prefsEle!=null) {
List<Element> prefEles = XMLUtil.getChildElements(prefsEle);
for(Element prefEle : prefEles) {
String key = XMLUtil.getName(prefEle);
String value = XMLUtil.getValue(prefEle);
widgetConfig.addPref(key, value);
}
}
pageConfig.add(nameP, widgetConfig);
}
}
return pageConfig;
}