Home » tiles-2.2.1-src » org.apache » tiles » beans » [javadoc | source]

    1   /*
    2    * $Id: SimpleMenuItem.java 527536 2007-04-11 15:44:51Z apetrelli $
    3    *
    4    * Licensed to the Apache Software Foundation (ASF) under one
    5    * or more contributor license agreements.  See the NOTICE file
    6    * distributed with this work for additional information
    7    * regarding copyright ownership.  The ASF licenses this file
    8    * to you under the Apache License, Version 2.0 (the
    9    * "License"); you may not use this file except in compliance
   10    * with the License.  You may obtain a copy of the License at
   11    *
   12    * http://www.apache.org/licenses/LICENSE-2.0
   13    *
   14    * Unless required by applicable law or agreed to in writing,
   15    * software distributed under the License is distributed on an
   16    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   17    * KIND, either express or implied.  See the License for the
   18    * specific language governing permissions and limitations
   19    * under the License.
   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 (mer, 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   }

Home » tiles-2.2.1-src » org.apache » tiles » beans » [javadoc | source]