1/*2 * $Id: SimpleMenuItem.java 527536 2007-04-11 15:44:51Z apetrelli $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.beans;
2223import java.io.Serializable;
2425/***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 (mer, 11 apr 2007) $30 */31publicclassSimpleMenuItem implements MenuItem, Serializable {
3233/***34 * The value of the item, i.e. what is really visible to the user.35 */36private String value = null;
3738/***39 * The link where the menu item points to.40 */41private String link = null;
4243/***44 * The (optional) icon image URL.45 */46private String icon = null;
4748/***49 * The (optional) tooltip text.50 */51private String tooltip = null;
5253/***54 * Constructor.55 */56publicSimpleMenuItem() {
57super();
58 }
5960/***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 */65publicvoid setValue(String value) {
66this.value = value;
67 }
6869/***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 */74public String getValue() {
75return value;
76 }
7778/***79 * Sets the link where the menu item points to.80 *81 * @param link The link.82 */83publicvoid setLink(String link) {
84this.link = link;
85 }
8687/***88 * Returns the link where the menu item points to.89 *90 * @return The link.91 */92public String getLink() {
93return link;
94 }
9596/***97 * Sets the (optional) icon image URL.98 *99 * @param icon The icon URL.100 */101publicvoid setIcon(String icon) {
102this.icon = icon;
103 }
104105/***106 * Returns the (optional) icon image URL.107 *108 * @return The icon URL.109 */110public String getIcon() {
111return icon;
112 }
113114/***115 * Sets the (optional) tooltip text.116 *117 * @param tooltip The tooltip text.118 */119publicvoid setTooltip(String tooltip) {
120this.tooltip = tooltip;
121 }
122123/***124 * Returns the (optional) tooltip text.125 *126 * @return The tooltip text.127 */128public String getTooltip() {
129return tooltip;
130 }
131132/*** {@inheritDoc} */133public String toString() {
134 StringBuffer buff = new StringBuffer("SimpleMenuItem[");
135136if (getValue() != null) {
137 buff.append("value=").append(getValue()).append(", ");
138 }
139140if (getLink() != null) {
141 buff.append("link=").append(getLink()).append(", ");
142 }
143144if (getTooltip() != null) {
145 buff.append("tooltip=").append(getTooltip()).append(", ");
146 }
147148if (getIcon() != null) {
149 buff.append("icon=").append(getIcon()).append(", ");
150 }
151152 buff.append("]");
153return buff.toString();
154 }
155156 }