1 21 22 package org.opensubsystems.patterns.tabbeddialog.www; 23 24 import javax.servlet.jsp.JspException ; 25 26 import org.opensubsystems.core.www.PageElementCacheTag; 27 import org.opensubsystems.core.www.TagUtils; 28 29 59 public class TabbedDialogJSTag extends PageElementCacheTag 60 { 61 63 66 private static final long serialVersionUID = -3534110354211896981L; 67 68 72 protected String m_strFunction; 73 74 77 protected String m_strParam1; 78 79 82 protected String m_strParam2; 83 84 87 protected String m_strParam3; 88 89 92 protected String m_strParam4; 93 94 97 protected String m_strParam5; 98 99 101 104 public TabbedDialogJSTag() 105 { 106 super(); 107 m_strParam1 = null; 108 m_strParam2 = null; 109 m_strParam3 = null; 110 m_strParam4 = null; 111 m_strParam5 = null; 112 } 113 114 116 119 public int doStartTag( 120 ) throws JspException 121 { 122 StringBuffer sbHtml = new StringBuffer (); 123 124 if (("onload".equalsIgnoreCase(m_strFunction)) 125 || ("onresize".equalsIgnoreCase(m_strFunction))) 126 { 127 if ((m_strParam1 == null) || (m_strParam1.length() == 0)) 128 { 129 m_strParam1 = "dialogmessages"; 130 } 131 if ((m_strParam2 == null) || (m_strParam2.length() == 0)) 132 { 133 m_strParam2 = "bodycontent"; 134 } 135 if ((m_strParam3 == null) || (m_strParam3.length() == 0)) 136 { 137 m_strParam3 = "iBodyContentHeight"; 138 } 139 if ((m_strParam4 == null) || (m_strParam4.length() == 0)) 140 { 141 m_strParam4 = "true"; 142 } 143 if ((m_strParam5 == null) || (m_strParam5.length() == 0)) 144 { 145 m_strParam5 = "false"; 146 } 147 148 if ("onload".equalsIgnoreCase(m_strFunction)) 149 { 150 sbHtml.append("initAllTabs('"); 152 sbHtml.append(m_strId); 153 sbHtml.append("',"); 154 sbHtml.append(m_strParam5); 155 sbHtml.append(");\n"); 156 } 157 158 162 if (!"default".equalsIgnoreCase(m_strParam3)) 163 { 164 sbHtml.append("resizeTabbedDialog('"); 165 sbHtml.append(m_strId); 166 sbHtml.append("', '"); 167 sbHtml.append(m_strId); 168 sbHtml.append("dialog', '"); 169 sbHtml.append(m_strId); 170 sbHtml.append("tabfiller', '"); 171 sbHtml.append(m_strParam1); 172 sbHtml.append("', '"); 173 sbHtml.append(m_strParam2); 174 sbHtml.append("', "); 175 sbHtml.append(m_strParam3); 176 sbHtml.append(", "); 177 sbHtml.append(m_strParam4); 178 sbHtml.append(");\n"); 179 } 180 181 if ("onload".equalsIgnoreCase(m_strFunction)) 182 { 183 sbHtml.append("focusSpecifiedControl();"); 185 } 186 } 187 else if ("ondialoghelp".equalsIgnoreCase(m_strFunction)) 188 { 189 192 sbHtml.append("switchHelpTab('"); 193 sbHtml.append(m_strId); 194 sbHtml.append(m_strParam1); 195 sbHtml.append("dialoghelpheader', '"); 196 sbHtml.append(m_strId); 197 sbHtml.append("', "); 198 if ((m_strParam2 != null) && (m_strParam2.length() > 0)) 199 { 200 sbHtml.append("'"); 201 sbHtml.append(m_strParam2.replaceAll("\'", "\\\\'")); 206 sbHtml.append("'"); 207 } 208 else 209 { 210 sbHtml.append("null"); 211 } 212 sbHtml.append(");"); 213 } 214 else 215 { 216 sbHtml.append("<!-- Tabbed dialog doesnt support method "); 217 sbHtml.append(m_strFunction); 218 sbHtml.append(" with parameters "); 219 if (m_strParam1 != null) 220 { 221 sbHtml.append(" param1="); 222 sbHtml.append(m_strParam1); 223 sbHtml.append(" "); 224 } 225 else 226 { 227 sbHtml.append(" param1=null "); 228 } 229 if (m_strParam2 != null) 230 { 231 sbHtml.append(" param2="); 232 sbHtml.append(m_strParam2); 233 sbHtml.append(" "); 234 } 235 else 236 { 237 sbHtml.append(" param2=null "); 238 } 239 if (m_strParam3 != null) 240 { 241 sbHtml.append(" param3="); 242 sbHtml.append(m_strParam3); 243 sbHtml.append(" "); 244 } 245 else 246 { 247 sbHtml.append(" param3=null "); 248 } 249 sbHtml.append(" -->"); 250 251 } 252 253 if ((m_strCacheas != null) && (m_strCacheas.length() > 0)) 254 { 255 cache(m_strCacheas, sbHtml.toString()); 256 } 257 else 258 { 259 TagUtils.write(pageContext, sbHtml.toString()); 260 } 261 262 return (SKIP_BODY); 263 } 264 265 268 public int doEndTag( 269 ) throws JspException 270 { 271 return (EVAL_PAGE); 272 } 273 274 279 public String getFunction( 280 ) 281 { 282 return m_strFunction; 283 } 284 285 288 public String getParam1( 289 ) 290 { 291 return m_strParam1; 292 } 293 294 297 public String getParam2( 298 ) 299 { 300 return m_strParam2; 301 } 302 303 306 public String getParam3( 307 ) 308 { 309 return m_strParam3; 310 } 311 312 315 public String getParam4( 316 ) 317 { 318 return m_strParam4; 319 } 320 321 324 public String getParam5( 325 ) 326 { 327 return m_strParam5; 328 } 329 330 335 public void setFunction( 336 String strFunction 337 ) 338 { 339 m_strFunction = strFunction; 340 } 341 342 345 public void setParam1( 346 String strParam1 347 ) 348 { 349 m_strParam1 = strParam1; 350 } 351 352 355 public void setParam2( 356 String strParam2 357 ) 358 { 359 m_strParam2 = strParam2; 360 } 361 362 365 public void setParam3( 366 String strParam3 367 ) 368 { 369 m_strParam3 = strParam3; 370 } 371 372 375 public void setParam4( 376 String strParam4 377 ) 378 { 379 m_strParam4 = strParam4; 380 } 381 382 385 public void setParam5( 386 String strParam5 387 ) 388 { 389 m_strParam5 = strParam5; 390 } 391 } 392 | Popular Tags |