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 44 public class CalendarTag extends BlockElementTag 45 { 46 48 51 private static final long serialVersionUID = 8205210883621738873L; 52 53 56 protected String m_strName; 57 58 61 protected String m_strSize; 62 63 66 protected String m_strInputcssclass; 67 68 71 protected String m_strButtoncssclass; 72 73 79 protected String m_strFocus; 80 81 84 protected String m_strDisabled; 85 86 89 protected String m_strValue; 90 91 98 protected String m_strDatetimeformat; 99 100 102 105 public CalendarTag() 106 { 107 super("clsStrechControl", BlockElementTag.DIV_BLOCK_ELEMENT); 108 109 m_strName = null; 110 m_strSize = null; 111 m_strInputcssclass = "clsStretchCalendarEdit"; 112 m_strButtoncssclass = "clsCalendarButton"; 113 m_strDisabled = Boolean.FALSE.toString(); 114 m_strValue = null; 115 m_strDatetimeformat = null; 121 } 122 123 125 128 public int doStartTag( 129 ) throws JspException 130 { 131 StringBuffer sbHtml = null; 132 133 sbHtml = new StringBuffer (); 134 135 144 145 sbHtml.append("<"); 147 sbHtml.append(m_strType); 148 sbHtml.append(" id=\""); 149 sbHtml.append(getCurrentId()); 150 sbHtml.append(m_strId); 151 sbHtml.append("control\""); 152 if ((m_strCssclass != null) && (m_strCssclass.length() > 0)) 153 { 154 sbHtml.append(" class=\""); 155 sbHtml.append(m_strCssclass); 156 sbHtml.append("\""); 157 } 158 sbHtml.append(">\n"); 159 sbHtml.append("<input id=\""); 160 sbHtml.append(getCurrentId()); 161 sbHtml.append(m_strId); 162 sbHtml.append("inputfield\""); 163 if ((m_strInputcssclass != null) && (m_strInputcssclass.length() > 0)) 164 { 165 sbHtml.append(" class=\""); 166 sbHtml.append(m_strInputcssclass); 167 sbHtml.append("\""); 168 } 169 sbHtml.append(" type=\"text\""); 170 if ((m_strName != null) && (m_strName.length() > 0)) 171 { 172 sbHtml.append(" name=\""); 173 sbHtml.append(m_strName); 174 sbHtml.append("\""); 175 } 176 if ((m_strSize != null) && (m_strSize.length() > 0)) 177 { 178 sbHtml.append(" size=\""); 179 sbHtml.append(m_strSize); 180 sbHtml.append("\""); 181 } 182 183 192 sbHtml.append(" maxlength=\""); 194 sbHtml.append(m_strDatetimeformat.length()); 195 sbHtml.append("\""); 196 197 if (isDisabledControl()) 198 { 199 sbHtml.append(" disabled=\"disabled\""); 200 } 201 if ((m_strValue != null) && (m_strValue.length() > 0)) 202 { 203 sbHtml.append(" value=\""); 204 sbHtml.append(m_strValue); 205 sbHtml.append("\""); 206 } 207 sbHtml.append(">"); 208 sbHtml.append("<button"); 210 if ((m_strButtoncssclass != null) && (m_strButtoncssclass.length() > 0)) 211 { 212 sbHtml.append(" class=\""); 213 sbHtml.append(m_strButtoncssclass); 214 sbHtml.append("\""); 215 } 216 sbHtml.append(" type=\"button\" onclick=\"return showCalendar('"); 217 sbHtml.append(getCurrentId()); 218 sbHtml.append(m_strId); 219 sbHtml.append("inputfield', '"); 220 sbHtml.append(m_strDatetimeformat); 221 sbHtml.append("');\"></button>"); 222 223 TagUtils.write(pageContext, sbHtml.toString()); 224 225 if (isFocusedControl()) 226 { 227 sbHtml.delete(0, sbHtml.length()); 230 sbHtml.append(getCurrentId()); 231 sbHtml.append(m_strId); 232 233 cache(TabbedDialogTag.FOCUSED_CONTROL_ID, sbHtml.toString()); 234 } 235 236 return (EVAL_BODY_INCLUDE); 237 } 238 239 242 public int doEndTag( 243 ) throws JspException 244 { 245 StringBuffer sbHtml = new StringBuffer (); 247 248 sbHtml.append("</"); 249 sbHtml.append(m_strType); 250 sbHtml.append(">"); 251 252 TagUtils.write(pageContext, sbHtml.toString()); 253 254 return (EVAL_PAGE); 255 } 256 257 260 public String getInputcssclass() 261 { 262 return m_strInputcssclass; 263 } 264 265 268 public String getButtoncssclass() 269 { 270 return m_strButtoncssclass; 271 } 272 273 276 public String getName() 277 { 278 return m_strName; 279 } 280 281 284 public String getSize() 285 { 286 return m_strSize; 287 } 288 289 293 public String getFocus() 294 { 295 return m_strFocus; 296 } 297 298 302 public void setInputcssclass( 303 String strInputcssclass 304 ) 305 { 306 m_strInputcssclass = strInputcssclass; 307 } 308 309 314 public void setButtoncssclass( 315 String strButtoncssclass 316 ) 317 { 318 m_strButtoncssclass = strButtoncssclass; 319 } 320 321 324 public void setName( 325 String strName 326 ) 327 { 328 m_strName = strName; 329 } 330 331 335 public void setFocus( 336 String strFocus 337 ) 338 { 339 m_strFocus = strFocus; 340 } 341 342 346 public void setFocus( 347 boolean bFocus 348 ) 349 { 350 m_strFocus = Boolean.toString(bFocus); 351 } 352 353 356 public void setSize( 357 String strSize 358 ) 359 { 360 m_strSize = strSize; 361 } 362 363 367 public boolean isFocusedControl( 368 ) 369 { 370 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strFocus)) 371 || ("1".equals(m_strFocus))); 372 } 373 374 378 public String getDisabled( 379 ) 380 { 381 return m_strDisabled; 382 } 383 384 388 public void setDisabled( 389 String strDisabled 390 ) 391 { 392 m_strDisabled = strDisabled; 393 } 394 395 399 public void setDisabled( 400 boolean bDisabled 401 ) 402 { 403 m_strDisabled = Boolean.toString(bDisabled); 404 } 405 406 409 public boolean isDisabledControl( 410 ) 411 { 412 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strDisabled)) 413 || ("1".equals(m_strDisabled))); 414 } 415 416 419 public String getValue() 420 { 421 return m_strValue; 422 } 423 424 427 public void setValue( 428 String strValue 429 ) 430 { 431 m_strValue = strValue; 432 } 433 434 437 public String getDatetimeformat() 438 { 439 return m_strDatetimeformat; 440 } 441 442 445 public void setDatetimeformat( 446 String strDatetimeformat 447 ) 448 { 449 m_strDatetimeformat = strDatetimeformat; 450 } 451 } 452 | Popular Tags |