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.PartyRankingMenuItemFactory;
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.PageMode;
29 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
30 import com.vaadin.server.FontAwesome;
31 import com.vaadin.ui.GridLayout;
32 import com.vaadin.ui.MenuBar;
33 import com.vaadin.ui.MenuBar.MenuItem;
34 import com.vaadin.ui.VerticalLayout;
35
36
37
38
39 @Service
40 public final class PartyRankingMenuItemFactoryImpl extends AbstractMenuItemFactoryImpl implements PartyRankingMenuItemFactory {
41
42
43 private static final PageModeMenuCommand COMMAND_PAGEVISITHISTORY = new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.PAGEVISITHISTORY);
44
45
46 private static final PageModeMenuCommand COMMAND_CHARTS_ALL_PARTIES = new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS,ChartIndicators.ALLPARTIES.toString());
47
48
49 private static final PageModeMenuCommand COMMAND_CHARTS_CURRENT_COMMITTEES = new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS,ChartIndicators.CURRENTCOMMITTEES.toString());
50
51
52 private static final PageModeMenuCommand COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES = new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS,ChartIndicators.CURRENTGOVERMENTPARTIES.toString());
53
54
55 private static final PageModeMenuCommand COMMAND_CHARTS_CURRENT_PARTIES = new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS,ChartIndicators.CURRENTPARTIES.toString());
56
57
58 private static final PageModeMenuCommand COMMAND_DATAGRID = new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.DATAGRID);
59
60
61 private static final PageModeMenuCommand COMMAND_OVERVIEW = new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.OVERVIEW);
62
63
64 private static final String PARTY_RANKING = "Party Ranking";
65
66
67 private static final String ALL_PARTIES_TOTAL_DAYS_SERVED_IN_PARLIAMENT = "All parties, total days served in parliament";
68
69
70 private static final String CURRENT_PARTIES_ACTIVE_IN_PARLIAMENT_HEAD_COUNT = "Current parties active in parliament, head count";
71
72
73
74
75
76 private static final String PARTY_BY_TOTAL_MEMBERS_BASED_ON_ROLES_IN_DEPARTMENTS_COMMITTEES_AND_PARLIAMENT = "Party by total members, based on roles in departments, committees and parliament";
77
78
79 private static final String TOTAL_MEMBERS = "Total members";
80
81
82 private static final String CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_HEAD_COUNT = "Current parties active in committees, head count";
83
84
85 private static final String CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_HEAD_COUNT_TEXT = "Current parties active in ministries, head count";
86
87
88 private static final String RANKING_LIST_BY_TOPIC_TEXT = "Ranking list by topic";
89
90
91 private static final String CHART_BY_TOPIC_TEXT = "Chart by topic";
92
93
94 private static final String OVERVIEW_TEXT = "Overview";
95
96
97 private static final String PAGE_VISIT_HISTORY_TEXT = "Page Visit History";
98
99
100 @Autowired
101 private ApplicationMenuItemFactory applicationMenuItemFactory;
102
103
104
105
106
107 public PartyRankingMenuItemFactoryImpl() {
108 super();
109 }
110
111
112 @Override
113 public void createPartyRankingMenuBar(final MenuBar menuBar) {
114 initApplicationMenuBar(menuBar);
115
116 applicationMenuItemFactory.addRankingMenu(menuBar);
117
118 createPartyRankingTopics(menuBar.addItem(PARTY_RANKING, FontAwesome.GROUP,null));
119
120 }
121
122
123 @Override
124 public void createPartyRankingTopics(final MenuItem partynMenuItem) {
125
126 partynMenuItem.addItem(OVERVIEW_TEXT, FontAwesome.GROUP,
127 COMMAND_OVERVIEW);
128
129 final MenuItem listByTopic = partynMenuItem.addItem(RANKING_LIST_BY_TOPIC_TEXT, FontAwesome.GROUP, null);
130
131 final MenuItem listItem = listByTopic.addItem(TOTAL_MEMBERS,FontAwesome.GROUP,
132 COMMAND_DATAGRID);
133 listItem.setDescription(PARTY_BY_TOTAL_MEMBERS_BASED_ON_ROLES_IN_DEPARTMENTS_COMMITTEES_AND_PARLIAMENT);
134
135 final MenuItem chartByTopic = partynMenuItem.addItem(CHART_BY_TOPIC_TEXT, FontAwesome.GROUP, null);
136
137
138 chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_HEAD_COUNT_TEXT,FontAwesome.GROUP,
139 COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES);
140
141 chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_HEAD_COUNT,FontAwesome.GROUP,
142 COMMAND_CHARTS_CURRENT_COMMITTEES);
143
144 chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_PARLIAMENT_HEAD_COUNT,FontAwesome.GROUP,
145 COMMAND_CHARTS_CURRENT_PARTIES);
146 chartByTopic.addItem(ALL_PARTIES_TOTAL_DAYS_SERVED_IN_PARLIAMENT,FontAwesome.GROUP,
147 COMMAND_CHARTS_ALL_PARTIES);
148
149 partynMenuItem.addItem(PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP,
150 COMMAND_PAGEVISITHISTORY);
151 }
152
153
154 @Override
155 public void createOverviewPage(final VerticalLayout panelContent) {
156 final GridLayout grid = createGridLayout(panelContent);
157
158 createButtonLink(grid,TOTAL_MEMBERS,FontAwesome.GROUP,
159 COMMAND_DATAGRID, "Default description");
160 createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_HEAD_COUNT_TEXT,FontAwesome.GROUP,
161 COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES, "Default description");
162
163 createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_HEAD_COUNT,FontAwesome.GROUP,
164 COMMAND_CHARTS_CURRENT_COMMITTEES, "Default description");
165 createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_PARLIAMENT_HEAD_COUNT,FontAwesome.GROUP,
166 COMMAND_CHARTS_CURRENT_PARTIES, "Default description");
167 createButtonLink(grid,ALL_PARTIES_TOTAL_DAYS_SERVED_IN_PARLIAMENT,FontAwesome.GROUP,
168 COMMAND_CHARTS_ALL_PARTIES, "Default description");
169
170 createButtonLink(grid,PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP,
171 COMMAND_PAGEVISITHISTORY, "Default description");
172
173 }
174
175
176 }