KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > form > TextArea


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 JavaDoc getValue();
34     
35     public abstract void setValue(String JavaDoc 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     public void render(IMarkupWriter writer, IRequestCycle cycle, String JavaDoc value)
41     {
42         renderDelegatePrefix(writer, cycle);
43         
44         writer.begin("textarea");
45
46         writer.attribute("name", getName());
47
48         if (isDisabled())
49             writer.attribute("disabled", "disabled");
50
51         renderIdAttribute(writer, cycle);
52
53         renderDelegateAttributes(writer, cycle);
54         
55         renderContributions(writer, cycle);
56         
57         renderInformalParameters(writer, cycle);
58
59         if (value != null)
60             writer.print(value);
61
62         writer.end();
63         
64         renderDelegateSuffix(writer, cycle);
65     }
66     
67     /**
68      * @see org.apache.tapestry.form.ValidatableField#writeValue(java.lang.Object)
69      */

70     public void writeValue(Object JavaDoc value)
71     {
72         setValue((String JavaDoc) value);
73     }
74     
75     /**
76      * @see org.apache.tapestry.form.ValidatableField#readValue()
77      */

78     public Object JavaDoc readValue()
79     {
80         return getValue();
81     }
82 }
Popular Tags