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.springframework.security.access.annotation.Secured;
22 import org.springframework.stereotype.Component;
23
24 import com.hack23.cia.model.external.riksdagen.person.impl.PersonData;
25 import com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician;
26 import com.hack23.cia.service.api.DataContainer;
27 import com.hack23.cia.web.impl.ui.application.views.common.labelfactory.LabelFactory;
28 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
29 import com.vaadin.ui.Layout;
30 import com.vaadin.ui.MenuBar;
31 import com.vaadin.ui.Panel;
32 import com.vaadin.ui.VerticalLayout;
33
34
35
36
37 @Component
38 public final class PoliticianChartsPageModContentFactoryImpl extends AbstractPoliticianPageModContentFactoryImpl {
39
40
41 private static final String CHARTS_NOT_IMPLEMENTED = "Charts Not Implemented";
42
43
44
45
46
47 public PoliticianChartsPageModContentFactoryImpl() {
48 super();
49 }
50
51 @Override
52 public boolean matches(final String page, final String parameters) {
53 return NAME.equals(page) && parameters.contains(PageMode.CHARTS.toString());
54 }
55
56 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
57 @Override
58 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
59 final VerticalLayout panelContent = createPanelContent();
60
61 final String pageId = getPageId(parameters);
62
63 final DataContainer<PersonData, String> dataContainer = getApplicationManager()
64 .getDataContainer(PersonData.class);
65
66 final PersonData personData = dataContainer.load(pageId);
67 if (personData != null) {
68
69 final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager()
70 .getDataContainer(ViewRiksdagenPolitician.class);
71
72 final ViewRiksdagenPolitician viewRiksdagenPolitician = politicianDataContainer.load(personData.getId());
73
74 getPoliticianMenuItemFactory().createPoliticianMenuBar(menuBar, pageId);
75
76 LabelFactory.createHeader2Label(panelContent,CHARTS_NOT_IMPLEMENTED);
77
78 pageCompleted(parameters, panel, pageId, viewRiksdagenPolitician);
79
80 }
81 return panelContent;
82
83 }
84
85 }