Example usage for com.vaadin.ui HorizontalLayout HorizontalLayout

List of usage examples for com.vaadin.ui HorizontalLayout HorizontalLayout

Introduction

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

Prototype

public HorizontalLayout() 

Source Link

Document

Constructs an empty HorizontalLayout.

Usage

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

License:Apache License

/**
 * Adds the chart./*from   w  w w.  j  a  v a 2s.  c  o  m*/
 *
 * @param content
 *            the content
 * @param caption
 *            the caption
 * @param chart
 *            the chart
 */
protected final void addChart(final AbstractOrderedLayout content, final String caption, final DCharts chart) {
    final HorizontalLayout horizontalLayout = new HorizontalLayout();

    final int browserWindowWidth = Page.getCurrent().getBrowserWindowWidth() - 50;
    final int browserWindowHeight = Page.getCurrent().getBrowserWindowHeight() - 200;

    horizontalLayout.setWidth(browserWindowWidth, Unit.PIXELS);
    horizontalLayout.setHeight(browserWindowHeight, Unit.PIXELS);

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

    content.addComponent(formPanel);
    content.setExpandRatio(formPanel, ContentRatio.LARGE);

    chart.setWidth(browserWindowWidth - 50, Unit.PIXELS);
    chart.setHeight(browserWindowHeight - 100, Unit.PIXELS);
    chart.setMarginRight(5);
    chart.setMarginLeft(5);
    chart.setMarginBottom(5);
    chart.setMarginTop(5);

    chart.setEnableDownload(true);
    chart.setChartImageFormat(ChartImageFormat.PNG);

    horizontalLayout.addComponent(chart);
    chart.setCaption(caption);
}

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

License:Apache License

/**
 * Creates the page visit history.//from  w w w .  j av a  2s.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//  ww w.  j av a 2s.c  o  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.committee.pagemode.CommitteeRankingAllCommitteesChartsPageModContentFactoryImpl.java

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*ww  w .  j a v  a  2s .  c o m*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getCommitteeRankingMenuItemFactory().createCommitteeeRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout, dataSeriesFactory.createCommitteeChartTimeSeriesAll(),
            "All");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*from  w w w  .  j  av a2s  . c  o m*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getCommitteeRankingMenuItemFactory().createCommitteeeRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory.createChartTimeSeriesTotalDaysServedCommitteeByParty(),
            ALL_PARTIES_TOTAL_DAYS_SERVED);

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from w  w w. j a  v  a  2s .  c o  m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getCommitteeRankingMenuItemFactory().createCommitteeeRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory2.createChartTimeSeriesCurrentCommitteeByParty(), CURRENT_PARTIES_HEADCOUNT);

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*  ww w .  j  a va 2  s .c om*/
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getCommitteeRankingMenuItemFactory().createCommitteeeRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout, dataSeriesFactory.createCommitteeChartTimeSeriesCurrent(),
            "Current");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from   w  w  w .  jav a2s  .  c  o  m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout, dataSeriesFactory.createMinistryChartTimeSeriesAll(), "All");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//  ww w  . ja va2  s  .  c  om
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory.createChartTimeSeriesTotalDaysServedGovernmentByParty(),
            "All Parties, total days served");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//from  w w w.  j a  v a2s  .c o  m
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();

    getMinistryRankingMenuItemFactory().createMinistryRankingMenuBar(menuBar);

    final String pageId = getPageId(parameters);

    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    final DataContainer<ViewRiksdagenGovermentRoleMember, String> govermentRoleMemberDataContainer = getApplicationManager()
            .getDataContainer(ViewRiksdagenGovermentRoleMember.class);

    final List<ViewRiksdagenGovermentRoleMember> allMembers = govermentRoleMemberDataContainer.getAll();

    ministryGhantChartManager.createRoleGhant(panelContent, allMembers);

    panel.setCaption(CHARTS + parameters);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_RANKING_VIEW,
            ApplicationEventGroup.USER, NAME, parameters, pageId);

    return panelContent;

}