1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.tiles.beans;
22
23 import java.io.Serializable;
24
25 /***
26 * A MenuItem implementation.
27 * Used to read menu items in definitions.
28 *
29 * @version $Rev: 527536 $ $Date: 2007-04-11 17:44:51 +0200 (Wed, 11 Apr 2007) $
30 */
31 public class SimpleMenuItem implements MenuItem, Serializable {
32
33 /***
34 * The value of the item, i.e. what is really visible to the user.
35 */
36 private String value = null;
37
38 /***
39 * The link where the menu item points to.
40 */
41 private String link = null;
42
43 /***
44 * The (optional) icon image URL.
45 */
46 private String icon = null;
47
48 /***
49 * The (optional) tooltip text.
50 */
51 private String tooltip = null;
52
53 /***
54 * Constructor.
55 */
56 public SimpleMenuItem() {
57 super();
58 }
59
60 /***
61 * Sets the value of the item, i.e. what is really visible to the user.
62 *
63 * @param value The value of the item.
64 */
65 public void setValue(String value) {
66 this.value = value;
67 }
68
69 /***
70 * Returns the value of the item, i.e. what is really visible to the user.
71 *
72 * @return The value of the item.
73 */
74 public String getValue() {
75 return value;
76 }
77
78 /***
79 * Sets the link where the menu item points to.
80 *
81 * @param link The link.
82 */
83 public void setLink(String link) {
84 this.link = link;
85 }
86
87 /***
88 * Returns the link where the menu item points to.
89 *
90 * @return The link.
91 */
92 public String getLink() {
93 return link;
94 }
95
96 /***
97 * Sets the (optional) icon image URL.
98 *
99 * @param icon The icon URL.
100 */
101 public void setIcon(String icon) {
102 this.icon = icon;
103 }
104
105 /***
106 * Returns the (optional) icon image URL.
107 *
108 * @return The icon URL.
109 */
110 public String getIcon() {
111 return icon;
112 }
113
114 /***
115 * Sets the (optional) tooltip text.
116 *
117 * @param tooltip The tooltip text.
118 */
119 public void setTooltip(String tooltip) {
120 this.tooltip = tooltip;
121 }
122
123 /***
124 * Returns the (optional) tooltip text.
125 *
126 * @return The tooltip text.
127 */
128 public String getTooltip() {
129 return tooltip;
130 }
131
132 /*** {@inheritDoc} */
133 public String toString() {
134 StringBuffer buff = new StringBuffer("SimpleMenuItem[");
135
136 if (getValue() != null) {
137 buff.append("value=").append(getValue()).append(", ");
138 }
139
140 if (getLink() != null) {
141 buff.append("link=").append(getLink()).append(", ");
142 }
143
144 if (getTooltip() != null) {
145 buff.append("tooltip=").append(getTooltip()).append(", ");
146 }
147
148 if (getIcon() != null) {
149 buff.append("icon=").append(getIcon()).append(", ");
150 }
151
152 buff.append("]");
153 return buff.toString();
154 }
155
156 }