protected Theme readTheme(Element themeElement) {
String id = themeElement.attributeValue("id");
Theme theme = new Theme(id);
ContextReplace themeContextReplace = new ContextReplace();
themeContextReplace.addValue("themes-path", null);
String rootPath = GetterUtil.getString(
themeElement.elementText("root-path"), "/");
rootPath = themeContextReplace.replace(rootPath);
themeContextReplace.addValue("root-path", rootPath);
theme.setRootPath(rootPath);
String templatesPath = GetterUtil.getString(
themeElement.elementText("templates-path"),
rootPath.concat("/templates"));
templatesPath = themeContextReplace.replace(templatesPath);
templatesPath = StringUtil.safePath(templatesPath);
themeContextReplace.addValue("templates-path", templatesPath);
theme.setTemplatesPath(templatesPath);
String cssPath = GetterUtil.getString(
themeElement.elementText("css-path"), rootPath.concat("/css"));
cssPath = themeContextReplace.replace(cssPath);
cssPath = StringUtil.safePath(cssPath);
themeContextReplace.addValue("css-path", cssPath);
theme.setCssPath(cssPath);
String imagesPath = GetterUtil.getString(
themeElement.elementText("images-path"),
rootPath.concat("/images"));
imagesPath = themeContextReplace.replace(imagesPath);
imagesPath = StringUtil.safePath(imagesPath);
themeContextReplace.addValue("images-path", imagesPath);
theme.setImagesPath(imagesPath);
String javaScriptPath = GetterUtil.getString(
themeElement.elementText("javascript-path"),
rootPath.concat("/js"));
javaScriptPath = themeContextReplace.replace(javaScriptPath);
javaScriptPath = StringUtil.safePath(javaScriptPath);
themeContextReplace.addValue("javascript-path", javaScriptPath);
theme.setJavaScriptPath(javaScriptPath);
String templateExtension = GetterUtil.getString(
themeElement.elementText("template-extension"), themeType);