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.common.pagemode;
20
21 import org.apache.commons.lang3.StringUtils;
22 import org.springframework.security.access.annotation.Secured;
23 import org.springframework.stereotype.Component;
24
25 import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup;
26 import com.hack23.cia.web.impl.ui.application.action.ViewAction;
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.CommonsViews;
29 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
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 MainViewOverviewPageModContentFactoryImpl extends AbstractPageModContentFactoryImpl {
40
41
42 private static final String CITIZEN_INTELLIGENCE_AGENCY_MAIN = "Citizen Intelligence Agency::Main";
43
44
45 public static final String NAME = CommonsViews.MAIN_VIEW_NAME;
46
47
48
49
50 public MainViewOverviewPageModContentFactoryImpl() {
51 super();
52 }
53
54 @Override
55 public boolean matches(final String page, final String parameters) {
56 return NAME.equals(page)
57 && (StringUtils.isEmpty(parameters) || parameters.contains(PageMode.OVERVIEW.toString()));
58 }
59
60 @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
61 @Override
62 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
63 final VerticalLayout panelContent = createPanelContent();
64 final String pageId = getPageId(parameters);
65
66 panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN);
67
68 getMenuItemFactory().createMainPageMenuBar(menuBar);
69
70 LabelFactory.createHeader2Label(panelContent, "MainOverview");
71
72 getMenuItemFactory().createOverviewPage(panelContent);
73
74 panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN);
75 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER,
76 CommonsViews.MAIN_VIEW_NAME, parameters, pageId);
77
78 return panelContent;
79
80 }
81
82 }