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 MultiLineEditControlTag extends BlockElementTag 40 { 41 43 46 private static final long serialVersionUID = 4487059580006406993L; 47 48 51 protected String m_strName; 52 53 56 protected String m_strTextareacssclass; 57 58 64 protected String m_strFocus; 65 66 69 protected String m_strDisabled; 70 71 74 protected String m_strRows; 75 76 79 protected String m_strCols; 80 81 83 86 public MultiLineEditControlTag() 87 { 88 super("clsStrechControl", BlockElementTag.DIV_BLOCK_ELEMENT); 89 90 m_strName = null; 91 m_strTextareacssclass = "clsStretchMultiLineEdit"; 92 m_strDisabled = Boolean.FALSE.toString(); 93 m_strRows = "5"; 94 m_strCols = "20"; } 96 97 99 102 public int doStartTag( 103 ) throws JspException 104 { 105 StringBuffer sbHtml = null; 106 107 sbHtml = new StringBuffer (); 108 109 120 121 sbHtml.append("<"); 123 sbHtml.append(m_strType); 124 sbHtml.append(" id=\""); 125 sbHtml.append(getCurrentId()); 126 sbHtml.append(m_strId); 127 sbHtml.append("control\""); 128 if ((m_strCssclass != null) && (m_strCssclass.length() > 0)) 129 { 130 sbHtml.append(" class=\""); 131 sbHtml.append(m_strCssclass); 132 sbHtml.append("\""); 133 } 134 sbHtml.append(">\n"); 135 sbHtml.append("<textarea id=\""); 136 sbHtml.append(getCurrentId()); 137 sbHtml.append(m_strId); 138 sbHtml.append("\""); 139 if ((m_strTextareacssclass != null) && (m_strTextareacssclass.length() > 0)) 140 { 141 sbHtml.append(" class=\""); 142 sbHtml.append(m_strTextareacssclass); 143 sbHtml.append("\""); 144 } 145 if ((m_strName != null) && (m_strName.length() > 0)) 146 { 147 sbHtml.append(" name=\""); 148 sbHtml.append(m_strName); 149 sbHtml.append("\""); 150 } 151 if ((m_strRows != null) && (m_strRows.length() > 0)) 152 { 153 sbHtml.append(" rows=\""); 154 sbHtml.append(m_strRows); 155 sbHtml.append("\""); 156 } 157 if ((m_strCols != null) && (m_strCols.length() > 0)) 158 { 159 sbHtml.append(" cols=\""); 160 sbHtml.append(m_strCols); 161 sbHtml.append("\""); 162 } 163 if (isDisabledControl()) 164 { 165 sbHtml.append(" disabled=\"disabled\""); 166 } 167 sbHtml.append(">"); 168 169 TagUtils.write(pageContext, sbHtml.toString()); 170 171 if (isFocusedControl()) 172 { 173 sbHtml.delete(0, sbHtml.length()); 176 sbHtml.append(getCurrentId()); 177 sbHtml.append(m_strId); 178 179 cache(TabbedDialogTag.FOCUSED_CONTROL_ID, sbHtml.toString()); 180 } 181 182 return (EVAL_BODY_INCLUDE); 183 } 184 185 188 public int doEndTag( 189 ) throws JspException 190 { 191 StringBuffer sbHtml = new StringBuffer (); 193 194 sbHtml.append("</textarea>\n"); 195 sbHtml.append("</"); 196 sbHtml.append(m_strType); 197 sbHtml.append(">"); 198 199 TagUtils.write(pageContext, sbHtml.toString()); 200 201 return (EVAL_PAGE); 202 } 203 204 207 public String getTextareacssclass() 208 { 209 return m_strTextareacssclass; 210 } 211 212 215 public String getName() 216 { 217 return m_strName; 218 } 219 220 223 public String getRows() 224 { 225 return m_strRows; 226 } 227 228 231 public String getCols() 232 { 233 return m_strCols; 234 } 235 236 240 public String getFocus() 241 { 242 return m_strFocus; 243 } 244 245 249 public void setTextareacssclass( 250 String strInputcssclass 251 ) 252 { 253 m_strTextareacssclass = strInputcssclass; 254 } 255 256 259 public void setName( 260 String strName 261 ) 262 { 263 m_strName = strName; 264 } 265 266 270 public void setFocus( 271 String strFocus 272 ) 273 { 274 m_strFocus = strFocus; 275 } 276 277 281 public void setFocus( 282 boolean bFocus 283 ) 284 { 285 m_strFocus = Boolean.toString(bFocus); 286 } 287 288 291 public void setRows( 292 String strRows 293 ) 294 { 295 m_strRows = strRows; 296 } 297 298 301 public void setCols( 302 String strCols 303 ) 304 { 305 m_strCols = strCols; 306 } 307 308 312 public boolean isFocusedControl( 313 ) 314 { 315 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strFocus)) 316 || ("1".equals(m_strFocus))); 317 } 318 319 323 public String getDisabled( 324 ) 325 { 326 return m_strDisabled; 327 } 328 329 333 public void setDisabled( 334 String strDisabled 335 ) 336 { 337 m_strDisabled = strDisabled; 338 } 339 340 344 public void setDisabled( 345 boolean bDisabled 346 ) 347 { 348 m_strDisabled = Boolean.toString(bDisabled); 349 } 350 351 354 public boolean isDisabledControl( 355 ) 356 { 357 return ((Boolean.TRUE.toString().equalsIgnoreCase(m_strDisabled)) 358 || ("1".equals(m_strDisabled))); 359 } 360 } 361 | Popular Tags |