1 package org.apache.myfaces.tobago.taglib.extension;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import org.apache.myfaces.tobago.apt.annotation.ExtensionTag;
21 import org.apache.myfaces.tobago.apt.annotation.Tag;
22 import org.apache.myfaces.tobago.internal.taglib.TextareaTag;
23 import org.apache.myfaces.tobago.taglib.decl.HasConverter;
24 import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
25 import org.apache.myfaces.tobago.taglib.decl.HasLabel;
26 import org.apache.myfaces.tobago.taglib.decl.HasLabelWidth;
27 import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
28 import org.apache.myfaces.tobago.taglib.decl.HasOnchange;
29 import org.apache.myfaces.tobago.taglib.decl.HasTabIndex;
30 import org.apache.myfaces.tobago.taglib.decl.HasTip;
31 import org.apache.myfaces.tobago.taglib.decl.HasValidator;
32 import org.apache.myfaces.tobago.taglib.decl.HasValue;
33 import org.apache.myfaces.tobago.taglib.decl.HasValueChangeListener;
34 import org.apache.myfaces.tobago.taglib.decl.IsDisabled;
35 import org.apache.myfaces.tobago.taglib.decl.IsFocus;
36 import org.apache.myfaces.tobago.taglib.decl.IsReadonly;
37 import org.apache.myfaces.tobago.taglib.decl.IsRequired;
38 import org.apache.myfaces.tobago.taglib.decl.HasValidatorMessage;
39 import org.apache.myfaces.tobago.taglib.decl.HasRequiredMessage;
40 import org.apache.myfaces.tobago.taglib.decl.HasConverterMessage;
41
42 import javax.servlet.jsp.JspException;
43 import javax.servlet.jsp.tagext.BodyTagSupport;
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 @Tag(name = "textarea")
64 @ExtensionTag(baseClassName = "org.apache.myfaces.tobago.internal.taglib.TextAreaTag")
65 public class TextAreaExtensionTag extends BodyTagSupport
66 implements HasValue, HasValueChangeListener, HasIdBindingAndRendered,
67 HasConverter, HasValidator, IsReadonly, IsDisabled, HasMarkup, IsRequired,
68 HasValidatorMessage, HasRequiredMessage, HasConverterMessage,
69 HasTip, HasLabel, HasLabelWidth, IsFocus, HasOnchange, HasTabIndex {
70
71 private String binding;
72 private String converter;
73 private String disabled;
74 private String focus;
75 private String label;
76 private String readonly;
77 private String rendered;
78 private String required;
79 private String tip;
80 private String value;
81 private String valueChangeListener;
82 private String validator;
83 private String onchange;
84 private String markup;
85 private String labelWidth;
86 private String tabIndex;
87 private String validatorMessage;
88 private String converterMessage;
89 private String requiredMessage;
90
91 private LabelExtensionTag labelTag;
92 private TextareaTag textAreaTag;
93
94 @Override
95 public int doStartTag() throws JspException {
96
97 labelTag = new LabelExtensionTag();
98 labelTag.setPageContext(pageContext);
99 labelTag.setRows("*");
100 if (label != null) {
101 labelTag.setValue(label);
102 }
103 if (tip != null) {
104 labelTag.setTip(tip);
105 }
106 if (rendered != null) {
107 labelTag.setRendered(rendered);
108 }
109 if (labelWidth != null) {
110 labelTag.setColumns(labelWidth + ";*");
111 }
112 if (markup != null) {
113 labelTag.setMarkup(markup);
114 }
115 labelTag.setParent(getParent());
116 labelTag.doStartTag();
117
118 textAreaTag = new TextareaTag();
119 textAreaTag.setPageContext(pageContext);
120 if (value != null) {
121 textAreaTag.setValue(value);
122 }
123 if (valueChangeListener != null) {
124 textAreaTag.setValueChangeListener(valueChangeListener);
125 }
126 if (binding != null) {
127 textAreaTag.setBinding(binding);
128 }
129 if (converter != null) {
130 textAreaTag.setConverter(converter);
131 }
132 if (validator != null) {
133 textAreaTag.setValidator(validator);
134 }
135 if (onchange != null) {
136 textAreaTag.setOnchange(onchange);
137 }
138 if (disabled != null) {
139 textAreaTag.setDisabled(disabled);
140 }
141 if (focus != null) {
142 textAreaTag.setFocus(focus);
143 }
144 if (id != null) {
145 textAreaTag.setId(id);
146 }
147 if (readonly != null) {
148 textAreaTag.setReadonly(readonly);
149 }
150 if (required != null) {
151 textAreaTag.setRequired(required);
152 }
153 if (markup != null) {
154 textAreaTag.setMarkup(markup);
155 }
156 if (tabIndex != null) {
157 textAreaTag.setTabIndex(tabIndex);
158 }
159 if (validatorMessage != null) {
160 textAreaTag.setValidatorMessage(validatorMessage);
161 }
162 if (converterMessage != null) {
163 textAreaTag.setConverterMessage(converterMessage);
164 }
165 if (requiredMessage != null) {
166 textAreaTag.setRequiredMessage(requiredMessage);
167 }
168
169 textAreaTag.setParent(labelTag);
170 textAreaTag.doStartTag();
171
172 return super.doStartTag();
173 }
174
175 @Override
176 public int doEndTag() throws JspException {
177 textAreaTag.doEndTag();
178 labelTag.doEndTag();
179 return super.doEndTag();
180 }
181
182 @Override
183 public void release() {
184 super.release();
185 binding = null;
186 converter = null;
187 validator = null;
188 disabled = null;
189 labelWidth = null;
190 focus = null;
191 label = null;
192 readonly = null;
193 rendered = null;
194 required = null;
195 tip = null;
196 value = null;
197 onchange = null;
198 markup = null;
199 valueChangeListener = null;
200 tabIndex = null;
201 textAreaTag = null;
202 labelTag = null;
203 validatorMessage = null;
204 converterMessage = null;
205 requiredMessage = null;
206 }
207
208 public void setValue(String value) {
209 this.value = value;
210 }
211
212 public void setValueChangeListener(String valueChangeListener) {
213 this.valueChangeListener = valueChangeListener;
214 }
215
216 public void setLabel(String label) {
217 this.label = label;
218 }
219
220 public void setFocus(String focus) {
221 this.focus = focus;
222 }
223
224 public void setBinding(String binding) {
225 this.binding = binding;
226 }
227
228 public void setRendered(String rendered) {
229 this.rendered = rendered;
230 }
231
232 public void setConverter(String converter) {
233 this.converter = converter;
234 }
235
236 public void setValidator(String validator) {
237 this.validator = validator;
238 }
239
240 public void setOnchange(String onchange) {
241 this.onchange = onchange;
242 }
243
244 public void setMarkup(String markup) {
245 this.markup = markup;
246 }
247
248 public void setReadonly(String readonly) {
249 this.readonly = readonly;
250 }
251
252 public void setDisabled(String disabled) {
253 this.disabled = disabled;
254 }
255
256 public void setRequired(String required) {
257 this.required = required;
258 }
259
260 public void setTip(String tip) {
261 this.tip = tip;
262 }
263
264 public void setLabelWidth(String labelWidth) {
265 this.labelWidth = labelWidth;
266 }
267
268 public void setTabIndex(String tabIndex) {
269 this.tabIndex = tabIndex;
270 }
271
272 public void setValidatorMessage(String validatorMessage) {
273 this.validatorMessage = validatorMessage;
274 }
275
276 public void setConverterMessage(String converterMessage) {
277 this.converterMessage = converterMessage;
278 }
279
280 public void setRequiredMessage(String requiredMessage) {
281 this.requiredMessage = requiredMessage;
282 }
283 }