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.party.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 PartyRankingOverviewPageModContentFactoryImpl extends AbstractPartyRankingPageModContentFactoryImpl {
40
41
42 public static final String NAME = UserViews.PARTY_RANKING_VIEW_NAME;
43
44
45 private static final String OVERVIEW = "overview";
46
47
48
49
50
51 public PartyRankingOverviewPageModContentFactoryImpl() {
52 super();
53 }
54
55 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
56 @Override
57 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
58 final VerticalLayout panelContent = createPanelContent();
59
60 getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
61
62 final String pageId = getPageId(parameters);
63
64 panelContent.addComponent(createDescription());
65
66 getPartyRankingMenuItemFactory().createOverviewPage(panelContent);
67
68 panel.setCaption(OVERVIEW + parameters);
69
70 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARTY_RANKING_VIEW, ApplicationEventGroup.USER, NAME,
71 parameters, pageId);
72
73 return panelContent;
74
75 }
76
77
78
79
80
81
82 private static TextArea createDescription() {
83 final TextArea totalpartytoplistLabel = new TextArea(
84 "Party Ranking by topic",
85 "Time served in Parliament:ALL:CURRENT:"
86 + "\nTime served in Committees:ALL:CURRENT:"
87 + "\nTime served in Government:ALL:CURRENT:"
88 + "\nTop document author NR:ALL:YEAR:CURRENT:*FILTER:DocumnetType"
89 + "\nTop document author SIZE:YEAR:ALL:CURRENT:*FILTER:DocumnetType"
90
91 + "\nTop votes NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart"
92 + "\nTop vote winner NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart"
93 + "\nTop vote party rebel NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart"
94 + "\nTop vote presence NR/PERCENTAGE :ALL:YEAR:CURRENT::#Views:List,Timeline,BarChart,PieChart"
95 + "\nSearch by name");
96 totalpartytoplistLabel.setSizeFull();
97 totalpartytoplistLabel.setStyleName("Level2Header");
98 return totalpartytoplistLabel;
99 }
100
101
102 @Override
103 public boolean matches(final String page, final String parameters) {
104 return NAME.equals(page) && (StringUtils.isEmpty(parameters) || parameters.contains(PageMode.OVERVIEW.toString()));
105 }
106
107
108 }