1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl;
20
21 import org.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.stereotype.Service;
23
24 import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.ApplicationMenuItemFactory;
25 import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.MinistryMenuItemFactory;
26 import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.MinistryRankingMenuItemFactory;
27 import com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand;
28 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.MinistryPageMode;
29 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
30 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
31 import com.vaadin.server.FontAwesome;
32 import com.vaadin.ui.GridLayout;
33 import com.vaadin.ui.MenuBar;
34 import com.vaadin.ui.MenuBar.MenuItem;
35 import com.vaadin.ui.VerticalLayout;
36
37
38
39
40 @Service
41 public final class MinistryMenuItemFactoryImpl extends AbstractMenuItemFactoryImpl implements MinistryMenuItemFactory {
42
43
44 private static final String GOVERNMENT_BODIES = "Government bodies";
45
46
47 private static final String MINISTRY_RANKING = "Ministry Ranking";
48
49
50 private static final String DOCUMENT_HISTORY_TEXT = "Document history";
51
52
53 private static final String INDICATORS_TEXT = "Indicators";
54
55
56 private static final String CHARTS_TEXT = "Charts";
57
58
59 private static final String ROLE_GHANT_TEXT = "RoleGhant";
60
61
62 private static final String MEMBER_HISTORY_TEXT = "Member History";
63
64
65 private static final String CURRENT_MEMBERS_TEXT = "Current Members";
66
67
68 private static final String ROLES_TEXT = "Roles";
69
70
71 private static final String DOCUMENTS_TEXT = "Documents";
72
73
74 private static final String DOCUMENT_ACTIVITY_TEXT = "Document Activity";
75
76
77 private static final String OVERVIEW_TEXT = "Overview";
78
79
80 private static final String PAGE_VISIT_HISTORY_TEXT = "Page Visit History";
81
82
83 @Autowired
84 private ApplicationMenuItemFactory applicationMenuItemFactory;
85
86
87 @Autowired
88 private MinistryRankingMenuItemFactory ministryRankingMenuItemFactory;
89
90
91
92
93 public MinistryMenuItemFactoryImpl() {
94 super();
95 }
96
97 @Override
98 public void createMinistryMenuBar(final MenuBar menuBar, final String pageId) {
99 initApplicationMenuBar(menuBar);
100
101 applicationMenuItemFactory.addRankingMenu(menuBar);
102
103 ministryRankingMenuItemFactory.createMinistryRankingTopics(menuBar.addItem(MINISTRY_RANKING, FontAwesome.GROUP,null));
104
105 final MenuItem ministryItem = menuBar.addItem("Ministry "+ pageId, FontAwesome.GROUP,null);
106
107
108 ministryItem.addItem(OVERVIEW_TEXT, FontAwesome.GROUP,
109 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.OVERVIEW, pageId));
110 ministryItem.addItem(CHARTS_TEXT, FontAwesome.GROUP,
111 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.CHARTS, pageId));
112 ministryItem.addItem(INDICATORS_TEXT, FontAwesome.GROUP,
113 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.INDICATORS, pageId));
114
115 final MenuItem rolesItem = ministryItem.addItem(ROLES_TEXT, FontAwesome.GROUP, null);
116
117 rolesItem.addItem(CURRENT_MEMBERS_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
118 MinistryPageMode.CURRENTMEMBERS.toString(), pageId));
119
120 rolesItem.addItem(MEMBER_HISTORY_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
121 MinistryPageMode.MEMBERHISTORY.toString(), pageId));
122
123 rolesItem.addItem(ROLE_GHANT_TEXT, FontAwesome.GROUP,
124 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.ROLEGHANT.toString(), pageId));
125
126 rolesItem.addItem(GOVERNMENT_BODIES, FontAwesome.GROUP,
127 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.GOVERNMENT_BODIES.toString(), pageId));
128
129
130
131 final MenuItem documentItem = ministryItem.addItem(DOCUMENTS_TEXT, FontAwesome.GROUP, null);
132
133 documentItem.addItem(DOCUMENT_ACTIVITY_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
134 MinistryPageMode.DOCUMENTACTIVITY.toString(), pageId));
135
136 documentItem.addItem(DOCUMENT_HISTORY_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
137 MinistryPageMode.DOCUMENTHISTORY.toString(), pageId));
138
139 ministryItem.addItem(PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP,
140 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.PAGEVISITHISTORY, pageId));
141
142 }
143
144 @Override
145 public void createOverviewPage(final VerticalLayout panelContent, final String pageId) {
146 final GridLayout grid = createGridLayout(panelContent);
147
148 createButtonLink(grid,OVERVIEW_TEXT, FontAwesome.GROUP,
149 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.OVERVIEW, pageId), "Default description");
150 createButtonLink(grid,CHARTS_TEXT, FontAwesome.GROUP,
151 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.CHARTS, pageId), "Default description");
152 createButtonLink(grid,INDICATORS_TEXT, FontAwesome.GROUP,
153 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.INDICATORS, pageId), "Default description");
154
155 createButtonLink(grid,CURRENT_MEMBERS_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
156 MinistryPageMode.CURRENTMEMBERS.toString(), pageId), "Default description");
157
158 createButtonLink(grid,MEMBER_HISTORY_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
159 MinistryPageMode.MEMBERHISTORY.toString(), pageId), "Default description");
160
161 createButtonLink(grid,ROLE_GHANT_TEXT, FontAwesome.GROUP,
162 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.ROLEGHANT.toString(), pageId), "Default description");
163
164 createButtonLink(grid,GOVERNMENT_BODIES, FontAwesome.GROUP,
165 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.GOVERNMENT_BODIES.toString(), pageId), "Default description");
166
167
168 createButtonLink(grid,DOCUMENT_ACTIVITY_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
169 MinistryPageMode.DOCUMENTACTIVITY.toString(), pageId), "Default description");
170
171 createButtonLink(grid,DOCUMENT_HISTORY_TEXT, FontAwesome.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME,
172 MinistryPageMode.DOCUMENTHISTORY.toString(), pageId), "Default description");
173
174 createButtonLink(grid,PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP,
175 new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.PAGEVISITHISTORY, pageId), "Default description");
176
177
178 }
179
180 }