Example usage for com.vaadin.ui VerticalLayout addComponent

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

Introduction

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

Prototype

@Override
public void addComponent(Component c) 

Source Link

Document

Add a component into this container.

Usage

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override//  www. j  a v  a 2  s.  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.createChartTimeSeriesCurrentGovernmentByParty(), "Current Parties, headcount");

    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.MinistryRankingOverviewPageModContentFactoryImpl.java

License:Apache License

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

    panelContent.addComponent(createDescription());

    getMinistryRankingMenuItemFactory().createOverviewPage(panelContent);

    panel.setCaption(OVERVIEW + 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.home.pagemode.UserHomeOverviewPageModContentFactoryImpl.java

License:Apache License

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

    final String pageId = getPageId(parameters);

    userHomeMenuItemFactory.createUserHomeMenuBar(menuBar, pageId);

    LabelFactory.createHeader2Label(panelContent, OVERVIEW);

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

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

    panelContent.addComponent(logoutButton);

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

    final Long userIdFromSecurityContext = UserContextUtil.getUserInternalIdFromSecurityContext();

    if (userIdFromSecurityContext == null) {
        UI.getCurrent().getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME);
    } else {

        final UserAccount userAccount = dataContainer.load(userIdFromSecurityContext);

        getFormFactory().addFormPanelTextFields(panelContent, new BeanItem<>(userAccount), UserAccount.class,
                Arrays.asList(
                        new String[] { "username", "createdDate", "email", "country", "numberOfVisits" }));

        final DataContainer<ApplicationActionEvent, Long> eventDataContainer = getApplicationManager()
                .getDataContainer(ApplicationActionEvent.class);

        final BeanItemContainer<ApplicationActionEvent> politicianDocumentDataSource = new BeanItemContainer<>(
                ApplicationActionEvent.class,
                eventDataContainer.findOrderedListByProperty(ApplicationActionEvent_.userId,
                        userAccount.getUserId(), ApplicationActionEvent_.createdDate));

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

        panelContent.setExpandRatio(logoutButton, ContentRatio.SMALL);

    }

    panel.setCaption(USERHOME);

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

    return panelContent;

}

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

License:Apache License

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

    final String pageId = getPageId(parameters);

    userHomeMenuItemFactory.createUserHomeMenuBar(menuBar, pageId);

    LabelFactory.createHeader2Label(panelContent, SECURITY_SETTINGS);

    final Long userIdFromSecurityContext = UserContextUtil.getUserInternalIdFromSecurityContext();

    if (userIdFromSecurityContext == null) {
        UI.getCurrent().getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME);
    } else {

        final Button googleAuthButton = new Button(ENABLE_GOOGLE_AUTHENTICATOR, FontAwesome.USER_SECRET);
        googleAuthButton.setId(ENABLE_GOOGLE_AUTHENTICATOR);

        final SetGoogleAuthenticatorCredentialRequest googleAuthRequest = new SetGoogleAuthenticatorCredentialRequest();
        googleAuthRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
        googleAuthButton.addClickListener(
                new SetGoogleAuthenticatorCredentialClickListener(googleAuthRequest, getApplicationManager()));

        panelContent.addComponent(googleAuthButton);

    }

    panel.setCaption(USERHOME + SECURITY_SETTINGS);

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

    return panelContent;

}

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

License:Apache License

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

    final String pageId = getPageId(parameters);

    panelContent.addComponent(new Label(OVERVIEW));

    getParliamentMenuItemFactory().createOverviewPage(panelContent);

    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_TEST_CHART_VIEW, ApplicationEventGroup.USER,
            NAME, parameters, pageId);
    panel.setCaption(OVERVIEW);

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*from  ww w .  java  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<ViewRiksdagenParty, String> dataContainer = getApplicationManager()
            .getDataContainer(ViewRiksdagenParty.class);

    final DataContainer<ViewRiksdagenPartySummary, String> partySummarydataContainer = getApplicationManager()
            .getDataContainer(ViewRiksdagenPartySummary.class);

    final ViewRiksdagenParty viewRiksdagenParty = dataContainer.load(pageId);

    if (viewRiksdagenParty != null) {

        getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);

        LabelFactory.createHeader2Label(panelContent, OVERVIEW);

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

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

        getPartyMenuItemFactory().createOverviewPage(overviewLayout, pageId);

        final Link addPartyPageLink = getPageLinkFactory().addPartyPageLink(viewRiksdagenParty);
        panelContent.addComponent(addPartyPageLink);

        panelContent.setExpandRatio(addPartyPageLink, ContentRatio.SMALL);

        getFormFactory().addFormPanelTextFields(panelContent, new BeanItem<>(viewRiksdagenParty),
                ViewRiksdagenParty.class, Arrays.asList(new String[] { "partyName", "partyId", "headCount",
                        "partyNumber", "registeredDate", "website" }));

        final ViewRiksdagenPartySummary viewRiksdagenPartySummary = partySummarydataContainer.load(pageId);

        if (viewRiksdagenPartySummary != null) {

            getFormFactory().addFormPanelTextFields(panelContent, new BeanItem<>(viewRiksdagenPartySummary),
                    ViewRiksdagenPartySummary.class,
                    Arrays.asList(new String[] { "active", "firstAssignmentDate", "lastAssignmentDate",
                            "currentAssignments", "totalAssignments", "totalDaysServed", "activeEu",
                            "totalActiveEu", "totalDaysServedEu", "activeGovernment", "totalActiveGovernment",
                            "totalDaysServedGovernment", "activeCommittee", "totalActiveCommittee",
                            "totalDaysServedCommittee", "activeParliament", "totalActiveParliament",
                            "totalDaysServedParliament" }));

        }

        pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
    }
    return panelContent;

}

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

License:Apache License

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

    final String pageId = getPageId(parameters);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

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

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

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

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override// 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();

    final String pageId = getPageId(parameters);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory.createChartTimeSeriesCurrentCommitteeByParty(), "Current Committee");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

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

    return panelContent;

}

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

License:Apache License

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override/*from  w ww. ja  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);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

    chartDataManager.createChartPanel(chartLayout,
            dataSeriesFactory.createChartTimeSeriesCurrentGovernmentByParty(), "Current Government");

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

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

    return panelContent;

}

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

License:Apache License

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

    final String pageId = getPageId(parameters);

    getPartyRankingMenuItemFactory().createPartyRankingMenuBar(menuBar);
    final HorizontalLayout chartLayout = new HorizontalLayout();
    chartLayout.setSizeFull();

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

    panelContent.addComponent(chartLayout);

    panel.setCaption(CHARTS + parameters);

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

    return panelContent;

}