KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > improve > struts > taglib > layout > util > Menu


1 package fr.improve.struts.taglib.layout.util;
2
3 import java.util.Vector JavaDoc;
4
5 /**
6  * @author: Jean-NoŽl Ribette
7  */

8 public class Menu {
9     protected Vector JavaDoc items = new Vector JavaDoc();
10 public void addItem(MenuItem item) {
11     items.add(item);
12 }
13 public void addItem(String JavaDoc key, String JavaDoc link, Menu subMenu) {
14     items.add(new MenuItem(key, link, subMenu));
15 }
16 public Object JavaDoc[] getItems() {
17     return items.toArray();
18 }
19 public void insertItem(Menu item, int index) {
20     items.insertElementAt(item,index);
21 }
22 public void removeItem(String JavaDoc key) {
23     for (int i=0;i<items.size();i++) {
24         if (((MenuItem)items.get(i)).getKey().equals(key)) items.remove(i);
25     }
26 }
27 }
28
Popular Tags