1 13 package info.magnolia.module.admininterface.trees; 14 15 import info.magnolia.cms.beans.config.ContentRepository; 16 import info.magnolia.cms.core.Content; 17 import info.magnolia.cms.core.HierarchyManager; 18 import info.magnolia.cms.gui.control.TreeColumn; 19 import info.magnolia.cms.gui.control.TreeColumnHtmlRenderer; 20 import info.magnolia.cms.i18n.TemplateMessagesUtil; 21 22 import javax.jcr.RepositoryException; 23 24 25 28 public class TemplateTreeColumnHtmlRenderer implements TreeColumnHtmlRenderer { 29 30 33 public String renderHtml(TreeColumn treeColumn, Content content) { 34 String templateName = content.getMetaData().getTemplate(); 35 String strKey = this.findTemplateKey(templateName); 36 return TemplateMessagesUtil.get(treeColumn.getRequest(), strKey); 37 } 38 39 private String findTemplateKey(String templateName) { 40 HierarchyManager configHierarchyManager = ContentRepository.getHierarchyManager(ContentRepository.CONFIG); 41 try { 42 Content template = configHierarchyManager.getContent("modules/templating/Templates/" + templateName); return template.getTitle(); 44 } 45 catch (RepositoryException e) { 46 return templateName; 47 } 48 } 49 50 } | Popular Tags |