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