1 21 22 package org.opensubsystems.patterns.dialoglayout.www; 23 24 import javax.servlet.jsp.JspException ; 25 26 import org.opensubsystems.core.www.BlockElementTag; 27 import org.opensubsystems.core.www.TagUtils; 28 import org.opensubsystems.patterns.tabbeddialog.www.TabbedDialogTag; 29 30 40 public class SelectControlTag extends BlockElementTag 41 { 42 44 47 private static final long serialVersionUID = 1006556834175944545L; 48 49 52 protected String m_strName; 53 54 59 protected String m_strSize; 60 61 64 protected String m_strSelectcssclass; 65 66 69 protected String m_strDisabled; 70 71 77 protected String m_strFocus; 78 79 82 protected String m_strOnchange; 83 84 86 89 public SelectControlTag() 90 { 91 super("clsComboControl", BlockElementTag.DIV_BLOCK_ELEMENT); 92 93 m_strName = null; 94 m_strSize = null; 95 m_strSelectcssclass = null; 96 m_strDisabled = Boolean.FALSE.toString(); 97 m_strFocus = Boolean.FALSE.toString(); 98 m_strOnchange = null; 99 } 100 101 103 106 public int doStartTag( 107 ) throws JspException 108 { 109 StringBuffer sbHtml = new StringBuffer (); 110 111 120 121 doStartTag(sbHtml, "control", ""); 123 124 TagUtils.write(pageContext, sbHtml.toString()); 125 126 if (isFocusedControl()) 127 { 128 sbHtml.delete(0, sbHtml.length()); 131 sbHtml.append(getCurrentId()); 132 sbHtml.append(m_strId); 133 134 cache(TabbedDialogTag.FOCUSED_CONTROL_ID, sbHtml.toString()); 135 } 136 137 return (EVAL_BODY_INCLUDE); 138 } 139 140 143 public int doEndTag( 144 ) throws JspException 145 { 146 StringBuffer sbHtml = new StringBuffer (); 148 doEndTag(sbHtml); 150 151 TagUtils.write(pageContext, sbHtml.toString()); 152 153 return (EVAL_PAGE); 154 } 155 156 163 protected void doStartTag( 164 StringBuffer sbHtml, 165 String strPostfix1, 166 String strPostfix2 167 ) 168 { 169 sbHtml.append("<"); 171 sbHtml.append(m_strType); 172 sbHtml.append(" id=\""); 173 sbHtml.append(getCurrentId()); 174 sbHtml.append(m_strId); 175 sbHtml.append(strPostfix1); 176 sbHtml.append("\""); 177 if ((m_strCssclass != null) && (m_strCssclass.length() > 0)) 178 { 179 sbHtml.append(" class=\""); 180 sbHtml.append(m_strCssclass); 181 sbHtml.append("\""); 182 } 183 sbHtml.append(">\n"); 184 sbHtml.append("<select id=\""); 185 sbHtml.append(getCurrentId()); 186 sbHtml.append(m_strId); 187 sbHtml.append(strPostfix2); 188 sbHtml.append("\""); 189 if ((m_strSelectcssclass != null) && (m_strSelectcssclass.length() > 0)) 190 { 191 sbHtml.append(" class=\""); 192 sbHtml.append(m_strSelectcssclass); 193 sbHtml.append("\""); 194 } 195 if ((m_strName != null) && (m_strName.length() > 0)) 196 { 197 sbHtml.append(" name=\""); 198 sbHtml.append(m_strName); 199 sbHtml.append("\""); 200 } 201 if ((m_strSize != null) && (m_strSize.length() > 0)) 202 { 203 sbHtml.append(" size=\""); 204 sbHtml.append(m_strSize); 205 sbHtml.append("\""); 206 } 207 if ((m_strOnchange != null) && (m_strOnchange.length() > 0)) 208 { 209 sbHtml.append(" onChange=\""); 210 sbHtml.append(m_strOnchange); 211 sbHtml.append("\""); 212 } 213 if (isDisabledControl()) 214 { 215 sbHtml.append(" disabled=\"disabled\""); 216 } 217 sbHtml.append(">"); 218 } 219 220 225 protected void doEndTag( 226 StringBuffer sbHtml 227 ) 228 { 229 sbHtml.append("</select>\n</"); 231 sbHtml.append(m_strType); 232 sbHtml.append(">"); 233 } 234 235 238 public String getSelectcssclass() 239 { 240 return m_strSelectcssclass; 241 } 242 243 246 public String getName() 247 { 248 return m_strName; 249 } 250 251 254 public String getSize() 255 { 256 return m_strSize; 257 } 258 259 263 public String getFocus() 264 { 265 return m_strFocus; 266 } 267 268 272 public void setSelectcssclass( 273 String strInputcssclass 274 ) 275 { 276 m_strSelectcssclass = strInputcssclass; 277 } 278 279 282 public void setName( 283 String strName 284 ) 285 { 286 m_strName = strName; 287 } 288 289 293 public void setFocus( 294 String strFocus 295 ) 296 { 297 m_strFocus = strFocus; 298 } 299 300 304 public void setFocus( 305 boolean bFocus 306 ) 307 { 308 m_strFocus = Boolean.toString(bFocus); 309 } 310 311 314 public void setSize( 315 String strSize 316 ) 317 { 318 m_strSize = strSize; 319 } 320 321 325 public boolean isFocusedControl( 326 ) 327 { 328 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strFocus)) 329 || ("1".equals(m_strFocus))); 330 } 331 332 336 public String getDisabled( 337 ) 338 { 339 return m_strDisabled; 340 } 341 342 346 public void setDisabled( 347 String strDisabled 348 ) 349 { 350 m_strDisabled = strDisabled; 351 } 352 353 357 public void setDisabled( 358 boolean bDisabled 359 ) 360 { 361 m_strDisabled = Boolean.toString(bDisabled); 362 } 363 364 367 public boolean isDisabledControl( 368 ) 369 { 370 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strDisabled)) 371 || ("1".equals(m_strDisabled))); 372 } 373 374 377 public String getOnchange( 378 ) 379 { 380 return m_strOnchange; 381 } 382 383 386 public void setOnchange( 387 String strOnchange 388 ) 389 { 390 m_strOnchange = strOnchange; 391 } 392 } 393 | Popular Tags |