Search in sources :

Example 1 with ViewRiksdagenCommitteeBallotDecisionSummary

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

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

Aggregations

ViewRiksdagenCommitteeBallotDecisionSummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionSummary)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 ViewRiksdagenCommittee (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee)1 ViewRiksdagenCommitteeBallotDecisionEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionEmbeddedId)1 ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId)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