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.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.HorizontalLayout;
34 import com.vaadin.ui.Layout;
35 import com.vaadin.ui.MenuBar;
36 import com.vaadin.ui.Panel;
37 import com.vaadin.ui.VerticalLayout;
38
39
40
41
42 @Service
43 public final class PartyRankingAllPartiesChartsPageModContentFactoryImpl extends AbstractPartyRankingPageModContentFactoryImpl {
44
45
46 private static final String CHARTS = "Charts:";
47
48
49 public static final String NAME = UserViews.PARTY_RANKING_VIEW_NAME;
50
51
52 @Autowired
53 private ChartDataManager chartDataManager;
54
55
56 @Autowired
57 private PartyDataSeriesFactory dataSeriesFactory;
58
59
60
61
62
63 public PartyRankingAllPartiesChartsPageModContentFactoryImpl() {
64 super();
65 }
66
67 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
68 @Override
69 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
70 final VerticalLayout panelContent = createPanelContent();
71
72 final String pageId = getPageId(parameters);
73
74
75 getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
76 final HorizontalLayout chartLayout = new HorizontalLayout();
77 chartLayout.setSizeFull();
78
79 chartDataManager.createChartPanel(chartLayout,dataSeriesFactory.createPartyChartTimeSeriesAll(),"All");
80
81 panelContent.addComponent(chartLayout);
82
83 panel.setCaption(CHARTS + parameters);
84
85 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARTY_RANKING_VIEW, ApplicationEventGroup.USER, NAME,
86 parameters, pageId);
87
88 return panelContent;
89
90 }
91
92 @Override
93 public boolean matches(final String page, final String parameters) {
94 return NAME.equals(page) && !StringUtils.isEmpty(parameters) && parameters.contains(PageMode.CHARTS.toString())
95 && parameters.contains(ChartIndicators.ALLPARTIES.toString());
96 }
97
98
99 }