Example usage for com.vaadin.ui VerticalLayout setExpandRatio

List of usage examples for com.vaadin.ui VerticalLayout setExpandRatio

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setExpandRatio.

Prototype

public void setExpandRatio(Component component, float ratio) 

Source Link

Document

This method is used to control how excess space in layout is distributed among components.

Usage

From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminAgencyPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override/*from www.j a  va 2 s .  com*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    final String pageId = getPageId(parameters);
    final int pageNr = getPageNr(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    LabelFactory.createHeader2Label(content, ADMIN_AGENCY);

    final DataContainer<Agency, Long> dataContainer = getApplicationManager().getDataContainer(Agency.class);

    final BeanItemContainer<Agency> politicianDocumentDataSource = new BeanItemContainer<>(Agency.class,
            dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, Agency_.agencyName));

    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);

    getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource, "Agency",
            new String[] { "hjid", "agencyName", "description", "portals", "modelObjectVersion" },
            new String[] { "hjid", "modelObjectId", "modelObjectVersion" },
            new PageItemPropertyClickListener(AdminViews.ADMIN_AGENCY_VIEW_NAME, "hjid"), null,
            new ListPropertyConverter[] { new ListPropertyConverter(List.class, "portalName", "portals") });

    if (pageId != null && !pageId.isEmpty()) {

        final VerticalLayout leftLayout = new VerticalLayout();
        leftLayout.setSizeFull();
        final VerticalLayout rightLayout = new VerticalLayout();
        rightLayout.setSizeFull();
        final HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setWidth(ContentSize.FULL_SIZE);
        content.addComponent(horizontalLayout);

        content.setExpandRatio(horizontalLayout, ContentRatio.LARGE_FORM);

        horizontalLayout.addComponent(leftLayout);
        horizontalLayout.addComponent(rightLayout);

        final Agency agency = dataContainer.load(Long.valueOf(pageId));
        agency.getPortals().getClass();
        if (agency != null) {

            getFormFactory().addFormPanelTextFields(leftLayout, new BeanItem<>(agency), Agency.class,
                    Arrays.asList(new String[] { "agencyName", "description" }));

            final BeanItemContainer<Portal> portalItemContainer = new BeanItemContainer<>(Portal.class,
                    agency.getPortals());

            getGridFactory().createBasicBeanItemGrid(rightLayout, portalItemContainer, "Portal",
                    new String[] { "hjid", "portalName", "description", "portalType", "googleMapApiKey",
                            "modelObjectVersion" },
                    new String[] { "hjid", "modelObjectId", "modelObjectVersion", "googleMapApiKey" },
                    new PageItemPropertyClickListener(AdminViews.ADMIN_PORTAL_VIEW_NAME, "hjid"), null, null);
        }

    }

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_AGENCY_VIEW, ApplicationEventGroup.ADMIN,
            NAME, null, pageId);

    return content;

}

From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminApplicationSessionPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override//from w  w  w .j a  va2  s .  c om
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    final String pageId = getPageId(parameters);
    final int pageNr = getPageNr(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    LabelFactory.createHeader2Label(content, ADMIN_APPLICATION_SESSION);

    final DataContainer<ApplicationSession, Long> dataContainer = getApplicationManager()
            .getDataContainer(ApplicationSession.class);

    final BeanItemContainer<ApplicationSession> politicianDocumentDataSource = new BeanItemContainer<>(
            ApplicationSession.class,
            dataContainer.getPageOrderBy(pageNr, DEFAULT_RESULTS_PER_PAGE, ApplicationSession_.createdDate));

    createPagingControls(content, NAME, pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);

    getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource, "ApplicationSession",
            new String[] { "hjid", "createdDate", "sessionType", "userId", "events", "operatingSystem",
                    "locale", "ipInformation", "userAgentInformation", "sessionId" },
            new String[] { "hjid", "modelObjectId", "modelObjectVersion", "userAgentInformation", "sessionId",
                    "ipInformation" },
            new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_SESSION_VIEW_NAME, "hjid"), null,
            new ListPropertyConverter[] {
                    new ListPropertyConverter(List.class, "page", "events", "actionName") });

    if (pageId != null && !pageId.isEmpty()) {

        final ApplicationSession applicationSession = dataContainer.load(Long.valueOf(pageId));

        if (applicationSession != null) {

            final VerticalLayout rightLayout = new VerticalLayout();
            rightLayout.setSizeFull();
            final HorizontalLayout horizontalLayout = new HorizontalLayout();
            horizontalLayout.setWidth(ContentSize.FULL_SIZE);
            content.addComponent(horizontalLayout);
            content.setExpandRatio(horizontalLayout, ContentRatio.GRID);

            getFormFactory().addFormPanelTextFields(horizontalLayout, new BeanItem<>(applicationSession),
                    ApplicationSession.class,
                    Arrays.asList(new String[] { "createdDate", "sessionType", "userId", "sessionId",
                            "operatingSystem", "locale", "ipInformation", "userAgentInformation" }));

            horizontalLayout.addComponent(rightLayout);
            horizontalLayout.setExpandRatio(rightLayout, ContentRatio.GRID);

            final BeanItemContainer<ApplicationActionEvent> eventsItemContainer = new BeanItemContainer<>(
                    ApplicationActionEvent.class, applicationSession.getEvents());

            getGridFactory().createBasicBeanItemGrid(rightLayout, eventsItemContainer, "ApplicationActionEvent",
                    new String[] { "hjid", "createdDate", "eventGroup", "actionName", "applicationOperation",
                            "page", "pageMode", "elementId", "errorMessage", "applicationMessage",
                            "modelObjectVersion" },
                    new String[] { "hjid", "modelObjectId", "modelObjectVersion", "userId", "sessionId" },
                    new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"),
                    null, null);
        }

    }

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_SESSION_VIEW,
            ApplicationEventGroup.ADMIN, NAME, null, pageId);

    return content;

}

From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.AdminMonitoringPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override//from   www  .  j  a  va2s  .  c  om
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    final String pageId = getPageId(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    final BrowserFrame browser = new BrowserFrame(ADMIN_MONITORING,
            new ExternalResource(MONITORING_CONTEXT_PATH));
    browser.setSizeFull();

    content.addComponent(browser);
    content.setExpandRatio(browser, ContentRatio.FULL_SIZE);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_MONITORING_VIEW,
            ApplicationEventGroup.ADMIN, NAME, null, pageId);

    return content;

}

From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.EmailPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ADMIN" })
@Override/*from   www .  ja v a 2  s.  c  om*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout content = createPanelContent();

    final String pageId = getPageId(parameters);

    getMenuItemFactory().createMainPageMenuBar(menuBar);

    LabelFactory.createHeader2Label(content, ADMIN_EMAIL);

    final VerticalLayout emailLayout = new VerticalLayout();
    emailLayout.setSizeFull();

    final Panel formPanel = new Panel();
    formPanel.setSizeFull();

    emailLayout.addComponent(formPanel);

    final FormLayout formContent = new FormLayout();
    formPanel.setContent(formContent);

    final SendEmailRequest sendEmailRequest = new SendEmailRequest();
    sendEmailRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
    sendEmailRequest.setEmail("");
    sendEmailRequest.setSubject("");
    sendEmailRequest.setContent("");
    final ClickListener sendEmailListener = new SendEmailClickListener(sendEmailRequest,
            getApplicationManager());
    getFormFactory().addRequestInputFormFields(formContent, new BeanItem<>(sendEmailRequest),
            SendEmailRequest.class, Arrays.asList(new String[] { "email", "subject", "content" }), "Email",
            sendEmailListener);

    content.addComponent(emailLayout);
    content.setExpandRatio(emailLayout, ContentRatio.LARGE_FORM);

    panel.setCaption("Admin email");
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_EMAIL_VIEW, ApplicationEventGroup.ADMIN,
            NAME, null, pageId);

    return content;

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.AbstractView.java

License:Apache License

/**
 * Creates the basic layout with panel and footer.
 *
 * @param panelName/*from ww w.j  a  v  a 2 s  . co m*/
 *            the panel name
 */
protected final void createBasicLayoutWithPanelAndFooter(final String panelName) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setHeight(100, Unit.PERCENTAGE);

    final VerticalLayout pageModeContent = new VerticalLayout();
    pageModeContent.setMargin(true);
    pageModeContent.setSpacing(true);
    pageModeContent.setWidth(100, Unit.PERCENTAGE);
    pageModeContent.setHeight(100, Unit.PERCENTAGE);

    layout.addComponent(pageModeContent);

    final ThemeResource ciaLogoResource = new ThemeResource("cia-logo.png");

    final Image ciaLogoImage = new Image(null, ciaLogoResource);

    final HorizontalLayout topHeader = new HorizontalLayout();

    topHeader.addComponent(ciaLogoImage);
    ciaLogoImage.setWidth("75px");
    ciaLogoImage.setHeight("75px");
    topHeader.setComponentAlignment(ciaLogoImage, Alignment.MIDDLE_LEFT);
    topHeader.setExpandRatio(ciaLogoImage, ContentRatio.SMALL);

    final HorizontalLayout topTitleHeadertPanel = new HorizontalLayout();

    final Label titleLabel = new Label("Citizen Intelligence Agency");
    titleLabel.setStyleName("Header");
    topTitleHeadertPanel.addComponent(titleLabel);
    topTitleHeadertPanel.setComponentAlignment(titleLabel, Alignment.MIDDLE_LEFT);

    final Label sloganLabel = new Label("// Tracking politicians like bugs!");
    sloganLabel.setStyleName("HeaderSlogan");
    topTitleHeadertPanel.addComponent(sloganLabel);
    topTitleHeadertPanel.setComponentAlignment(sloganLabel, Alignment.MIDDLE_RIGHT);

    topHeader.addComponent(topTitleHeadertPanel);
    topHeader.setComponentAlignment(topTitleHeadertPanel, Alignment.MIDDLE_LEFT);
    topHeader.setExpandRatio(topTitleHeadertPanel, ContentRatio.GRID);

    topHeaderRightPanel.removeAllComponents();
    topHeader.addComponent(topHeaderRightPanel);
    topHeader.setComponentAlignment(topHeaderRightPanel, Alignment.MIDDLE_RIGHT);
    topHeader.setExpandRatio(topHeaderRightPanel, ContentRatio.LARGE);

    if (UserContextUtil.allowRoleInSecurityContext(ROLE_ADMIN)
            || UserContextUtil.allowRoleInSecurityContext(ROLE_USER)) {

        final Link userHomePageLink = pageLinkFactory.createUserHomeViewPageLink();
        topHeaderRightPanel.addComponent(userHomePageLink);
        topHeaderRightPanel.setComponentAlignment(userHomePageLink, Alignment.MIDDLE_RIGHT);

        final Button logoutButton = new Button(LOGOUT, FontAwesome.SIGN_OUT);

        final LogoutRequest logoutRequest = new LogoutRequest();
        logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
        logoutButton.addClickListener(new LogoutClickListener(logoutRequest, applicationManager));

        topHeaderRightPanel.addComponent(logoutButton);
        topHeaderRightPanel.setComponentAlignment(logoutButton, Alignment.MIDDLE_RIGHT);

    } else {
        final Link createRegisterPageLink = pageLinkFactory.createRegisterPageLink();
        topHeaderRightPanel.addComponent(createRegisterPageLink);
        topHeaderRightPanel.setComponentAlignment(createRegisterPageLink, Alignment.MIDDLE_RIGHT);

        final Link createLoginPageLink = pageLinkFactory.createLoginPageLink();
        topHeaderRightPanel.addComponent(createLoginPageLink);
        topHeaderRightPanel.setComponentAlignment(createLoginPageLink, Alignment.MIDDLE_RIGHT);
    }

    topHeaderRightPanel.setWidth("100%");
    topHeaderRightPanel.setHeight("60px");

    topHeader.setWidth("100%");
    topHeader.setHeight("60px");

    pageModeContent.addComponent(topHeader);
    pageModeContent.setComponentAlignment(topHeader, Alignment.TOP_CENTER);

    pageModeContent.addComponent(getBarmenu());
    pageModeContent.setComponentAlignment(getBarmenu(), Alignment.TOP_CENTER);

    panel = new Panel(panelName);

    panel.setSizeFull();
    pageModeContent.addComponent(panel);
    pageModeContent.setExpandRatio(panel, ContentRatio.FULL_SIZE);

    pageModeContent.addComponent(pageLinkFactory.createMainViewPageLink());
    setContent(layout);

    setWidth(100, Unit.PERCENTAGE);
    setHeight(100, Unit.PERCENTAGE);
    setSizeFull();

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.chartfactory.impl.AbstractGhantChartManagerImpl.java

License:Apache License

/**
 * Creates the role ghant.//  w w w.  j  a v  a2s.  com
 *
 * @param roleSummaryLayoutTabsheet
 *            the role summary layout tabsheet
 * @param assignmentList
 *            the assignment list
 */
public final void createRoleGhant(final VerticalLayout roleSummaryLayoutTabsheet,
        final List<T> assignmentList) {

    final Comparator<T> compare = getComparator();

    final List<T> list = assignmentList.stream().filter(
            x -> new DateTime(getStepMapping().getFromDate(x).getTime()).getYear() > FILTER_DATA_BEFORE_YEAR)
            .collect(Collectors.toList());

    Collections.sort(list, compare);

    final Gantt createGantt = createGenericGantt(list, getRoleMapping(), getStepMapping());
    roleSummaryLayoutTabsheet.addComponent(createGantt);
    roleSummaryLayoutTabsheet.setExpandRatio(createGantt, ContentRatio.GRID);

}

From source file:com.hack23.cia.web.impl.ui.application.views.common.menufactory.impl.AbstractMenuItemFactoryImpl.java

License:Apache License

protected final GridLayout createGridLayout(final VerticalLayout panelContent) {
    final GridLayout grid = new GridLayout(2, 1);
    grid.setWidth(100, Unit.PERCENTAGE);
    grid.setHeight(100, Unit.PERCENTAGE);
    grid.setColumnExpandRatio(0, 1);/*from w w  w.jav a 2s  . c  o  m*/
    grid.setColumnExpandRatio(1, 1);
    grid.setSpacing(true);
    panelContent.addComponent(grid);
    panelContent.setExpandRatio(grid, ContentRatio.LARGE);
    return grid;
}

From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.AbstractPageModContentFactoryImpl.java

License:Apache License

/**
 * Creates the page visit history./*  ww  w.  j a  v a 2  s  . c  o  m*/
 *
 * @param pageName
 *            the page name
 * @param pageId
 *            the page id
 * @param panelContent
 *            the panel content
 */
protected final void createPageVisitHistory(final String pageName, final String pageId,
        final VerticalLayout panelContent) {

    final TabSheet tabsheet = new TabSheet();
    tabsheet.setWidth(100, Unit.PERCENTAGE);
    tabsheet.setHeight(100, Unit.PERCENTAGE);

    panelContent.addComponent(tabsheet);
    panelContent.setExpandRatio(tabsheet, ContentRatio.LARGE);

    final HorizontalLayout tabContentPageItemRankHistory = new HorizontalLayout();
    tabContentPageItemRankHistory.setWidth(100, Unit.PERCENTAGE);
    tabContentPageItemRankHistory.setHeight(100, Unit.PERCENTAGE);
    final Tab tabPageItemRankHistory = tabsheet.addTab(tabContentPageItemRankHistory);

    tabPageItemRankHistory.setCaption(CURRENT_PAGE_VISIT_HISTORY);
    adminChartDataManager.createApplicationActionEventPageElementDailySummaryChart(
            tabContentPageItemRankHistory, pageName, pageId);

    final HorizontalLayout tabContentPageModeSummary = new HorizontalLayout();
    tabContentPageModeSummary.setWidth(100, Unit.PERCENTAGE);
    tabContentPageModeSummary.setHeight(100, Unit.PERCENTAGE);
    final Tab tabPageModeSummary = tabsheet.addTab(tabContentPageModeSummary);
    tabPageModeSummary.setCaption(GENERAL_PAGE_MODE_PAGE_VISIT);

    adminChartDataManager.createApplicationActionEventPageModeDailySummaryChart(tabContentPageModeSummary,
            pageName);

}

From source file:com.hack23.cia.web.impl.ui.application.views.user.ballot.pagemode.BallotChartsPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*w  w w .j  a  va 2s.  co  m*/
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(BALLOT + pageId);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_BALLOT_VIEW, ApplicationEventGroup.USER,
                NAME, parameters, pageId);
    }
    return panelContent;

}

From source file:com.hack23.cia.web.impl.ui.application.views.user.ballot.pagemode.BallotOverviewPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from  w  w  w.j av a 2  s  . co  m
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);

        final VerticalLayout overviewLayout = new VerticalLayout();
        overviewLayout.setSizeFull();

        panelContent.addComponent(overviewLayout);
        panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

        getBallotMenuItemFactory().createOverviewPage(overviewLayout, pageId);

        for (final ViewRiksdagenVoteDataBallotSummary viewRiksdagenVoteDataBallotSummary : ballots) {

            if (!decisionSummaries.isEmpty()) {

                getFormFactory().addFormPanelTextFields(panelContent,
                        new BeanItem<>(decisionSummaries.get(FIRST_OBJECT)),
                        ViewRiksdagenCommitteeBallotDecisionSummary.class,
                        Arrays.asList(new String[] { "embeddedId.id", "ballotId", "rm", "voteDate", "org",
                                "committeeReport", "embeddedId.issue", "title", "subTitle", "decisionType",
                                "embeddedId.concern", "ballotType", "winner", "totalVotes", "yesVotes",
                                "noVotes", "abstainVotes", "absentVotes", "approved", "endNumber",
                                "againstProposalParties", "againstProposalNumber" }));

            } else {

                getFormFactory().addFormPanelTextFields(panelContent,
                        new BeanItem<>(viewRiksdagenVoteDataBallotSummary),
                        ViewRiksdagenVoteDataBallotSummary.class,
                        Arrays.asList(new String[] { "embeddedId.ballotId", "rm", "voteDate",
                                "embeddedId.issue", "embeddedId.concern", "ballotType", "label", "totalVotes",
                                "yesVotes", "noVotes", "abstainVotes", "absentVotes", "approved" }));
            }

        }

        final BeanItemContainer<ViewRiksdagenVoteDataBallotPartySummary> partyBallotDataSource = new BeanItemContainer<>(
                ViewRiksdagenVoteDataBallotPartySummary.class, partyBallotList);

        getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, partyBallotDataSource,
                "Party Ballot Summary",
                new String[] { "embeddedId.ballotId", "embeddedId.concern", "embeddedId.issue",
                        "embeddedId.party" },
                new String[] { "embeddedId.party", "voteDate", "rm", "label", "embeddedId.concern",
                        "embeddedId.issue", "approved", "partyApproved", "totalVotes", "partyTotalVotes",
                        "yesVotes", "partyYesVotes", "noVotes", "partyNoVotes", "partyAbstainVotes",
                        "abstainVotes", "partyAbsentVotes", "absentVotes", "partyAvgBornYear", "avgBornYear",
                        "partyPercentageMale", "percentageMale", "ballotType", "embeddedId.ballotId" },
                new String[] { "embeddedId", "partyNoWinner", "partyPercentageYes", "partyPercentageNo",
                        "partyPercentageAbsent", "partyPercentageAbstain", "percentageYes", "percentageNo",
                        "percentageAbsent", "percentageAbstain", "voteDate", "rm", "label",
                        "embeddedId.concern", "totalVotes", "approved", "yesVotes", "noVotes", "ballotType",
                        "abstainVotes", "absentVotes", "embeddedId.ballotId", "noWinner" },
                new PageItemPropertyClickListener(UserViews.PARTY_VIEW_NAME, "embeddedId.party"),
                "embeddedId.party", null);

        panel.setCaption(BALLOT + pageId);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_BALLOT_VIEW, ApplicationEventGroup.USER,
                NAME, parameters, pageId);
    }
    return panelContent;

}