1 package edu.asu.cri.MirkE;
2
3 import java.util.List;
4
5 import edu.asu.cri.MirkE.menu.MenuItem;
6 import edu.asu.cri.MirkE.menu.MenuList;
7 import edu.asu.cri.MirkE.menu.MenuXMLParser;
8
9 /***
10 * @author Siva B.S.D.S
11 *
12 */
13 public class Client
14 {
15 /***
16 * @param arg
17 */
18 public static void main(String arg[])
19 {
20 try
21 {
22
23
24
25
26
27
28
29 MenuList menuList = null;
30 menuList = MenuXMLParser.getMenuList();
31 printMenu(menuList, 1);
32 }
33 catch (Throwable exception)
34 {
35 exception.printStackTrace();
36 }
37 }
38
39 private static void printMenu(MenuList menuList, int level)
40 {
41 List childItems = null;
42 try
43 {
44 System.out.println(level + "Name : " + menuList.getName());
45 System.out.println(level + "Name Key : " + menuList.getNameKey());
46 System.out.println(
47 level + "Access Key : " + menuList.getAccessKeyStroke());
48 childItems = menuList.getChildItems();
49 System.out.println("******* Child Items : "+childItems);
50 for (int i = 0; childItems != null && i < childItems.size(); i++)
51 {
52 Object o = childItems.get(i);
53 if (o instanceof MenuItem)
54 {
55 MenuItem item = (MenuItem) o;
56 System.out.println(
57 "\t" + level + "Name : " + item.getName());
58 System.out.println(
59 "\t" + level + "Name Key : " + item.getNameKey());
60 System.out.println(
61 "\t"
62 + level
63 + "Access Key : "
64 + item.getAccessKeyStroke());
65 System.out.println(
66 "\t"
67 + level
68 + "Class Name : "
69 + item.getClassName());
70 System.out.println(
71 "\t"
72 + level
73 + "Method Name : "
74 + item.getMethodName());
75 System.out.println();
76 }
77 else
78 {
79 printMenu((MenuList) o, level + 1);
80 }
81 }
82 }
83 catch (Throwable exception)
84 {
85 exception.printStackTrace();
86 }
87 }
88
89 }