1 17 18 package com.finalist.jag.template; 19 20 21 import com.finalist.jag.template.parser.*; 22 import com.finalist.jag.taglib.*; 23 import com.finalist.jag.*; 24 25 32 public class TemplateTag { 33 34 private TagDef tagDef = null; 35 36 37 private PageContext pageContext = null; 38 39 40 private String tagLib; 41 42 43 private String tagName; 44 45 46 private JagParameter[] paramArray = new JagParameter[0]; 47 48 49 private TemplateTextBlock textBuffer = null; 50 51 52 private TemplateTextBlock closeTagBuffer = null; 53 54 55 private boolean processed = false; 56 57 58 67 public TemplateTag(String tagLib, String tagName, TemplateTextBlock textBuffer) { 68 69 this.tagLib = tagLib; 70 this.tagName = tagName; 71 this.textBuffer = textBuffer; 72 } 73 74 75 84 public TemplateTag(TemplateTag n) { 85 clone(n); 86 87 this.textBuffer = new TemplateTextBlock(n.textBuffer); 88 this.closeTagBuffer = new TemplateTextBlock(n.closeTagBuffer); 89 this.tagDef = (n.tagDef != null) ? new TagDef(n.tagDef) : null; 90 this.paramArray = new JagParameter[n.paramArray.length]; 91 92 for (int i = 0; i < paramArray.length; i++) { 93 this.paramArray[i] = new JagParameter(n.paramArray[i]); 94 } 95 } 96 97 98 105 public TemplateTextBlock getTextBuffer() { 106 return textBuffer; 107 } 108 109 110 120 public TemplateTag(String tagLib, String tagName, JagParameter[] paramArray, 121 TemplateTextBlock textBuffer) { 122 123 this(tagLib, tagName, textBuffer); 124 125 this.paramArray = paramArray; 126 } 127 128 129 137 public void clone(TemplateTag other) { 138 139 this.tagDef = other.tagDef; 140 this.tagLib = other.tagLib; 141 this.tagName = other.tagName; 142 this.paramArray = other.paramArray; 143 this.textBuffer = other.textBuffer; 144 this.closeTagBuffer = other.closeTagBuffer; 145 this.pageContext = other.pageContext; 146 } 147 148 149 156 public void setTagDefinition(TagDef tagDef) { 157 this.tagDef = tagDef; 158 } 159 160 161 168 public void setPageContext(PageContext pageContext) { 169 this.pageContext = pageContext; 170 } 171 172 173 180 public void setTagLib(String tagLib) { 181 this.tagLib = tagLib; 182 } 183 184 185 192 public void setTagName(String tagName) { 193 this.tagName = tagName; 194 } 195 196 197 204 public void setParamArray(JagParameter[] paramArray) { 205 this.paramArray = paramArray; 206 } 207 208 209 216 public void setTextBuffer(TemplateTextBlock textBuffer) { 217 this.textBuffer = textBuffer; 218 } 219 220 221 228 public TagDef getTagDefinition() { 229 return (this.tagDef); 230 } 231 232 233 240 public String getTagLib() { 241 return (this.tagLib); 242 } 243 244 245 252 public String getTagName() { 253 return (this.tagName); 254 } 255 256 257 264 public JagParameter[] getParamArray() { 265 return (this.paramArray); 266 } 267 268 269 276 public PageContext getPageContext() { 277 return (this.pageContext); 278 } 279 280 281 288 public void setClosingTextBuffer(TemplateTextBlock endBuffer) { 289 closeTagBuffer = endBuffer; 290 } 291 292 293 298 public void clearCloseTag() { 299 300 if (closeTagBuffer != null) { 301 closeTagBuffer.set(); 302 } 303 } 304 305 306 311 public void clearTag() { 312 313 if (textBuffer != null) { 314 textBuffer.set(); 315 } 316 } 317 318 319 326 public void setProcessed(boolean b) { 327 processed = b; 328 } 329 330 331 338 public boolean isProcessed() { 339 return (this.processed); 340 } 341 342 343 350 public TemplateTextBlock getClosingTextBuffer() { 351 return (this.closeTagBuffer); 352 } 353 } 354 355 ; | Popular Tags |