1 52 53 package freemarker.core; 54 55 import freemarker.template.*; 56 import javax.swing.JTree ; 57 import javax.swing.tree.DefaultTreeModel ; 58 59 abstract public class FreeMarkerTree extends JTree { 60 61 public FreeMarkerTree(Template template) { 62 super(template.getRootTreeNode()); 63 } 64 65 public void setTemplate(Template template) { 66 this.setModel(new DefaultTreeModel (template.getRootTreeNode())); 67 this.invalidate(); 68 } 69 70 71 public String convertValueToText(Object value, boolean selected, 72 boolean expanded, boolean leaf, int row, 73 boolean hasFocus) 74 { 75 if (value instanceof TemplateElement) { 76 return ((TemplateElement) value).getDescription(); 77 } 78 return value.toString(); 79 } 80 } 81 | Popular Tags |