use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class AdminLanguageContentPageModContentFactoryImpl 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_CONTENT);
final DataContainer<LanguageContentData, Long> dataContainer = getApplicationManager().getDataContainer(LanguageContentData.class);
final List<LanguageContentData> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, LanguageContentData_.toLanguage);
createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
getGridFactory().createBasicBeanItemGrid(content, LanguageContentData.class, pageOrderBy, LANGUAGE_CONTENT_DATA, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
if (pageId != null && !pageId.isEmpty()) {
final LanguageContentData languageContentData = dataContainer.load(Long.valueOf(pageId));
if (languageContentData != null) {
getFormFactory().addFormPanelTextFields(content, languageContentData, LanguageContentData.class, AS_LIST);
}
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_LANGUAGE_CONTENT_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
return content;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class AdminPortalPageModContentFactoryImpl 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_PORTAL);
final DataContainer<Portal, Long> dataContainer = getApplicationManager().getDataContainer(Portal.class);
final List<Portal> pageOrderBy = dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, Portal_.portalName);
createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
getGridFactory().createBasicBeanItemGrid(content, Portal.class, pageOrderBy, PORTAL2, COLUMN_ORDER, HIDE_COLUMNS, new PageItemPropertyClickListener(AdminViews.ADMIN_PORTAL_VIEW_NAME, "hjid"), null, null);
if (pageId != null && !pageId.isEmpty()) {
final Portal portal = dataContainer.load(Long.valueOf(pageId));
if (portal != null) {
getFormFactory().addFormPanelTextFields(content, portal, Portal.class, AS_LIST);
}
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_PORTAL_VIEW, ApplicationEventGroup.ADMIN, NAME, null, pageId);
return content;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class CommitteeDataSeriesFactoryImpl method createChartTimeSeriesTotalDaysServedCommitteeByParty.
@Override
public DataSeries createChartTimeSeriesTotalDaysServedCommitteeByParty() {
DataSeries dataSeries = new DataSeries();
final DataContainer<ViewRiksdagenParty, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenParty.class);
final DataContainer<ViewRiksdagenPartySummary, String> partySummarydataContainer = applicationManager.getDataContainer(ViewRiksdagenPartySummary.class);
partySummarydataContainer.getAll();
for (final ViewRiksdagenParty data : dataContainer.getAll()) {
final ViewRiksdagenPartySummary summary = partySummarydataContainer.load(data.getPartyId());
if (summary != null && summary.isActive()) {
dataSeries = dataSeries.newSeries().add(data.getPartyName(), summary.getTotalDaysServedCommittee());
}
}
return dataSeries;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class CommitteeBallotDecisionSummaryPageModContentFactoryImpl 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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommittee.class);
final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId);
if (viewRiksdagenCommittee != null) {
getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, BALLOT_DECISION_SUMMARY);
final DataContainer<ViewRiksdagenCommitteeBallotDecisionSummary, ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId> committeeBallotDecisionPartyDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommitteeBallotDecisionSummary.class);
final List<ViewRiksdagenCommitteeBallotDecisionSummary> decisionPartySummaryList = committeeBallotDecisionPartyDataContainer.findOrderedListByProperty(ViewRiksdagenCommitteeBallotDecisionSummary_.org, pageId.toUpperCase(Locale.ENGLISH), ViewRiksdagenCommitteeBallotDecisionSummary_.createdDate);
getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenCommitteeBallotDecisionSummary.class, decisionPartySummaryList, COMMITTEE_BALLOT_DECISION_SUMMARY, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, BALLOT_ID, null);
panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail());
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
}
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class CommitteeDecisionFlowPageModContentFactoryImpl 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);
getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId);
final DataContainer<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommittee.class);
final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId);
if (viewRiksdagenCommittee != null) {
String selectedYear = "2017/18";
if (parameters != null && parameters.contains("[") && parameters.contains("]")) {
selectedYear = parameters.substring(parameters.indexOf('[') + 1, parameters.lastIndexOf(']'));
}
ComboBox<String> comboBox = new ComboBox<>("Select year", Collections.unmodifiableList(Arrays.asList("2017/18", "2016/17", "2015/16", "2014/15", "2013/14", "2012/13", "2011/12", "2010/11")));
panelContent.addComponent(comboBox);
panelContent.setExpandRatio(comboBox, ContentRatio.SMALL2);
comboBox.setSelectedItem(selectedYear);
comboBox.addValueChangeListener(event -> {
if (!event.getSource().isEmpty()) {
UI.getCurrent().getNavigator().navigateTo(NAME + "/" + PageMode.CHARTS.toString() + "/" + ChartIndicators.DECISION_FLOW_CHART.toString() + "/" + pageId + "[" + event.getValue() + "]");
}
});
final Map<String, List<ViewRiksdagenCommittee>> committeeMap = dataContainer.getAll().stream().collect(Collectors.groupingBy(c -> c.getEmbeddedId().getOrgCode().toUpperCase(Locale.ENGLISH)));
SankeyChart chart = decisionFlowChartManager.createCommitteeDecisionFlow(viewRiksdagenCommittee, committeeMap, comboBox.getSelectedItem().orElse(selectedYear));
panelContent.addComponent(chart);
panelContent.setExpandRatio(chart, ContentRatio.LARGE);
}
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
panel.setCaption(new StringBuilder().append(NAME).append("::").append(COMMITTEE_DECISION_FLOW).toString());
return panelContent;
}
Aggregations