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.springframework.beans.factory.annotation.Autowired;
22 import org.springframework.security.access.annotation.Secured;
23 import org.springframework.stereotype.Component;
24
25 import com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty;
26 import com.hack23.cia.service.api.DataContainer;
27 import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.PartyChartDataManager;
28 import com.hack23.cia.web.impl.ui.application.views.common.labelfactory.LabelFactory;
29 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PartyPageMode;
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 PartyWonDailySummaryChartPageModContentFactoryImpl extends AbstractPartyPageModContentFactoryImpl {
40
41
42 private static final String PARTY_WON_DAILY_SUMMARY_CHART = "PartyWonDailySummaryChart";
43
44
45 @Autowired
46 private PartyChartDataManager chartDataManager;
47
48
49
50
51
52 public PartyWonDailySummaryChartPageModContentFactoryImpl() {
53 super();
54 }
55
56 @Override
57 public boolean matches(final String page, final String parameters) {
58 return NAME.equals(page) && parameters.contains(PartyPageMode.PARTYWONDAILYSUMMARYCHART.toString());
59 }
60
61 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
62 @Override
63 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
64 final VerticalLayout panelContent = createPanelContent();
65
66 final String pageId = getPageId(parameters);
67
68 final DataContainer<ViewRiksdagenParty, String> dataContainer = getApplicationManager()
69 .getDataContainer(ViewRiksdagenParty.class);
70
71 final ViewRiksdagenParty viewRiksdagenParty = dataContainer
72 .load(pageId);
73
74 if (viewRiksdagenParty != null) {
75
76 getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);
77
78
79 LabelFactory.createHeader2Label(panelContent,PARTY_WON_DAILY_SUMMARY_CHART);
80
81 chartDataManager.createPartyLineChart(panelContent,pageId);
82
83 pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
84 }
85 return panelContent;
86
87 }
88
89
90 }