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.beans.factory.annotation.Autowired;
23 import org.springframework.security.access.annotation.Secured;
24 import org.springframework.stereotype.Component;
25
26 import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup;
27 import com.hack23.cia.web.impl.ui.application.action.ViewAction;
28 import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.GovernmentBodyChartDataManager;
29 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.MinistryPageMode;
30 import com.vaadin.ui.Layout;
31 import com.vaadin.ui.MenuBar;
32 import com.vaadin.ui.Panel;
33 import com.vaadin.ui.VerticalLayout;
34
35
36
37
38 @Component
39 public final class MinistryRankingGovernmentBodiesPageModContentFactoryImpl extends AbstractMinistryRankingPageModContentFactoryImpl {
40
41
42 private static final String GOVERNMENT_BODIES = "Government body";
43
44 @Autowired
45 private GovernmentBodyChartDataManager governmentBodyChartDataManager;
46
47
48
49
50
51 public MinistryRankingGovernmentBodiesPageModContentFactoryImpl() {
52 super();
53 }
54
55 @Override
56 public boolean matches(final String page, final String parameters) {
57 return NAME.equals(page) && (!StringUtils.isEmpty(parameters) && parameters.contains(MinistryPageMode.GOVERNMENT_BODIES.toString()));
58 }
59
60 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
61 @Override
62 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
63 final VerticalLayout panelContent = createPanelContent();
64
65 getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);
66
67 final String pageId = getPageId(parameters);
68
69
70 panel.setCaption(GOVERNMENT_BODIES + parameters);
71
72 governmentBodyChartDataManager.createMinistryGovernmentBodyHeadcountSummaryChart(panelContent);
73
74 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW, ApplicationEventGroup.USER, NAME,
75 parameters, pageId);
76
77 return panelContent;
78
79 }
80
81
82
83
84 }