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.politician.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.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
29 import com.vaadin.ui.Layout;
30 import com.vaadin.ui.MenuBar;
31 import com.vaadin.ui.Panel;
32 import com.vaadin.ui.TextArea;
33 import com.vaadin.ui.VerticalLayout;
34
35
36
37
38 @Component
39 public final class PoliticianRankingOverviewPageModContentFactoryImpl
40 extends AbstractPoliticianRankingPageModContentFactoryImpl {
41
42
43 public static final String NAME = UserViews.POLITICIAN_RANKING_VIEW_NAME;
44
45
46 private static final String OVERVIEW = "overview";
47
48
49
50
51
52 public PoliticianRankingOverviewPageModContentFactoryImpl() {
53 super();
54 }
55
56 @Override
57 public boolean matches(final String page, final String parameters) {
58 return NAME.equals(page) && (StringUtils.isEmpty(parameters) || parameters.contains(PageMode.OVERVIEW.toString()));
59 }
60
61 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
62 @Override
63 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
64 final VerticalLayout panelContent = createPanelContent();
65
66 getPoliticianRankingMenuItemFactory().createPoliticianRankingMenuBar(menuBar);
67
68 final String pageId = getPageId(parameters);
69
70 panelContent.addComponent(createDescription());
71
72 getPoliticianRankingMenuItemFactory().createOverviewPage(panelContent);
73
74 panel.setCaption(OVERVIEW + parameters);
75
76 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_POLITICIAN_RANKING_VIEW, ApplicationEventGroup.USER,
77 NAME, parameters, pageId);
78
79 return panelContent;
80
81 }
82
83
84
85
86
87
88 private static TextArea createDescription() {
89 final TextArea totalpoliticantoplistLabel = new TextArea("Politician Ranking by topic",
90 "Time served in Parliament:ALL:CURRENT:*FILTER:Gender,Party,ElectionRegion"
91 + "\nTime served in Committees:ALL:CURRENT:*FILTER:Gender,Party,ElectionRegion"
92 + "\nTime served in Government:ALL:CURRENT:*FILTER:Gender,Party,ElectionRegion"
93 + "\nTop document author NR:ALL:YEAR:CURRENT:*FILTER:DocumnetType,Gender,Party,ElectionRegion"
94 + "\nTop document author SIZE:YEAR:ALL:CURRENT:*FILTER:DocumnetType,Gender,Party,ElectionRegion"
95
96 + "\nTop votes:ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion"
97 + "\nTop vote winner NR/PERCENTAGE :ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion"
98 + "\nTop vote party rebel NR/PERCENTAGE :ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion"
99 + "\nTop vote presence NR/PERCENTAGE :ALL:YEAR:CURRENT::*FILTER:Gender,Party,ElectionRegion"
100 + "\nSearch by name");
101 totalpoliticantoplistLabel.setSizeFull();
102 totalpoliticantoplistLabel.setStyleName("Level2Header");
103 return totalpoliticantoplistLabel;
104 }
105
106 }