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 39 public class SingleLineEditControlTag extends BlockElementTag 40 { 41 43 46 private static final long serialVersionUID = -662954227640347489L; 47 48 51 protected String m_strName; 52 53 56 protected String m_strSize; 57 58 61 protected String m_strMaxlength; 62 63 66 protected String m_strPassword; 67 68 71 protected String m_strInputcssclass; 72 73 79 protected String m_strFocus; 80 81 85 protected String m_strDisabled; 86 87 90 protected String m_strValue; 91 92 95 protected String m_strOnChange; 96 97 101 protected String m_strOnKeyPress; 102 103 107 protected String m_strOnKeyUp; 108 109 111 114 public SingleLineEditControlTag() 115 { 116 super("clsStrechControl", BlockElementTag.DIV_BLOCK_ELEMENT); 117 118 m_strName = null; 119 m_strSize = null; 120 m_strMaxlength = null; 121 m_strPassword = Boolean.FALSE.toString(); 122 m_strInputcssclass = "clsStretchSingleLineEdit"; 123 m_strDisabled = Boolean.FALSE.toString(); 124 m_strValue = null; 125 m_strOnChange = null; 126 m_strOnKeyPress = null; 127 m_strOnKeyUp = null; 128 } 129 130 132 135 public int doStartTag( 136 ) throws JspException 137 { 138 StringBuffer sbHtml = new StringBuffer (); 139 140 147 148 doStartTag(sbHtml, "control", ""); 150 151 TagUtils.write(pageContext, sbHtml.toString()); 152 153 if (isFocusedControl()) 154 { 155 sbHtml.delete(0, sbHtml.length()); 158 sbHtml.append(getCurrentId()); 159 sbHtml.append(m_strId); 160 161 cache(TabbedDialogTag.FOCUSED_CONTROL_ID, sbHtml.toString()); 162 } 163 164 return (EVAL_BODY_INCLUDE); 165 } 166 167 170 public int doEndTag( 171 ) throws JspException 172 { 173 StringBuffer sbHtml = new StringBuffer (); 175 doEndTag(sbHtml); 177 178 TagUtils.write(pageContext, sbHtml.toString()); 179 180 return (EVAL_PAGE); 181 } 182 183 190 protected void doStartTag( 191 StringBuffer sbHtml, 192 String strPostfix1, 193 String strPostfix2 194 ) 195 { 196 sbHtml.append("<"); 198 sbHtml.append(m_strType); 199 sbHtml.append(" id=\""); 200 sbHtml.append(getCurrentId()); 201 sbHtml.append(m_strId); 202 sbHtml.append(strPostfix1); 203 sbHtml.append("\""); 204 if ((m_strCssclass != null) && (m_strCssclass.length() > 0)) 205 { 206 sbHtml.append(" class=\""); 207 sbHtml.append(m_strCssclass); 208 sbHtml.append("\""); 209 } 210 sbHtml.append(">\n"); 211 sbHtml.append("<input id=\""); 212 sbHtml.append(getCurrentId()); 213 sbHtml.append(m_strId); 214 sbHtml.append(strPostfix2); 215 sbHtml.append("\""); 216 if ((m_strInputcssclass != null) && (m_strInputcssclass.length() > 0)) 217 { 218 sbHtml.append(" class=\""); 219 sbHtml.append(m_strInputcssclass); 220 sbHtml.append("\""); 221 } 222 sbHtml.append(" type=\""); 223 if (isPasswordControl()) 224 { 225 sbHtml.append("password"); 226 } 227 else 228 { 229 sbHtml.append("text"); 230 } 231 sbHtml.append("\""); 232 if ((m_strName != null) && (m_strName.length() > 0)) 233 { 234 sbHtml.append(" name=\""); 235 sbHtml.append(m_strName); 236 sbHtml.append("\""); 237 } 238 if ((m_strSize != null) && (m_strSize.length() > 0)) 239 { 240 sbHtml.append(" size=\""); 241 sbHtml.append(m_strSize); 242 sbHtml.append("\""); 243 } 244 if ((m_strMaxlength != null) && (m_strMaxlength.length() > 0)) 245 { 246 sbHtml.append(" maxlength=\""); 247 sbHtml.append(m_strMaxlength); 248 sbHtml.append("\""); 249 } 250 if (isDisabledControl()) 251 { 252 sbHtml.append(" disabled=\"disabled\""); 253 } 254 if ((m_strValue != null) && (m_strValue.length() > 0)) 255 { 256 sbHtml.append(" value=\""); 257 sbHtml.append(m_strValue); 258 sbHtml.append("\""); 259 } 260 if ((m_strOnChange != null) && (m_strOnChange.length() > 0)) 261 { 262 sbHtml.append(" onChange=\""); 263 sbHtml.append(m_strOnChange); 264 sbHtml.append("\""); 265 } 266 if ((m_strOnKeyPress != null) && (m_strOnKeyPress.length() > 0)) 267 { 268 sbHtml.append(" onKeyPress=\""); 269 sbHtml.append(m_strOnKeyPress); 270 sbHtml.append("\""); 271 } 272 if ((m_strOnKeyUp != null) && (m_strOnKeyUp.length() > 0)) 273 { 274 sbHtml.append(" onKeyUp=\""); 275 sbHtml.append(m_strOnKeyUp); 276 sbHtml.append("\""); 277 } 278 sbHtml.append(">"); 279 } 280 281 286 protected void doEndTag( 287 StringBuffer sbHtml 288 ) 289 { 290 sbHtml.append("</"); 292 sbHtml.append(m_strType); 293 sbHtml.append(">"); 294 } 295 296 299 public String getInputcssclass() 300 { 301 return m_strInputcssclass; 302 } 303 304 307 public String getMaxlength() 308 { 309 return m_strMaxlength; 310 } 311 312 315 public String getName() 316 { 317 return m_strName; 318 } 319 320 324 public String getPassword() 325 { 326 return m_strPassword; 327 } 328 329 332 public String getSize() 333 { 334 return m_strSize; 335 } 336 337 341 public String getFocus() 342 { 343 return m_strFocus; 344 } 345 346 350 public void setInputcssclass( 351 String strInputcssclass 352 ) 353 { 354 m_strInputcssclass = strInputcssclass; 355 } 356 357 361 public void setMaxlength( 362 String strMaxLength 363 ) 364 { 365 m_strMaxlength = strMaxLength; 366 } 367 368 372 public void setMaxlength( 373 int iMaxLength 374 ) 375 { 376 m_strMaxlength = Integer.toString(iMaxLength); 377 } 378 379 382 public void setName( 383 String strName 384 ) 385 { 386 m_strName = strName; 387 } 388 389 393 public void setPassword( 394 String strPassword 395 ) 396 { 397 m_strPassword = strPassword; 398 } 399 400 404 public void setPassword( 405 boolean bPassword 406 ) 407 { 408 m_strPassword = Boolean.toString(bPassword); 409 } 410 411 415 public void setFocus( 416 String strFocus 417 ) 418 { 419 m_strFocus = strFocus; 420 } 421 422 426 public void setFocus( 427 boolean bFocus 428 ) 429 { 430 m_strFocus = Boolean.toString(bFocus); 431 } 432 433 436 public void setSize( 437 String strSize 438 ) 439 { 440 m_strSize = strSize; 441 } 442 443 446 public boolean isPasswordControl( 447 ) 448 { 449 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strPassword)) 450 || ("1".equals(m_strPassword))); 451 } 452 453 457 public boolean isFocusedControl( 458 ) 459 { 460 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strFocus)) 461 || ("1".equals(m_strFocus))); 462 } 463 464 468 public String getDisabled( 469 ) 470 { 471 return m_strDisabled; 472 } 473 474 478 public void setDisabled( 479 String strDisabled 480 ) 481 { 482 m_strDisabled = strDisabled; 483 } 484 485 489 public void setDisabled( 490 boolean bDisabled 491 ) 492 { 493 m_strDisabled = Boolean.toString(bDisabled); 494 } 495 496 499 public boolean isDisabledControl( 500 ) 501 { 502 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strDisabled)) 503 || ("1".equals(m_strDisabled))); 504 } 505 506 509 public String getValue() 510 { 511 return m_strValue; 512 } 513 514 517 public void setValue( 518 String strValue 519 ) 520 { 521 m_strValue = strValue; 522 } 523 524 527 public String getOnchange( 528 ) 529 { 530 return m_strOnChange; 531 } 532 533 536 public void setOnchange( 537 String strOnchange 538 ) 539 { 540 m_strOnChange = strOnchange; 541 } 542 543 546 public String getOnkeypress( 547 ) 548 { 549 return m_strOnKeyPress; 550 } 551 552 555 public void setOnkeypress( 556 String strOnKeyPress 557 ) 558 { 559 m_strOnKeyPress = strOnKeyPress; 560 } 561 562 565 public String getOnkeyup( 566 ) 567 { 568 return m_strOnKeyUp; 569 } 570 571 574 public void setOnkeyup( 575 String strOnKeyUp 576 ) 577 { 578 m_strOnKeyUp = strOnKeyUp; 579 } 580 } 581 | Popular Tags |