Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TextArea |
|
| 0.0;0 |
1 | package net.sf.jolene.dom; | |
2 | ||
3 | import net.sf.jolene.constants.Tags; | |
4 | ||
5 | /** | |
6 | * A TextArea in a html document. | |
7 | * | |
8 | * @author Dan Howard | |
9 | * @since Oct 11, 2003 | |
10 | */ | |
11 | 1 | public final class TextArea extends HTMLElement { |
12 | ||
13 | /** | |
14 | * Default constructor. | |
15 | */ | |
16 | 12 | public TextArea() { |
17 | 12 | tag = Tags.textarea; |
18 | 12 | } |
19 | ||
20 | ||
21 | /** | |
22 | * Construct a textarea with the specified name. | |
23 | * | |
24 | * @param name name of the textarea. | |
25 | */ | |
26 | public TextArea(String name) { | |
27 | 2 | this(); |
28 | 2 | setName(name); |
29 | 2 | } |
30 | ||
31 | ||
32 | /** | |
33 | * Returns a clone of the textarea object. | |
34 | * | |
35 | * @return TextArea object. | |
36 | */ | |
37 | @Override | |
38 | public TextArea clone() { | |
39 | 1 | return (TextArea) super.clone(); |
40 | } | |
41 | ||
42 | ||
43 | /** | |
44 | * Sets the text of the textarea. Same as setValue. | |
45 | * | |
46 | * @param text text value to set on TextArea. | |
47 | */ | |
48 | @Override | |
49 | public void setContent(String text) { | |
50 | 1 | super.setContent(text); |
51 | 1 | setValue(text); |
52 | 1 | } |
53 | ||
54 | /** | |
55 | * Sets the name of the textarea. | |
56 | * | |
57 | * @param name name of the textarea. | |
58 | */ | |
59 | @Override | |
60 | public void setName(String name) { | |
61 | 8 | super.setName(name); |
62 | 8 | setAttribute("name", name); |
63 | 8 | } |
64 | ||
65 | /** | |
66 | * Renders the textarea. | |
67 | * | |
68 | * @return The textarea as a html string. | |
69 | */ | |
70 | @Override | |
71 | public String toString() { | |
72 | ||
73 | 22 | if (swapWith != null) { |
74 | 1 | return swapWith; |
75 | } | |
76 | ||
77 | 21 | if (!isRenderable() && !log.isDebugEnabled()) { |
78 | 0 | return ""; |
79 | } | |
80 | ||
81 | 21 | return super.toString() + getValue() + "</" + tag + '>'; |
82 | } | |
83 | } |