Search in sources :

Example 1 with RiksdagenVoteDataBallotEmbeddedId_

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

the class BallotOverviewPageModContentFactoryImpl 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<ViewRiksdagenVoteDataBallotSummary, RiksdagenVoteDataBallotEmbeddedId> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenVoteDataBallotSummary.class);
    final DataContainer<ViewRiksdagenVoteDataBallotPartySummary, RiksdagenVoteDataBallotPartyEmbeddedId> dataPartyContainer = getApplicationManager().getDataContainer(ViewRiksdagenVoteDataBallotPartySummary.class);
    final DataContainer<ViewRiksdagenCommitteeBallotDecisionSummary, ViewRiksdagenCommitteeBallotDecisionEmbeddedId> dataDecisionContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommitteeBallotDecisionSummary.class);
    final List<ViewRiksdagenVoteDataBallotSummary> ballots = dataContainer.findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotSummary.class, ViewRiksdagenVoteDataBallotSummary_.embeddedId, RiksdagenVoteDataBallotEmbeddedId.class, RiksdagenVoteDataBallotEmbeddedId_.ballotId, pageId);
    final List<ViewRiksdagenVoteDataBallotPartySummary> partyBallotList = dataPartyContainer.findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotPartySummary.class, ViewRiksdagenVoteDataBallotPartySummary_.embeddedId, RiksdagenVoteDataBallotPartyEmbeddedId.class, RiksdagenVoteDataBallotPartyEmbeddedId_.ballotId, pageId);
    final List<ViewRiksdagenCommitteeBallotDecisionSummary> decisionSummaries = dataDecisionContainer.getAllBy(ViewRiksdagenCommitteeBallotDecisionSummary_.ballotId, pageId);
    if (!ballots.isEmpty()) {
        getBallotMenuItemFactory().createBallotMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, OVERVIEW);
        for (final ViewRiksdagenVoteDataBallotSummary viewRiksdagenVoteDataBallotSummary : ballots) {
            if (!decisionSummaries.isEmpty()) {
                getFormFactory().addFormPanelTextFields(panelContent, decisionSummaries.get(FIRST_OBJECT), ViewRiksdagenCommitteeBallotDecisionSummary.class, AS_LIST);
            } else {
                getFormFactory().addFormPanelTextFields(panelContent, viewRiksdagenVoteDataBallotSummary, ViewRiksdagenVoteDataBallotSummary.class, AS_LIST2);
            }
        }
        getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenVoteDataBallotPartySummary.class, partyBallotList, PARTY_BALLOT_SUMMARY, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, EMBEDDED_ID_PARTY, null);
        final VerticalLayout overviewLayout = new VerticalLayout();
        overviewLayout.setSizeFull();
        panelContent.addComponent(overviewLayout);
        panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);
        getBallotMenuItemFactory().createOverviewPage(overviewLayout, pageId);
        panel.setCaption(NAME + "::" + BALLOT + pageId);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_BALLOT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : RiksdagenVoteDataBallotPartyEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotPartyEmbeddedId) ViewRiksdagenVoteDataBallotPartySummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary) ViewRiksdagenCommitteeBallotDecisionEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionEmbeddedId) ViewRiksdagenCommitteeBallotDecisionSummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionSummary) ViewRiksdagenVoteDataBallotSummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary) VerticalLayout(com.vaadin.ui.VerticalLayout) RiksdagenVoteDataBallotEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId) Secured(org.springframework.security.access.annotation.Secured)

Example 2 with RiksdagenVoteDataBallotEmbeddedId_

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

the class BallotChartsPageModContentFactoryImpl 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<ViewRiksdagenVoteDataBallotSummary, RiksdagenVoteDataBallotEmbeddedId> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenVoteDataBallotSummary.class);
    final DataContainer<ViewRiksdagenVoteDataBallotPartySummary, RiksdagenVoteDataBallotPartyEmbeddedId> dataPartyContainer = getApplicationManager().getDataContainer(ViewRiksdagenVoteDataBallotPartySummary.class);
    final List<ViewRiksdagenVoteDataBallotSummary> ballots = dataContainer.findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotSummary.class, ViewRiksdagenVoteDataBallotSummary_.embeddedId, RiksdagenVoteDataBallotEmbeddedId.class, RiksdagenVoteDataBallotEmbeddedId_.ballotId, pageId);
    final List<ViewRiksdagenVoteDataBallotPartySummary> partyBallotList = dataPartyContainer.findListByEmbeddedProperty(ViewRiksdagenVoteDataBallotPartySummary.class, ViewRiksdagenVoteDataBallotPartySummary_.embeddedId, RiksdagenVoteDataBallotPartyEmbeddedId.class, RiksdagenVoteDataBallotPartyEmbeddedId_.ballotId, pageId);
    if (!ballots.isEmpty()) {
        getBallotMenuItemFactory().createBallotMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, CHARTS);
        final TabSheet tabsheet = new TabSheet();
        tabsheet.setWidth(100, Unit.PERCENTAGE);
        tabsheet.setHeight(100, Unit.PERCENTAGE);
        panelContent.addComponent(tabsheet);
        panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);
        Collections.sort(ballots, (Comparator<ViewRiksdagenVoteDataBallotSummary>) (o1, o2) -> (o1.getEmbeddedId().getIssue() + o2.getEmbeddedId().getConcern()).compareTo(o1.getEmbeddedId().getIssue() + o2.getEmbeddedId().getConcern()));
        for (final ViewRiksdagenVoteDataBallotSummary viewRiksdagenVoteDataBallotSummary : ballots) {
            final HorizontalLayout tabContent = new HorizontalLayout();
            tabContent.setWidth(100, Unit.PERCENTAGE);
            tabContent.setHeight(100, Unit.PERCENTAGE);
            final Tab tab = tabsheet.addTab(tabContent);
            ballotChartDataManager.createChart(tab, tabContent, viewRiksdagenVoteDataBallotSummary);
        }
        final Map<String, List<ViewRiksdagenVoteDataBallotPartySummary>> concernIssuePartyBallotSummaryMap = createIssueConcernMap(partyBallotList);
        for (final List<ViewRiksdagenVoteDataBallotPartySummary> partyBallotSummaryList : concernIssuePartyBallotSummaryMap.values()) {
            final HorizontalLayout tabContent = new HorizontalLayout();
            tabContent.setWidth(100, Unit.PERCENTAGE);
            tabContent.setHeight(100, Unit.PERCENTAGE);
            final Tab tab = tabsheet.addTab(tabContent);
            ballotChartDataManager.createChart(tab, tabContent, partyBallotSummaryList);
        }
        panel.setCaption(new StringBuilder().append(NAME).append("::").append(BALLOT).append(pageId).toString());
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_BALLOT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : RiksdagenVoteDataBallotPartyEmbeddedId_(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotPartyEmbeddedId_) PageMode(com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode) Panel(com.vaadin.ui.Panel) ApplicationEventGroup(com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup) VerticalLayout(com.vaadin.ui.VerticalLayout) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Secured(org.springframework.security.access.annotation.Secured) ViewRiksdagenVoteDataBallotSummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary) ViewRiksdagenVoteDataBallotPartySummary_(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary_) ViewAction(com.hack23.cia.web.impl.ui.application.action.ViewAction) Map(java.util.Map) ViewRiksdagenVoteDataBallotSummary_(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary_) BallotChartDataManager(com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.BallotChartDataManager) ContentRatio(com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio) Tab(com.vaadin.ui.TabSheet.Tab) MenuBar(com.vaadin.ui.MenuBar) RiksdagenVoteDataBallotEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId) RiksdagenVoteDataBallotPartyEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotPartyEmbeddedId) LabelFactory(com.hack23.cia.web.impl.ui.application.views.common.labelfactory.LabelFactory) DataContainer(com.hack23.cia.service.api.DataContainer) List(java.util.List) Component(org.springframework.stereotype.Component) Layout(com.vaadin.ui.Layout) HorizontalLayout(com.vaadin.ui.HorizontalLayout) TabSheet(com.vaadin.ui.TabSheet) RiksdagenVoteDataBallotEmbeddedId_(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId_) Comparator(java.util.Comparator) ViewRiksdagenVoteDataBallotPartySummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary) Unit(com.vaadin.server.Sizeable.Unit) Collections(java.util.Collections) RiksdagenVoteDataBallotPartyEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotPartyEmbeddedId) ViewRiksdagenVoteDataBallotPartySummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary) HorizontalLayout(com.vaadin.ui.HorizontalLayout) Tab(com.vaadin.ui.TabSheet.Tab) ViewRiksdagenVoteDataBallotSummary(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary) TabSheet(com.vaadin.ui.TabSheet) VerticalLayout(com.vaadin.ui.VerticalLayout) ArrayList(java.util.ArrayList) List(java.util.List) RiksdagenVoteDataBallotEmbeddedId(com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

RiksdagenVoteDataBallotEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId)2 RiksdagenVoteDataBallotPartyEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotPartyEmbeddedId)2 ViewRiksdagenVoteDataBallotPartySummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary)2 ViewRiksdagenVoteDataBallotSummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 Secured (org.springframework.security.access.annotation.Secured)2 RiksdagenVoteDataBallotEmbeddedId_ (com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotEmbeddedId_)1 RiksdagenVoteDataBallotPartyEmbeddedId_ (com.hack23.cia.model.internal.application.data.committee.impl.RiksdagenVoteDataBallotPartyEmbeddedId_)1 ViewRiksdagenCommitteeBallotDecisionEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionEmbeddedId)1 ViewRiksdagenCommitteeBallotDecisionSummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionSummary)1 ViewRiksdagenVoteDataBallotPartySummary_ (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummary_)1 ViewRiksdagenVoteDataBallotSummary_ (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotSummary_)1 ApplicationEventGroup (com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup)1 DataContainer (com.hack23.cia.service.api.DataContainer)1 ViewAction (com.hack23.cia.web.impl.ui.application.action.ViewAction)1 BallotChartDataManager (com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.BallotChartDataManager)1 LabelFactory (com.hack23.cia.web.impl.ui.application.views.common.labelfactory.LabelFactory)1 ContentRatio (com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio)1 PageMode (com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode)1 Unit (com.vaadin.server.Sizeable.Unit)1