01: package com.opensymphony.webwork.components;
02:
03: import com.opensymphony.xwork.util.OgnlValueStack;
04:
05: import javax.servlet.http.HttpServletRequest;
06: import javax.servlet.http.HttpServletResponse;
07:
08: /**
09: * <!-- START SNIPPET: javadoc -->
10: * Render HTML textarea tag.</p>
11: * <!-- END SNIPPET: javadoc -->
12: *
13: * <p/> <b>Examples</b>
14: *
15: * <pre>
16: * <!-- START SNIPPET: example -->
17: * <ww:textarea label="Comments" name="comments" cols="30" rows="8"/>
18: * <!-- END SNIPPET: example -->
19: * </pre>
20: *
21: * @author Patrick Lightbody
22: * @author Rene Gielen
23: * @version $Revision: 2468 $
24: * @since 2.2
25: *
26: * @see TabbedPanel
27: *
28: * @ww.tag name="textarea" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.TextareaTag"
29: * description="Render HTML textarea tag."
30: */
31: public class TextArea extends UIBean {
32: final public static String TEMPLATE = "textarea";
33:
34: protected String cols;
35: protected String readonly;
36: protected String rows;
37: protected String wrap;
38:
39: public TextArea(OgnlValueStack stack, HttpServletRequest request,
40: HttpServletResponse response) {
41: super (stack, request, response);
42: }
43:
44: protected String getDefaultTemplate() {
45: return TEMPLATE;
46: }
47:
48: public void evaluateExtraParams() {
49: super .evaluateExtraParams();
50:
51: if (readonly != null) {
52: addParameter("readonly", findValue(readonly, Boolean.class));
53: }
54:
55: if (cols != null) {
56: addParameter("cols", findString(cols));
57: }
58:
59: if (rows != null) {
60: addParameter("rows", findString(rows));
61: }
62:
63: if (wrap != null) {
64: addParameter("wrap", findString(wrap));
65: }
66: }
67:
68: /**
69: * HTML cols attribute
70: * @ww.tagattribute required="false" type="Integer"
71: */
72: public void setCols(String cols) {
73: this .cols = cols;
74: }
75:
76: /**
77: * Whether the textarea is readonly
78: * @ww.tagattribute required="false" type="Boolean" default="false"
79: */
80: public void setReadonly(String readonly) {
81: this .readonly = readonly;
82: }
83:
84: /**
85: * HTML rows attribute
86: * @ww.tagattribute required="false" type="Integer"
87: */
88: public void setRows(String rows) {
89: this .rows = rows;
90: }
91:
92: /**
93: * HTML wrap attribute
94: * @ww.tagattribute required="false" type="String"
95: */
96: public void setWrap(String wrap) {
97: this.wrap = wrap;
98: }
99: }
|