1 7 package com.inversoft.verge.mvc.view.jsp.html; 8 9 10 import javax.servlet.jsp.JspException ; 11 12 import com.inversoft.verge.mvc.view.HtmlConstants; 13 import com.inversoft.verge.mvc.view.jsp.JspTools; 14 15 16 22 public abstract class InputTag extends BaseModelTag { 23 24 private String onfocus; 25 protected String localOnfocus; 26 private String onblur; 27 protected String localOnblur; 28 private String onselect; 29 protected String localOnselect; 30 private String onchange; 31 protected String localOnchange; 32 protected Integer size; 33 protected Integer maxlength; 34 protected Boolean disabled; 35 protected Boolean readonly; 36 private FormTag formParent; 37 38 39 44 public Boolean getDisabled() { 45 return disabled; 46 } 47 48 53 public void setDisabled(Boolean disabled) { 54 this.disabled = disabled; 55 } 56 57 62 public Boolean getReadonly() { 63 return readonly; 64 } 65 66 71 public void setReadonly(Boolean readonly) { 72 this.readonly = readonly; 73 } 74 75 80 public Integer getSize() { 81 return size; 82 } 83 84 89 public void setSize(Integer size) { 90 this.size = size; 91 } 92 93 98 public Integer getMaxlength() { 99 return maxlength; 100 } 101 102 107 public void setMaxlength(Integer maxlength) { 108 this.maxlength = maxlength; 109 } 110 111 116 public String getOnfocus() { 117 return onfocus; 118 } 119 120 125 public void setOnfocus(String onfocus) { 126 this.onfocus = onfocus; 127 } 128 129 134 public String getOnblur() { 135 return onblur; 136 } 137 138 143 public void setOnblur(String onblur) { 144 this.onblur = onblur; 145 } 146 147 152 public String getOnselect() { 153 return onselect; 154 } 155 156 161 public void setOnselect(String onselect) { 162 this.onselect = onselect; 163 } 164 165 170 public String getOnchange() { 171 return onchange; 172 } 173 174 179 public void setOnchange(String onchange) { 180 this.onchange = onchange; 181 } 182 183 189 protected void initialize() throws JspException { 190 super.initialize(); 191 192 formParent = (FormTag) findAncestorWithClass(this, FormTag.class); 194 if (formParent == null) { 195 throw new JspException ("all input tags must be inside a form tag"); 196 } 197 198 localOnfocus = onfocus; 199 localOnblur = onblur; 200 localOnselect = onselect; 201 localOnchange = onchange; 202 203 if (!JspTools.JSP_20) { 205 localOnfocus = (String ) JspTools.expand("onfocus", onfocus, 206 String .class, this, pageContext); 207 localOnblur = (String ) JspTools.expand("onblur", onblur, 208 String .class, this, pageContext); 209 localOnselect = (String ) JspTools.expand("onselect", onselect, 210 String .class, this, pageContext); 211 localOnchange = (String ) JspTools.expand("onchange", onchange, 212 String .class, this, pageContext); 213 } 214 215 if (disabled != null && disabled.booleanValue()) { 216 singleAttrs.add(HtmlConstants.DISABLED); 217 } 218 219 if (readonly != null && readonly.booleanValue()) { 220 singleAttrs.add(HtmlConstants.READONLY); 221 } 222 223 attributes.put(HtmlConstants.SIZE, size); 224 attributes.put(HtmlConstants.MAX_LENGTH, maxlength); 225 attributes.put(HtmlConstants.ON_FOCUS, localOnfocus); 226 attributes.put(HtmlConstants.ON_BLUR, localOnblur); 227 attributes.put(HtmlConstants.ON_SELECT, localOnselect); 228 attributes.put(HtmlConstants.ON_CHANGE, localOnchange); 229 } 230 231 236 protected FormTag getFormParent() { 237 return formParent; 238 } 239 240 247 public void release() { 248 super.release(); 249 setOnfocus(null); 250 setOnblur(null); 251 setOnselect(null); 252 setOnchange(null); 253 setSize(null); 254 setMaxlength(null); 255 setDisabled(null); 256 setReadonly(null); 257 formParent = null; 258 } 259 } 260 | Popular Tags |