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.menufactory.impl;
20
21 import org.springframework.stereotype.Service;
22
23 import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.BallotMenuItemFactory;
24 import com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand;
25 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
26 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
27 import com.vaadin.server.FontAwesome;
28 import com.vaadin.ui.GridLayout;
29 import com.vaadin.ui.MenuBar;
30 import com.vaadin.ui.VerticalLayout;
31
32
33
34
35 @Service
36 public final class BallotMenuItemFactoryImpl extends AbstractMenuItemFactoryImpl implements BallotMenuItemFactory {
37
38
39
40 private static final String INDICATORS_TEXT = "Indicators";
41
42
43 private static final String CHARTS_TEXT = "Charts";
44
45
46 private static final String OVERVIEW_TEXT = "Overview";
47
48
49
50
51
52 public BallotMenuItemFactoryImpl() {
53 super();
54 }
55
56 @Override
57 public void createBallotMenuBar(final MenuBar menuBar, final String pageId) {
58 initApplicationMenuBar(menuBar);
59
60 menuBar.addItem(OVERVIEW_TEXT, FontAwesome.PIE_CHART,
61 new PageModeMenuCommand(UserViews.BALLOT_VIEW_NAME, PageMode.OVERVIEW, pageId));
62 menuBar.addItem(CHARTS_TEXT, FontAwesome.PIE_CHART,
63 new PageModeMenuCommand(UserViews.BALLOT_VIEW_NAME, PageMode.CHARTS, pageId));
64 menuBar.addItem(INDICATORS_TEXT, FontAwesome.PIE_CHART,
65 new PageModeMenuCommand(UserViews.BALLOT_VIEW_NAME, PageMode.INDICATORS, pageId));
66
67 }
68
69 @Override
70 public void createOverviewPage(final VerticalLayout panelContent, final String pageId) {
71 final GridLayout grid = createGridLayout(panelContent);
72
73 createButtonLink(grid,CHARTS_TEXT, FontAwesome.PIE_CHART,
74 new PageModeMenuCommand(UserViews.BALLOT_VIEW_NAME, PageMode.CHARTS, pageId), "Default description");
75
76 createButtonLink(grid,INDICATORS_TEXT, FontAwesome.PIE_CHART,
77 new PageModeMenuCommand(UserViews.BALLOT_VIEW_NAME, PageMode.INDICATORS, pageId), "Default description");
78
79 }
80
81 }