root / hci / trunk / eneraptor-web-app / grails-app / services / com / eneraptor / hci / MainMenuService.groovy @ 63
History | View | Annotate | Download (2.97 KB)
1 |
package com.eneraptor.hci
|
---|---|
2 |
|
3 |
class MainMenuService { |
4 |
|
5 |
static transactional = true |
6 |
static List mainMenuItems |
7 |
|
8 |
static List sysStateSubMenu |
9 |
static List sysLogSubMenu |
10 |
static List statisticsSubMenu |
11 |
static List actionsSubMenu |
12 |
static List configSubMenu |
13 |
|
14 |
def getMainMenu() { |
15 |
|
16 |
if(mainMenuItems == null) { |
17 |
createMainMenuItems() |
18 |
} |
19 |
|
20 |
return mainMenuItems
|
21 |
|
22 |
} |
23 |
|
24 |
def createMainMenuItems() { |
25 |
mainMenuItems = new ArrayList() |
26 |
mainMenuItems.add(new MenuItem("System state" ,"sysState" ,"main")) |
27 |
mainMenuItems.add(new MenuItem("Log" ,"sysLog" ,"main")) |
28 |
mainMenuItems.add(new MenuItem("Statistics" ,"statistics","main")) |
29 |
mainMenuItems.add(new MenuItem("Scenarios" ,"actions" ,"main")) |
30 |
mainMenuItems.add(new MenuItem("Configuration","config" ,"main")) |
31 |
|
32 |
sysStateSubMenu = new ArrayList() |
33 |
sysStateSubMenu.add(new MenuItem("Overview","sysState","main")) |
34 |
sysStateSubMenu.add(new MenuItem("Last measurements","sysState","measure")) |
35 |
sysStateSubMenu.add(new MenuItem("Last actions taken","sysState","actions")) |
36 |
|
37 |
sysLogSubMenu = new ArrayList() |
38 |
sysLogSubMenu.add(new MenuItem("Overview","sysLog","main")) |
39 |
sysLogSubMenu.add(new MenuItem("Browse","sysLog","browse")) |
40 |
sysLogSubMenu.add(new MenuItem("View logged data graphically","sysLog","graph")) |
41 |
sysLogSubMenu.add(new MenuItem("Export","sysLog","export")) |
42 |
sysLogSubMenu.add(new MenuItem("Clear","sysLog","clear")) |
43 |
|
44 |
statisticsSubMenu = new ArrayList() |
45 |
statisticsSubMenu.add(new MenuItem("Overview","statistics","main")) |
46 |
statisticsSubMenu.add(new MenuItem("Saved graphs","statistics","graphs")) |
47 |
statisticsSubMenu.add(new MenuItem("Create a new single device graph","statistics","newGraph")) |
48 |
statisticsSubMenu.add(new MenuItem("Create a new combined graph","statistics","newCombGraph")) |
49 |
statisticsSubMenu.add(new MenuItem("Make reports","statistics","newReport")) |
50 |
|
51 |
actionsSubMenu = new ArrayList() |
52 |
actionsSubMenu.add(new MenuItem("Overview","actions","main")) |
53 |
actionsSubMenu.add(new MenuItem("View and edit","actions","view")) |
54 |
actionsSubMenu.add(new MenuItem("Create new","actions","add")) |
55 |
|
56 |
configSubMenu = new ArrayList() |
57 |
configSubMenu.add(new MenuItem("Overview","config","main")) |
58 |
configSubMenu.add(new MenuItem("Configure HCI","config","hci")) |
59 |
configSubMenu.add(new MenuItem("Configure the Logic","config","logic")) |
60 |
configSubMenu.add(new MenuItem("Configure HCI to Logic connection","config","connection")) |
61 |
|
62 |
} |
63 |
|
64 |
def getSubMenu(String menu) { |
65 |
|
66 |
if (menu == "sysState" ) return sysStateSubMenu; |
67 |
else if(menu == "sysLog" ) return sysLogSubMenu; |
68 |
else if(menu == "statistics") return statisticsSubMenu; |
69 |
else if(menu == "actions" ) return actionsSubMenu; |
70 |
else if(menu == "config" ) return configSubMenu; |
71 |
|
72 |
} |
73 |
|
74 |
} |
75 |
|
76 |
class MenuItem { |
77 |
|
78 |
String label
|
79 |
String name
|
80 |
String url
|
81 |
|
82 |
public MenuItem(String l, String n, String url) { |
83 |
this.label = l
|
84 |
this.name = n
|
85 |
this.url = url
|
86 |
} |
87 |
|
88 |
} |