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  
21  /***
22   *
23   * @author <a href="mailTo:michael.jones@anite.com">Mike</a>
24   */
25  public class MenuLink extends MenuItem {    
26      
27      /***
28       * The href that the menu will item will go to
29       */
30      protected String htmlHref = "#";
31      
32      /***
33       * This is the value that will appear as the link for the menu
34       */
35      protected String value;
36  
37      /***
38       * This method return the html for the menu item this is basically a link
39       * with a given class. How this appears in the HTML should be set in the
40       * CSS.
41       * 
42       * @return
43       */
44      public String draw() {
45          StringBuffer sb = new StringBuffer();
46          sb.append("<a ");
47          buildParams(sb);
48          sb.append(" >" +value+"</a>");
49          
50          return sb.toString();
51      }    
52  
53      /***
54       * 
55       */
56      public MenuLink() {
57          super();
58      }
59      /***
60       * @param value
61       */
62      public MenuLink(String value) {
63          this.value = value;
64      }
65      
66      /*** 
67       * Build a html link with the values held in this class
68       * @return
69       */
70      protected void buildParams(StringBuffer sb) {
71          super.buildParams(sb);
72          sb.append(createParameter("href", htmlHref));
73      }
74     
75  
76      /***
77       * @return Returns the href.
78       */
79      public String getHtmlHref() {
80          return htmlHref;
81      }
82  
83      /***
84       * @param href
85       *            The href to set.
86       */
87      public void setHtmlHref(String href) {
88          this.htmlHref = href;
89      }
90  
91      /***
92       * @return Returns the value.
93       */
94      public String getValue() {
95          return value;
96      }
97  
98      /***
99       * @param value
100      *            The value to set.
101      */
102     public void setValue(String value) {
103         this.value = value;
104     }
105 }