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