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.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.PartyDataSeriesFactory;
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.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
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 PoliticianRankingChartsCurrentPartiesPageModContentFactoryImpl
43 extends AbstractPoliticianRankingPageModContentFactoryImpl {
44
45
46 public static final String NAME = UserViews.POLITICIAN_RANKING_VIEW_NAME;
47
48
49 private static final String CHARTS = "Charts:Current parties";
50
51
52 @Autowired
53 private ChartDataManager chartDataManager;
54
55
56 @Autowired
57 private PartyDataSeriesFactory dataSeriesFactory;
58
59
60
61
62
63 public PoliticianRankingChartsCurrentPartiesPageModContentFactoryImpl() {
64 super();
65 }
66
67 @Override
68 public boolean matches(final String page, final String parameters) {
69 return NAME.equals(page)
70 && (!StringUtils.isEmpty(parameters) && parameters.contains(PageMode.CHARTS.toString()) && parameters.contains(ChartIndicators.CURRENTPARTIES.toString()));
71 }
72
73 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
74 @Override
75 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
76 final VerticalLayout panelContent = createPanelContent();
77
78 final String pageId = getPageId(parameters);
79
80 getPoliticianRankingMenuItemFactory().createPoliticianRankingMenuBar(menuBar);
81
82 chartDataManager
83 .createChartPanel(panelContent,dataSeriesFactory.createPartyChartTimeSeriesCurrent(), "Current");
84
85 panel.setCaption(CHARTS);
86
87 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_POLITICIAN_RANKING_VIEW, ApplicationEventGroup.USER,
88 NAME, parameters, pageId);
89
90 return panelContent;
91
92 }
93
94 }