Search in sources :

Example 16 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee in project cia by Hack23.

the class CommitteeMemberHistoryPageModContentFactoryImpl 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, MEMBER_HISTORY);
        final DataContainer<ViewRiksdagenCommitteeRoleMember, String> committeeRoleMemberDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommitteeRoleMember.class);
        getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenCommitteeRoleMember.class, committeeRoleMemberDataContainer.getAllBy(ViewRiksdagenCommitteeRoleMember_.detail, viewRiksdagenCommittee.getEmbeddedId().getDetail()), MEMBER_HISTORY, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
        panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail());
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : ViewRiksdagenCommitteeRoleMember(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeRoleMember) VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

Example 17 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee in project cia by Hack23.

the class CommitteeOverviewPageModContentFactoryImpl 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, OVERVIEW);
        final Link addCommitteePageLink = getPageLinkFactory().addCommitteePageLink(viewRiksdagenCommittee);
        panelContent.addComponent(addCommitteePageLink);
        getFormFactory().addFormPanelTextFields(panelContent, viewRiksdagenCommittee, ViewRiksdagenCommittee.class, AS_LIST);
        final VerticalLayout overviewLayout = new VerticalLayout();
        overviewLayout.setSizeFull();
        panelContent.addComponent(overviewLayout);
        panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);
        getCommitteeMenuItemFactory().createOverviewPage(overviewLayout, pageId);
        panelContent.setExpandRatio(addCommitteePageLink, ContentRatio.SMALL);
        panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail());
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : VerticalLayout(com.vaadin.ui.VerticalLayout) Link(com.vaadin.ui.Link) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

Example 18 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee 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;
}
Also used : PageMode(com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode) Panel(com.vaadin.ui.Panel) Arrays(java.util.Arrays) ApplicationEventGroup(com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) Secured(org.springframework.security.access.annotation.Secured) SankeyChart(com.hack23.cia.web.widgets.charts.SankeyChart) ViewAction(com.hack23.cia.web.impl.ui.application.action.ViewAction) Locale(java.util.Locale) Map(java.util.Map) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) ContentRatio(com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio) MenuBar(com.vaadin.ui.MenuBar) Collectors(java.util.stream.Collectors) DecisionFlowChartManager(com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.DecisionFlowChartManager) DataContainer(com.hack23.cia.service.api.DataContainer) List(java.util.List) Component(org.springframework.stereotype.Component) ChartIndicators(com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators) Layout(com.vaadin.ui.Layout) Collections(java.util.Collections) SankeyChart(com.hack23.cia.web.widgets.charts.SankeyChart) ComboBox(com.vaadin.ui.ComboBox) VerticalLayout(com.vaadin.ui.VerticalLayout) List(java.util.List) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

ViewRiksdagenCommittee (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee)17 VerticalLayout (com.vaadin.ui.VerticalLayout)13 Secured (org.springframework.security.access.annotation.Secured)13 SankeyChart (com.hack23.cia.web.widgets.charts.SankeyChart)4 List (java.util.List)4 ViewRiksdagenCommitteeRoleMember (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeRoleMember)3 ApplicationEventGroup (com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup)2 DataContainer (com.hack23.cia.service.api.DataContainer)2 ViewAction (com.hack23.cia.web.impl.ui.application.action.ViewAction)2 DecisionFlowChartManager (com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.DecisionFlowChartManager)2 ProposalCommitteeeSummary (com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.ProposalCommitteeeSummary)2 ContentRatio (com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio)2 ChartIndicators (com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators)2 PageMode (com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode)2 ComboBox (com.vaadin.ui.ComboBox)2 Layout (com.vaadin.ui.Layout)2 MenuBar (com.vaadin.ui.MenuBar)2 Panel (com.vaadin.ui.Panel)2 UI (com.vaadin.ui.UI)2 Arrays (java.util.Arrays)2