1 21 package net.mlw.vlh.web.tag; 22 23 import javax.servlet.jsp.JspException ; 24 import javax.servlet.jsp.tagext.BodyTagSupport ; 25 26 import net.mlw.vlh.web.tag.support.Attributeable; 27 import net.mlw.vlh.web.tag.support.Attributes; 28 29 33 public class ConfigurableTag extends BodyTagSupport implements Attributeable 34 { 35 private Attributes cellAttributes = new Attributes(); 36 37 private String attributesString = null; 38 39 private String initialClassCellAttributes = null; 40 41 46 public void setCellAttribute(String name, String value) 47 { 48 cellAttributes.setCellAttribute(name, value); 49 if (name.equalsIgnoreCase("class")) 50 { 51 initialClassCellAttributes = value; 52 } 53 } 54 55 59 public void appendClassCellAttribute(String value) 60 { 61 cellAttributes.setCellAttribute("class", initialClassCellAttributes); 62 cellAttributes.appendCellAttribute("class", value); 63 } 64 65 public Attributes getCellAttributes() 66 { 67 return cellAttributes; 68 } 69 70 73 public String getAttributes() 74 { 75 return attributesString; 76 } 77 78 82 public void setAttributes(String attributes) 83 { 84 this.attributesString = attributes; 85 } 86 87 90 public int doEndTag() throws JspException 91 { 92 int result = super.doEndTag(); 93 resetAttributes(); 94 return result; 95 } 96 97 protected void resetAttributes() 98 { 99 cellAttributes.reset(); 100 initialClassCellAttributes = null; 101 attributesString = null; 102 } 103 104 112 public void release() 113 { 114 super.release(); 115 resetAttributes(); 116 } 117 } | Popular Tags |