Search in sources :

Example 1 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee 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;
}
Also used : ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId) VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenCommitteeBallotDecisionSummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionSummary) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

Example 2 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee 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;
}
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)

Example 3 with ViewRiksdagenCommittee

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

the class CommitteeDecisionSummaryPageModContentFactoryImpl 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, DECISION_SUMMARY);
        final DataContainer<ViewRiksdagenCommitteeDecisions, ViewRiksdagenCommitteeDecisionsEmbeddedId> committeeDecisionDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommitteeDecisions.class);
        final List<ViewRiksdagenCommitteeDecisions> decisionPartySummaryList = committeeDecisionDataContainer.findOrderedListByProperty(ViewRiksdagenCommitteeDecisions_.org, pageId, ViewRiksdagenCommitteeDecisions_.createdDate);
        getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenCommitteeDecisions.class, decisionPartySummaryList, 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;
}
Also used : ViewRiksdagenCommitteeDecisionsEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionsEmbeddedId) ViewRiksdagenCommitteeDecisions(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisions) VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

Example 4 with ViewRiksdagenCommittee

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

the class CommitteeDecisionTypeDailySummaryPageModContentFactoryImpl2 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, DECISION_TYPE_DAILY_SUMMARY);
        chartDataManager.createDecisionTypeChart(panelContent, viewRiksdagenCommittee.getEmbeddedId().getOrgCode());
        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) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

Example 5 with ViewRiksdagenCommittee

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

the class CommitteeDocumentActivityPageModContentFactoryImpl 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, DOCUMENT_ACTIVITY);
        chartDataManager.createDocumentHistoryChartByOrg(panelContent, viewRiksdagenCommittee.getEmbeddedId().getOrgCode());
        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) 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