|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
TextArea.java | 100% | 100% | 100% | 100% |
|
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.form; | |
16 | ||
17 | import org.apache.tapestry.IMarkupWriter; | |
18 | import org.apache.tapestry.IRequestCycle; | |
19 | ||
20 | /** | |
21 | * Implements a component that manages an HTML <textarea> form element. | |
22 | * | |
23 | * [<a href="../../../../../ComponentReference/TextArea.html">Component Reference</a>] | |
24 | * | |
25 | * As of 4.0, TextField can indicate that it is required, use a custom translator, | |
26 | * and perform validation on the submitted text. | |
27 | * | |
28 | * @author Howard Lewis Ship | |
29 | * @author Paul Ferraro | |
30 | */ | |
31 | public abstract class TextArea extends AbstractValidatableField | |
32 | { | |
33 | public abstract String getValue(); | |
34 | ||
35 | public abstract void setValue(String value); | |
36 | ||
37 | /** | |
38 | * @see org.apache.tapestry.form.validator.AbstractValidatableField#render(org.apache.tapestry.IMarkupWriter, org.apache.tapestry.IRequestCycle, java.lang.String) | |
39 | */ | |
40 | 4 | public void render(IMarkupWriter writer, IRequestCycle cycle, String value) |
41 | { | |
42 | 4 | renderDelegatePrefix(writer, cycle); |
43 | ||
44 | 4 | writer.begin("textarea"); |
45 | ||
46 | 4 | writer.attribute("name", getName()); |
47 | ||
48 | 4 | if (isDisabled()) |
49 | 1 | writer.attribute("disabled", "disabled"); |
50 | ||
51 | 4 | renderIdAttribute(writer, cycle); |
52 | ||
53 | 4 | renderDelegateAttributes(writer, cycle); |
54 | ||
55 | 4 | renderContributions(writer, cycle); |
56 | ||
57 | 4 | renderInformalParameters(writer, cycle); |
58 | ||
59 | 4 | if (value != null) |
60 | 3 | writer.print(value); |
61 | ||
62 | 4 | writer.end(); |
63 | ||
64 | 4 | renderDelegateSuffix(writer, cycle); |
65 | } | |
66 | ||
67 | /** | |
68 | * @see org.apache.tapestry.form.ValidatableField#writeValue(java.lang.Object) | |
69 | */ | |
70 | 1 | public void writeValue(Object value) |
71 | { | |
72 | 1 | setValue((String) value); |
73 | } | |
74 | ||
75 | /** | |
76 | * @see org.apache.tapestry.form.ValidatableField#readValue() | |
77 | */ | |
78 | 1 | public Object readValue() |
79 | { | |
80 | 1 | return getValue(); |
81 | } | |
82 | } |
|