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.user.goverment.pagemode;
20
21 import org.apache.commons.lang3.StringUtils;
22 import org.springframework.security.access.annotation.Secured;
23 import org.springframework.stereotype.Component;
24
25 import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup;
26 import com.hack23.cia.web.impl.ui.application.action.ViewAction;
27 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
28 import com.vaadin.ui.Layout;
29 import com.vaadin.ui.MenuBar;
30 import com.vaadin.ui.Panel;
31 import com.vaadin.ui.TextArea;
32 import com.vaadin.ui.VerticalLayout;
33
34
35
36
37 @Component
38 public final class MinistryRankingOverviewPageModContentFactoryImpl extends AbstractMinistryRankingPageModContentFactoryImpl {
39
40
41 private static final String OVERVIEW = "overview";
42
43
44 private static final String MINISTRY_RANKING_BY_TOPIC = "Ministry Ranking by topic";
45
46
47 private static final String MINISTRY_RANKING_BY_TOPIC_DESCRIPTION = "Time served in Ministry:ALL:CURRENT:"
48 + "\nPoliticans served in Committee:ALL:CURRENT:"
49 + "\nTop document author NR:ALL:YEAR:CURRENT:*FILTER:DocumnetType"
50 + "\nTop document author SIZE:YEAR:ALL:CURRENT:*FILTER:DocumnetType"
51
52 + "\nTop decisions NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart"
53 + "\nTop Votes NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart"
54
55 + "\nTop vote winner NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart"
56 + "\nSearch by name";
57
58
59
60
61
62
63 public MinistryRankingOverviewPageModContentFactoryImpl() {
64 super();
65 }
66
67 @Override
68 public boolean matches(final String page, final String parameters) {
69 return NAME.equals(page) && (StringUtils.isEmpty(parameters) || parameters.contains(PageMode.OVERVIEW.toString()));
70 }
71
72 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
73 @Override
74 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
75 final VerticalLayout panelContent = createPanelContent();
76
77 getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);
78
79 final String pageId = getPageId(parameters);
80
81 panelContent.addComponent(createDescription());
82
83 getMinistryRankingMenuItemFactory().createOverviewPage(panelContent);
84
85 panel.setCaption(OVERVIEW + parameters);
86
87 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW, ApplicationEventGroup.USER, NAME,
88 parameters, pageId);
89
90 return panelContent;
91
92 }
93
94
95
96
97
98
99
100 private static TextArea createDescription() {
101 final TextArea totalCommitteeRankinglistLabel = new TextArea(MINISTRY_RANKING_BY_TOPIC,
102 MINISTRY_RANKING_BY_TOPIC_DESCRIPTION);
103 totalCommitteeRankinglistLabel.setSizeFull();
104 totalCommitteeRankinglistLabel.setStyleName("Level2Header");
105 return totalCommitteeRankinglistLabel;
106 }
107
108
109 }