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.CommitteeRankingMenuItemFactory;
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 CommitteeRankingMenuItemFactoryImpl extends AbstractMenuItemFactoryImpl
41 implements CommitteeRankingMenuItemFactory {
42
43
44 private static final PageModeMenuCommand COMMAND_PAGEVISIT_HISTORY = new PageModeMenuCommand(UserViews.COMMITTEE_RANKING_VIEW_NAME,
45 PageMode.PAGEVISITHISTORY);
46
47
48 private static final PageModeMenuCommand COMMAND_ALL_COMMITTEES_BY_HEADCOUNT = new PageModeMenuCommand(UserViews.COMMITTEE_RANKING_VIEW_NAME,
49 PageMode.CHARTS,ChartIndicators.ALLCOMMITTEESBYHEADCOUNT.toString());
50
51
52 private static final PageModeMenuCommand COMMAND_COMMITTEES_BY_PARTY = new PageModeMenuCommand(UserViews.COMMITTEE_RANKING_VIEW_NAME,
53 PageMode.CHARTS,ChartIndicators.COMMITTEESBYPARTY.toString());
54
55
56 private static final PageModeMenuCommand COMMAND_CURRENT_COMMITTEES_BY_HEADCOUNT = new PageModeMenuCommand(UserViews.COMMITTEE_RANKING_VIEW_NAME,
57 PageMode.CHARTS,ChartIndicators.CURRENTCOMMITTEESBYHEADCOUNT.toString());
58
59
60 private static final PageModeMenuCommand COMMAND_CURRENT_COMMITTEES_BY_PARTY_HEADCOUNT = new PageModeMenuCommand(UserViews.COMMITTEE_RANKING_VIEW_NAME,
61 PageMode.CHARTS,ChartIndicators.CURRENTCOMMITTEESBYPARTYHEADCOUNT.toString());
62
63
64
65 private static final PageModeMenuCommand COMMAND_OVERVIEW = new PageModeMenuCommand(UserViews.COMMITTEE_RANKING_VIEW_NAME,
66 PageMode.OVERVIEW);
67
68
69 private static final PageModeMenuCommand COMMAND_DATAGRID = new PageModeMenuCommand(UserViews.COMMITTEE_RANKING_VIEW_NAME,
70 PageMode.DATAGRID);
71
72
73 private static final String ALL_COMMITTEES_TOTAL_MEMBERS = "All committees, total members";
74
75
76
77
78
79 private static final String CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_TOTAL_DAYS_SERVED_IN_COMMITTEES = "Current parties active in committees, total days served in committees";
80
81
82
83
84 private static final String CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_CURRENT_ASSIGNMENTS = "Current parties active in committees, current assignments";
85
86
87 private static final String CURRENT_AND_PAST_MEMBER_AND_SUMMARY_OF_POLTICIAL_DAYS = "Current and past member and summary of polticial days ";
88
89
90 private static final String CURRENT_COMMITTEES_CURRENT_MEMBERS_TEXT = "Current committees, current members";
91
92
93 private static final String POLITICAL_WORK_SUMMARY_TEXT = "Political Work Summary";
94
95
96 private static final String COMMITTEE_RANKING_TEXT = "Committee Ranking";
97
98
99 private static final String RANKING_LIST_BY_TOPIC_TEXT = "Ranking list by topic";
100
101
102 private static final String CHART_BY_TOPIC_TEXT = "Chart by topic";
103
104
105 private static final String OVERVIEW_TEXT = "Overview";
106
107
108 private static final String PAGE_VISIT_HISTORY_TEXT = "Page Visit History";
109
110
111 @Autowired
112 private ApplicationMenuItemFactory applicationMenuItemFactory;
113
114
115
116
117 public CommitteeRankingMenuItemFactoryImpl() {
118 super();
119 }
120
121
122
123
124
125
126
127 @Override
128 public void createCommitteeeRankingMenuBar(final MenuBar menuBar) {
129 initApplicationMenuBar(menuBar);
130
131 applicationMenuItemFactory.addRankingMenu(menuBar);
132
133 createCommitteeRankingTopics(menuBar.addItem(COMMITTEE_RANKING_TEXT, null, null));
134 }
135
136
137
138
139
140
141
142 @Override
143 public void createCommitteeRankingTopics(final MenuItem committeeMenuItem) {
144 committeeMenuItem.addItem(OVERVIEW_TEXT, FontAwesome.GROUP, COMMAND_OVERVIEW);
145
146 final MenuItem listByTopic = committeeMenuItem.addItem(RANKING_LIST_BY_TOPIC_TEXT, FontAwesome.GROUP, null);
147
148 final MenuItem listItem = listByTopic.addItem(POLITICAL_WORK_SUMMARY_TEXT,FontAwesome.GROUP, COMMAND_DATAGRID);
149 listItem.setDescription(CURRENT_AND_PAST_MEMBER_AND_SUMMARY_OF_POLTICIAL_DAYS);
150
151 final MenuItem chartByTopic = committeeMenuItem.addItem(CHART_BY_TOPIC_TEXT, FontAwesome.GROUP, null);
152
153
154 chartByTopic.addItem(CURRENT_COMMITTEES_CURRENT_MEMBERS_TEXT,FontAwesome.GROUP, COMMAND_CURRENT_COMMITTEES_BY_HEADCOUNT);
155 chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_CURRENT_ASSIGNMENTS,FontAwesome.GROUP, COMMAND_COMMITTEES_BY_PARTY);
156 chartByTopic.addItem(CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_TOTAL_DAYS_SERVED_IN_COMMITTEES,FontAwesome.GROUP, COMMAND_CURRENT_COMMITTEES_BY_PARTY_HEADCOUNT);
157
158 chartByTopic.addItem(ALL_COMMITTEES_TOTAL_MEMBERS,FontAwesome.GROUP, COMMAND_ALL_COMMITTEES_BY_HEADCOUNT);
159
160 committeeMenuItem.addItem(PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP, COMMAND_PAGEVISIT_HISTORY);
161
162 }
163
164
165
166
167
168
169
170 @Override
171 public void createOverviewPage(final VerticalLayout panelContent) {
172 final GridLayout grid = createGridLayout(panelContent);
173
174
175 createButtonLink(grid,POLITICAL_WORK_SUMMARY_TEXT,FontAwesome.GROUP, COMMAND_DATAGRID, "Default description");
176 createButtonLink(grid,CURRENT_COMMITTEES_CURRENT_MEMBERS_TEXT,FontAwesome.GROUP, COMMAND_CURRENT_COMMITTEES_BY_HEADCOUNT, "Default description");
177
178 createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_CURRENT_ASSIGNMENTS,FontAwesome.GROUP, COMMAND_COMMITTEES_BY_PARTY, "Default description");
179 createButtonLink(grid,CURRENT_PARTIES_ACTIVE_IN_COMMITTEES_TOTAL_DAYS_SERVED_IN_COMMITTEES,FontAwesome.GROUP, COMMAND_CURRENT_COMMITTEES_BY_PARTY_HEADCOUNT, "Default description");
180 createButtonLink(grid,ALL_COMMITTEES_TOTAL_MEMBERS,FontAwesome.GROUP, COMMAND_ALL_COMMITTEES_BY_HEADCOUNT, "Default description");
181
182 createButtonLink(grid,PAGE_VISIT_HISTORY_TEXT, FontAwesome.GROUP, COMMAND_PAGEVISIT_HISTORY, "Default description");
183
184 }
185
186
187 }