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.MinistryRankingMenuItemFactory;
26 import com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand;
27 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators;
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 MinistryRankingMenuItemFactoryImpl extends AbstractMenuItemFactoryImpl
42 implements MinistryRankingMenuItemFactory {
43
44
45 private static final String GOVERNMENT_ROLES_CHART = "Government roles chart";
46
47
48 private static final PageModeMenuCommand COMMAND_PAGEVISITHISTORY = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
49 PageMode.PAGEVISITHISTORY);
50
51
52 private static final PageModeMenuCommand COMMAND_CHARTS_ALL_MINISTRIES_BY_HEADCOUNT = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
53 PageMode.CHARTS, ChartIndicators.ALLMINISTRIESBYHEADCOUNT.toString());
54
55
56 private static final PageModeMenuCommand COMMAND_CHARTS_ALLMINISTRIES_BY_TOTAL_DAYS = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
57 PageMode.CHARTS, ChartIndicators.ALLMINISTRIESPARTYBYTOTALDAYS.toString());
58
59
60 private static final PageModeMenuCommand COMMAND_CHARTS_CURRENT_MINISTRIES_BY_HEADCOUNT = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
61 PageMode.CHARTS, ChartIndicators.CURRENTMINISTRIESBYHEADCOUNT.toString());
62
63
64 private static final PageModeMenuCommand COMMAND_CHARTS_CURRENT_PARTIES_BY_HEADCOUNT = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
65 PageMode.CHARTS, ChartIndicators.CURRENTPARTIESBYHEADCOUNT.toString());
66
67
68 private static final PageModeMenuCommand COMMAND_CHARTS_ALL_GOVERNMENT_ROLE_GANTT = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
69 PageMode.CHARTS, ChartIndicators.ALL_GOVERNMENT_ROLE_CHART.toString());
70
71
72 private static final PageModeMenuCommand COMMAND_DATAGRID = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
73 PageMode.DATAGRID);
74
75
76 private static final PageModeMenuCommand COMMAN_OVERVIEW = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
77 PageMode.OVERVIEW);
78
79
80 private static final PageModeMenuCommand COMMAND_GOVERNMENT_BODIES = new PageModeMenuCommand(UserViews.MINISTRY_RANKING_VIEW_NAME,
81 MinistryPageMode.GOVERNMENT_BODIES.toString());
82
83
84 private static final String GOVERNMENT_BODIES = "Government bodies";
85
86
87 private static final String MINISTRY_RANKING = "Ministry Ranking";
88
89
90 private static final String ALL_MINISTRIES_TOTAL_MEMBERS_TEXT = "All ministries, total members";
91
92
93 private static final String ALL_PARTIES_TOTAL_DAYS_SERVED_IN_MINISTRIES_TEXT = "All parties, total days served in ministries";
94
95
96 private static final String CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_HEAD_COUNT_TEXT = "Current parties active in ministries, head count";
97
98
99 private static final String CURRENT_MINISTRIES_CURRENT_MEMBERS_TEXT = "Current ministries, current members";
100
101
102
103
104
105 private static final String CURRENT_AND_PAST_MEMBER_AND_SUMMARY_OF_TOTAL_POLTICIAL_DAYS_MEMBERSHIP_DESCRIPTION = "Current and past member and summary of total polticial days membership";
106
107
108 private static final String POLITICAL_WORK_SUMMARY_TEXT = "Political Work Summary";
109
110
111 private static final String RANKING_LIST_BY_TOPIC_TEXT = "Ranking list by topic";
112
113
114 private static final String CHART_BY_TOPIC_TEXT = "Chart by topic";
115
116
117 private static final String OVERVIEW_TEXT = "Overview";
118
119
120 private static final String PAGE_VISIT_HISTORY_TEXT = "Page Visit History";
121
122
123 @Autowired
124 private ApplicationMenuItemFactory applicationMenuItemFactory;
125
126
127
128
129 public MinistryRankingMenuItemFactoryImpl() {
130 super();
131 }
132
133 @Override
134 public void createMinistryRankingMenuBar(final MenuBar menuBar) {
135 initApplicationMenuBar(menuBar);
136
137 applicationMenuItemFactory.addRankingMenu(menuBar);
138
139 createMinistryRankingTopics(menuBar.addItem(MINISTRY_RANKING, null, null));
140
141 }
142
143 @Override
144 public void createMinistryRankingTopics(final MenuItem ministryMenuItem) {
145
146 ministryMenuItem.addItem(OVERVIEW_TEXT, FontAwesome.GROUP, COMMAN_OVERVIEW);
147
148 final MenuItem listByTopic = ministryMenuItem.addItem(RANKING_LIST_BY_TOPIC_TEXT, FontAwesome.GROUP, null);
149
150 final MenuItem listItem = listByTopic.addItem(POLITICAL_WORK_SUMMARY_TEXT, FontAwesome.GROUP, COMMAND_DATAGRID);
151 listItem.setDescription(CURRENT_AND_PAST_MEMBER_AND_SUMMARY_OF_TOTAL_POLTICIAL_DAYS_MEMBERSHIP_DESCRIPTION);
152
153 final MenuItem chartByTopic = ministryMenuItem.addItem(CHART_BY_TOPIC_TEXT, FontAwesome.GROUP, null);
154
155 chartByTopic.addItem(CURRENT_MINISTRIES_CURRENT_MEMBERS_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_CURRENT_MINISTRIES_BY_HEADCOUNT);
156 chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_HEAD_COUNT_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_CURRENT_PARTIES_BY_HEADCOUNT);
157
158 chartByTopic.addItem(ALL_PARTIES_TOTAL_DAYS_SERVED_IN_MINISTRIES_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_ALLMINISTRIES_BY_TOTAL_DAYS);
159 chartByTopic.addItem(ALL_MINISTRIES_TOTAL_MEMBERS_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_ALL_MINISTRIES_BY_HEADCOUNT);
160
161 chartByTopic.addItem(GOVERNMENT_BODIES, FontAwesome.GROUP, COMMAND_GOVERNMENT_BODIES);
162
163 chartByTopic.addItem(GOVERNMENT_ROLES_CHART, FontAwesome.GROUP, COMMAND_CHARTS_ALL_GOVERNMENT_ROLE_GANTT);
164
165 ministryMenuItem.addItem(PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP, COMMAND_PAGEVISITHISTORY);
166
167 }
168
169 @Override
170 public void createOverviewPage(final VerticalLayout panelContent) {
171 final GridLayout grid = createGridLayout(panelContent);
172
173 createButtonLink(grid, POLITICAL_WORK_SUMMARY_TEXT, FontAwesome.GROUP, COMMAND_DATAGRID, "Default description");
174
175 createButtonLink(grid, CURRENT_MINISTRIES_CURRENT_MEMBERS_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_CURRENT_MINISTRIES_BY_HEADCOUNT,
176 "Default description");
177 createButtonLink(grid, CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_HEAD_COUNT_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_CURRENT_PARTIES_BY_HEADCOUNT,
178 "Default description");
179
180 createButtonLink(grid, ALL_PARTIES_TOTAL_DAYS_SERVED_IN_MINISTRIES_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_ALLMINISTRIES_BY_TOTAL_DAYS,
181 "Default description");
182 createButtonLink(grid, ALL_MINISTRIES_TOTAL_MEMBERS_TEXT, FontAwesome.GROUP, COMMAND_CHARTS_ALL_MINISTRIES_BY_HEADCOUNT, "Default description");
183 createButtonLink(grid, GOVERNMENT_BODIES, FontAwesome.GROUP, COMMAND_GOVERNMENT_BODIES, "Default description");
184
185 createButtonLink(grid,GOVERNMENT_ROLES_CHART, FontAwesome.GROUP, COMMAND_CHARTS_ALL_GOVERNMENT_ROLE_GANTT, "Default description");
186
187 createButtonLink(grid, PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP, COMMAND_PAGEVISITHISTORY, "Default description");
188
189 }
190
191 }