use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class MinistryGovernmentBodiesModContentFactoryImpl method createContent.
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout panelContent = createPanelContent();
final String pageId = getPageId(parameters);
final DataContainer<ViewRiksdagenMinistry, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenMinistry.class);
final ViewRiksdagenMinistry viewRiksdagenMinistry = dataContainer.load(pageId);
if (viewRiksdagenMinistry != null) {
getMinistryMenuItemFactory().createMinistryMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, GOVERNMENT_BODIES);
governmentBodyChartDataManager.createMinistryGovernmentBodyHeadcountSummaryChart(panelContent, viewRiksdagenMinistry.getNameId());
panel.setCaption(NAME + "::" + MINISTRY + viewRiksdagenMinistry.getNameId());
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
}
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class AdminAgencyPageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout content = createPanelContent();
final String pageId = getPageId(parameters);
final int pageNr = getPageNr(parameters);
getMenuItemFactory().createMainPageMenuBar(menuBar);
LabelFactory.createHeader2Label(content, ADMIN_AGENCY);
final DataContainer<Agency, Long> dataContainer = getApplicationManager().getDataContainer(Agency.class);
final List<Agency> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, Agency_.agencyName);
createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
getGridFactory().createBasicBeanItemGrid(content, Agency.class, pageOrderBy, AGENCY, AGENCY_GRID_COLUMN_ORDER, AGENCY_GRID_HIDE_COLUMNS, AGENCY_GRID_LISTENER, null, AGENCY_GRID_COLLECTION_PROPERTY_CONVERTERS);
if (pageId != null && !pageId.isEmpty()) {
final VerticalLayout leftLayout = new VerticalLayout();
leftLayout.setSizeFull();
final VerticalLayout rightLayout = new VerticalLayout();
rightLayout.setSizeFull();
final HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setWidth(ContentSize.FULL_SIZE);
content.addComponent(horizontalLayout);
content.setExpandRatio(horizontalLayout, ContentRatio.LARGE_FORM);
horizontalLayout.addComponent(leftLayout);
horizontalLayout.addComponent(rightLayout);
final Agency agency = dataContainer.load(Long.valueOf(pageId));
if (agency != null) {
getFormFactory().addFormPanelTextFields(leftLayout, agency, Agency.class, AGENCY_FORM_FIELDS);
getGridFactory().createBasicBeanItemGrid(rightLayout, Portal.class, agency.getPortals(), PORTAL, PORTAL_GRID_COLUMN_ORDER, PORTAL_GRID_HIDE_COLUMNS, PORTAL_GRID_LISTENER, null, null);
}
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_AGENCY_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
return content;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class AdminLanguagePageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout content = createPanelContent();
final String pageId = getPageId(parameters);
final int pageNr = getPageNr(parameters);
getMenuItemFactory().createMainPageMenuBar(menuBar);
LabelFactory.createHeader2Label(content, ADMIN_LANGUAGE);
final DataContainer<LanguageData, Long> dataContainer = getApplicationManager().getDataContainer(LanguageData.class);
final List<LanguageData> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, LanguageData_.languageName);
createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
getGridFactory().createBasicBeanItemGrid(content, LanguageData.class, pageOrderBy, LANGUAGE_DATA, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
if (pageId != null && !pageId.isEmpty()) {
final LanguageData languageData = dataContainer.load(Long.valueOf(pageId));
if (languageData != null) {
getFormFactory().addFormPanelTextFields(content, languageData, LanguageData.class, AS_LIST);
}
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_LANGUAGE_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
return content;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class DataSummaryOverviewPageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout content = createPanelContent();
getMenuItemFactory().createMainPageMenuBar(menuBar);
LabelFactory.createHeader2Label(content, ADMIN_DATA_SUMMARY);
final HorizontalLayout horizontalLayout = new HorizontalLayout();
horizontalLayout.setSizeFull();
content.addComponent(horizontalLayout);
content.setExpandRatio(horizontalLayout, ContentRatio.LARGE);
final DataContainer<DataSummary, String> dataContainer = getApplicationManager().getDataContainer(DataSummary.class);
final List<DataSummary> all = dataContainer.getAll();
if (!all.isEmpty()) {
final DataSummary dataSummary = all.get(0);
getFormFactory().addFormPanelTextFields(horizontalLayout, dataSummary, DataSummary.class, DATASUMMARY_FORM_FIELDS);
}
final VerticalLayout overviewLayout = new VerticalLayout();
overviewLayout.setSizeFull();
content.addComponent(overviewLayout);
content.setExpandRatio(overviewLayout, ContentRatio.LARGE);
final ResponsiveRow grid = createGridLayout(overviewLayout);
final Button refreshViewsButton = new Button(REFRESH_VIEWS, VaadinIcons.REFRESH);
refreshViewsButton.addClickListener(new RefreshDataViewsClickListener());
createRowItem(grid, refreshViewsButton, REFRESH_ALL_VIEWS);
final Button updateSearchIndexButton = new Button(UPDATE_SEARCH_INDEX, VaadinIcons.REFRESH);
updateSearchIndexButton.addClickListener(new UpdateSearchIndexClickListener());
createRowItem(grid, updateSearchIndexButton, UPDATE_DOCUMENT_SEARCH_INDEX);
final Button removeDataButton = new Button(REMOVE_POLITICIANS, VaadinIcons.DEL);
removeDataButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.POLITICIAN));
createRowItem(grid, removeDataButton, REMOVE_POLITICIANS);
final Button removeDocumentsButton = new Button(REMOVE_DOCUMENTS, VaadinIcons.DEL);
removeDocumentsButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.DOCUMENTS));
createRowItem(grid, removeDocumentsButton, REMOVE_DOCUMENTS);
final Button removeApplicationHistoryButton = new Button(REMOVE_APPLICATION_HISTORY, VaadinIcons.DEL);
removeApplicationHistoryButton.addClickListener(new RemoveDataClickListener(RemoveDataRequest.DataType.APPLICATION_HISTORY));
createRowItem(grid, removeApplicationHistoryButton, REMOVE_APPLICATION_HISTORY);
return content;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class PartyDocumentActivityPageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout panelContent = createPanelContent();
final String pageId = getPageId(parameters);
final DataContainer<ViewRiksdagenParty, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenParty.class);
final ViewRiksdagenParty viewRiksdagenParty = dataContainer.load(pageId);
if (viewRiksdagenParty != null) {
getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, DOCUMENT_ACTIVITY);
documentChartDataManager.createDocumentHistoryPartyChart(panelContent, pageId);
pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
}
return panelContent;
}
Aggregations