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.admin.datasummary.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.web.impl.ui.application.views.common.labelfactory.LabelFactory;
26 import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio;
27 import com.hack23.cia.web.impl.ui.application.views.common.tablefactory.TableFactory;
28 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.AdminViews;
29 import com.hack23.cia.web.impl.ui.application.views.pageclicklistener.RefreshDataViewsClickListener;
30 import com.hack23.cia.web.impl.ui.application.views.pageclicklistener.UpdateSearchIndexClickListener;
31 import com.vaadin.server.FontAwesome;
32 import com.vaadin.ui.Button;
33 import com.vaadin.ui.Layout;
34 import com.vaadin.ui.MenuBar;
35 import com.vaadin.ui.Panel;
36 import com.vaadin.ui.Table;
37 import com.vaadin.ui.VerticalLayout;
38
39
40
41
42 @Component
43 public final class DataSummaryOverviewPageModContentFactoryImpl extends AbstractDataSummaryPageModContentFactoryImpl {
44
45
46 public static final String NAME = AdminViews.ADMIN_DATA_SUMMARY_VIEW_NAME;
47
48
49 private static final String UPDATE_SEARCH_INDEX = "Update Search Index";
50
51
52 private static final String REFRESH_VIEWS = "Refresh Views";
53
54
55 private static final String ADMIN_DATA_SUMMARY = "Admin Data Summary";
56
57
58 @Autowired
59 private TableFactory tableFactory;
60
61
62
63
64 public DataSummaryOverviewPageModContentFactoryImpl() {
65 super();
66 }
67
68 @Override
69 public boolean matches(final String page, final String parameters) {
70 return NAME.equals(page);
71 }
72
73 @Secured({ "ROLE_ADMIN" })
74 @Override
75 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
76 final VerticalLayout content = createPanelContent();
77
78 getMenuItemFactory().createMainPageMenuBar(menuBar);
79
80 LabelFactory.createHeader2Label(content,ADMIN_DATA_SUMMARY);
81
82 final Table createDataSummaryTable = tableFactory.createDataSummaryTable();
83 content.addComponent(createDataSummaryTable);
84 content.setExpandRatio(createDataSummaryTable, ContentRatio.LARGE);
85
86 content.setSizeFull();
87 content.setMargin(false);
88 content.setSpacing(true);
89
90 final Button refreshViewsButton = new Button(REFRESH_VIEWS,FontAwesome.REFRESH);
91
92 refreshViewsButton.addClickListener(new RefreshDataViewsClickListener());
93
94 content.addComponent(refreshViewsButton);
95 content.setExpandRatio(refreshViewsButton, ContentRatio.SMALL);
96
97 final Button updateSearchIndexButton = new Button(UPDATE_SEARCH_INDEX,FontAwesome.REFRESH);
98
99 updateSearchIndexButton.addClickListener(new UpdateSearchIndexClickListener());
100
101 content.addComponent(updateSearchIndexButton);
102 content.setExpandRatio(updateSearchIndexButton, ContentRatio.SMALL);
103
104 return content;
105
106 }
107
108 }