View Javadoc

1   /*
2    * Copyright 2004 Anite - Central Government Division
3    * http://www.anite.com/publicsector
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6    * use this file except in compliance with the License. You may obtain a copy of
7    * the License at
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14   * License for the specific language governing permissions and limitations under
15   * the License.
16   */
17  package com.anite.antelope.menu;
18  
19  /***
20   * @author <a href="mailTo:michael.jones@anite.com">Mike </a>
21   */
22  public class MenuListItem extends MenuItem {
23  
24      protected MenuLink menuLink;
25  
26      /*
27       * (non-Javadoc)
28       * 
29       * @see com.anite.antelope.modules.tools.MenuItem#draw()
30       */
31      public String draw() {
32          StringBuffer sb = new StringBuffer();
33          sb.append("<li ");
34          buildParams(sb);
35          sb.append(">");
36          buildValue(sb);
37          sb.append("</li>");
38          return sb.toString();
39      }
40  
41      /***
42       * This method should be overridden by any subclass
43       * wanting to provide a new value in the list item. This
44       * is used for inserting another menu between the li links.
45       * @param sb
46       */
47      protected void buildValue(StringBuffer sb) {
48          sb.append(menuLink.draw());
49      }
50  
51      /***
52       * @return Returns the menuLink.
53       */
54      public MenuLink getMenuLink() {
55          return menuLink;
56      }
57  
58      /***
59       * @param menuLink
60       *            The menuLink to set.
61       */
62      public void setMenuLink(MenuLink menuLink) {
63          this.menuLink = menuLink;
64      }
65  
66      /***
67       * @param menuLink
68       */
69      public MenuListItem(MenuLink menuLink) {
70          super();
71          this.menuLink = menuLink;
72      }
73  }