1 17 18 package com.finalist.jag.taglib; 19 20 import java.util.Collection ; 21 22 import com.finalist.jag.JagException; 23 import com.finalist.jag.template.*; 24 25 32 public class TagLibrary { 33 34 private String libVersion = null; 35 36 37 private String jagVersion = null; 38 39 40 private String shortName = null; 41 42 43 private String info = null; 44 45 46 private Collection tagDefs = null; 47 48 49 56 public void setLibVersion(String libVersion) { 57 this.libVersion = libVersion; 58 } 59 60 61 67 public void setJagVersion(String jagVersion) { 68 this.jagVersion = jagVersion; 69 } 70 71 72 79 public void setShortName(String shortName) { 80 this.shortName = shortName; 81 } 82 83 84 91 public void setInfo(String info) { 92 this.info = info; 93 } 94 95 96 103 public void setTagDefs(Collection tagDefs) { 104 this.tagDefs = tagDefs; 105 } 106 107 108 115 public String getLibVersion() { 116 return (this.libVersion); 117 } 118 119 120 127 public String getJagVersion() { 128 return (this.jagVersion); 129 } 130 131 132 139 public String getShortName() { 140 return (this.shortName); 141 } 142 143 144 151 public String getInfo() { 152 return (this.info); 153 } 154 155 156 163 public Collection getTagDefs() { 164 if (tagDefs == null) 165 tagDefs = new java.util.ArrayList (); 166 167 return (this.tagDefs); 168 } 169 170 171 182 public TagDef getTagDef(TemplateTag tagRef) throws JagException { 183 TagDef tagdef = findTagDef(tagRef); 184 185 if (tagdef == null) { 186 throw new JagException("" + tagRef.getTagName() 187 + " doesn't exist in the tag library " 188 + shortName); 189 } 190 return tagdef; 191 } 192 193 194 203 public TagDef findTagDef(TemplateTag tagRef) { 204 java.util.Iterator iterator = tagDefs.iterator(); 205 206 while (iterator.hasNext()) { 207 TagDef tagDef = (TagDef) iterator.next(); 208 209 if (!(getShortName().equals(tagRef.getTagLib()))) 210 continue; 212 if (!(tagDef.getName().equals(tagRef.getTagName()))) 213 continue; 214 215 return tagDef; 216 } 217 218 return null; 219 } 220 221 222 229 public String toString() { 230 StringBuffer toString = new StringBuffer (); 231 toString.append("\nlibVersion : "); 232 toString.append(libVersion); 233 toString.append("\njagVersion : "); 234 toString.append(jagVersion); 235 toString.append("\nshortName : "); 236 toString.append(shortName); 237 toString.append("\ninfo : "); 238 toString.append(info); 239 toString.append("\ntagDefs : "); 240 toString.append(tagDefs); 241 242 Collection col = getTagDefs(); 243 java.util.Iterator iterator = col.iterator(); 244 245 while (iterator.hasNext()) { 246 TagDef tagDef = (TagDef) iterator.next(); 247 toString.append("[TagDef]" + tagDef.toString()); 248 } 249 return new String (toString); 250 } 251 } 252 253 | Popular Tags |