use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class PoliticianIndicatorsPageModContentFactoryImpl 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<PersonData, String> dataContainer = getApplicationManager().getDataContainer(PersonData.class);
final PersonData personData = dataContainer.load(pageId);
if (personData != null) {
final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenPolitician.class);
final ViewRiksdagenPolitician viewRiksdagenPolitician = politicianDataContainer.load(personData.getId());
getPoliticianMenuItemFactory().createPoliticianMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, INDICATORS);
politicianChartDataManager.createPersonLineChart(panelContent, personData.getId());
pageCompleted(parameters, panel, pageId, viewRiksdagenPolitician);
}
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class MinistryRankingAllRolesChartsPageModContentFactoryImpl 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();
getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);
final String pageId = getPageId(parameters);
final HorizontalLayout chartLayout = new HorizontalLayout();
chartLayout.setSizeFull();
final DataContainer<ViewRiksdagenGovermentRoleMember, String> govermentRoleMemberDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenGovermentRoleMember.class);
final List<ViewRiksdagenGovermentRoleMember> allMembers = govermentRoleMemberDataContainer.getAll();
ministryGhantChartManager.createRoleGhant(panelContent, allMembers);
panel.setCaption(NAME + "::" + CHARTS + parameters);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class PartyRankingDataGridPageModContentFactoryImpl 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();
getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
final String pageId = getPageId(parameters);
final DataContainer<ViewRiksdagenPartySummary, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenPartySummary.class);
getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenPartySummary.class, dataContainer.getAllOrderBy(ViewRiksdagenPartySummary_.currentAssignments), PARTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
panel.setCaption(NAME + "::" + DATAGRID);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARTY_RANKING_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class PartyWonDailySummaryChartPageModContentFactoryImpl 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, PARTY_WON_DAILY_SUMMARY_CHART);
chartDataManager.createPartyLineChart(panelContent, pageId);
pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
}
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class ParliamentDecisionFlowPageModContentFactoryImpl 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();
getParliamentMenuItemFactory().createParliamentTopicMenu(menuBar);
String selectedYear = "2017/18";
if (parameters != null && parameters.contains("[") && parameters.contains("]")) {
selectedYear = parameters.substring(parameters.indexOf('[') + 1, parameters.lastIndexOf(']'));
}
final DataContainer<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommittee.class);
final List<ViewRiksdagenCommittee> allCommittess = dataContainer.getAll();
final Map<String, List<ViewRiksdagenCommittee>> committeeMap = allCommittess.stream().collect(Collectors.groupingBy(c -> c.getEmbeddedId().getOrgCode().toUpperCase(Locale.ENGLISH)));
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.SMALL);
comboBox.setSelectedItem(selectedYear);
comboBox.addValueChangeListener(event -> {
if (!event.getSource().isEmpty()) {
UI.getCurrent().getNavigator().navigateTo(NAME + "/" + PageMode.CHARTS.toString() + "/" + ChartIndicators.DECISION_FLOW_CHART.toString() + "[" + event.getValue() + "]");
}
});
SankeyChart chart = decisionFlowChartManager.createAllDecisionFlow(committeeMap, comboBox.getSelectedItem().orElse(selectedYear));
panelContent.addComponent(chart);
panelContent.setExpandRatio(chart, ContentRatio.LARGE);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARLIAMENT_RANKING_VIEW, ApplicationEventGroup.USER, NAME, parameters, selectedYear);
panel.setCaption(new StringBuilder().append(NAME).append("::").append(PARLIAMENT_DECISION_FLOW).toString());
return panelContent;
}
Aggregations