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.Service;
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.ChartDataManager;
29 import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.MinistryDataSeriesFactory;
30 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators;
31 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
32 import com.vaadin.ui.HorizontalLayout;
33 import com.vaadin.ui.Layout;
34 import com.vaadin.ui.MenuBar;
35 import com.vaadin.ui.Panel;
36 import com.vaadin.ui.VerticalLayout;
37
38
39
40
41 @Service
42 public final class MinistryRankingCurrentMinistriesChartsPageModContentFactoryImpl extends AbstractMinistryRankingPageModContentFactoryImpl {
43
44
45 private static final String CHARTS = "Charts: Current Ministies, by headcount";
46
47
48 @Autowired
49 private ChartDataManager chartDataManager;
50
51
52 @Autowired
53 private MinistryDataSeriesFactory dataSeriesFactory;
54
55
56
57
58
59 public MinistryRankingCurrentMinistriesChartsPageModContentFactoryImpl() {
60 super();
61 }
62
63 @Override
64 public boolean matches(final String page, final String parameters) {
65 return NAME.equals(page) && !StringUtils.isEmpty(parameters) && parameters.contains(PageMode.CHARTS.toString())
66 && parameters.contains(ChartIndicators.CURRENTMINISTRIESBYHEADCOUNT.toString());
67 }
68
69 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
70 @Override
71 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
72 final VerticalLayout panelContent = createPanelContent();
73
74 getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);
75
76 final String pageId = getPageId(parameters);
77
78
79 final HorizontalLayout chartLayout = new HorizontalLayout();
80 chartLayout.setSizeFull();
81
82 chartDataManager.createChartPanel(chartLayout,dataSeriesFactory.createMinistryChartTimeSeriesCurrent(),
83 "Current Ministies, by headcount");
84 panelContent.addComponent(chartLayout);
85
86 panel.setCaption(CHARTS + parameters);
87
88 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW, ApplicationEventGroup.USER, NAME,
89 parameters, pageId);
90
91 return panelContent;
92
93 }
94
95
96
97
98 }