List of usage examples for com.vaadin.ui VerticalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.MainViewLoginPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS" }) @Override/*from w w w . j a va 2 s .c o m*/ public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) { final VerticalLayout content = createPanelContent(); final String pageId = getPageId(parameters); panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN); getMenuItemFactory().createMainPageMenuBar(menuBar); final DefaultVerticalLoginForm loginForm = new EmailPasswordLoginForm(); final LoginRequest loginRequest = new LoginRequest(); loginRequest.setOtpCode(""); loginForm.addLoginListener(new ApplicationLoginListener(getApplicationManager(), loginRequest)); loginForm.setId(ApplicationAction.LOGIN.toString()); loginForm.setIcon(FontAwesome.SIGN_IN); final BeanFieldGroup<LoginRequest> fieldGroup = new BeanFieldGroup<>(LoginRequest.class); fieldGroup.setItemDataSource(new BeanItem<>(loginRequest)); fieldGroup.setReadOnly(true); fieldGroup.setBuffered(false); final Field<?> buildAndBind = fieldGroup.buildAndBind("otpCode"); buildAndBind.setReadOnly(false); content.addComponent(buildAndBind); content.addComponent(loginForm); panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER, CommonsViews.MAIN_VIEW_NAME, parameters, pageId); return content; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.MainViewRegisterPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS" }) @Override/*from ww w . j av a 2 s. c o m*/ 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 VerticalLayout registerLayout = new VerticalLayout(); registerLayout.setSizeFull(); final Panel formPanel = new Panel(); formPanel.setSizeFull(); registerLayout.addComponent(formPanel); final FormLayout formContent = new FormLayout(); formPanel.setContent(formContent); final RegisterUserRequest reqisterRequest = new RegisterUserRequest(); reqisterRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId()); reqisterRequest.setUsername(""); reqisterRequest.setEmail(""); reqisterRequest.setCountry(""); reqisterRequest.setUserpassword(""); final ClickListener reqisterListener = new RegisterUserClickListener(reqisterRequest, getApplicationManager()); getFormFactory().addRequestInputFormFields(formContent, new BeanItem<>(reqisterRequest), RegisterUserRequest.class, Arrays.asList(new String[] { "username", "email", "country", "userpassword" }), "Register", reqisterListener); content.addComponent(registerLayout); panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER, CommonsViews.MAIN_VIEW_NAME, parameters, pageId); return content; }
From source file:com.hack23.cia.web.impl.ui.application.views.pageclicklistener.SetGoogleAuthenticatorCredentialClickListener.java
License:Apache License
@Override public void buttonClick(final ClickEvent event) { final SetGoogleAuthenticatorCredentialResponse response = (SetGoogleAuthenticatorCredentialResponse) applicationManager .service(googleAuthRequest); if (ServiceResult.SUCCESS == response.getResult()) { try {//w ww.j a v a2s. com final URI keyUri = new URI(response.getOtpAuthTotpURL()); final QRCode qrCode = new QRCode(QR_CODE, keyUri.toASCIIString()); qrCode.setHeight(QR_CODE_IMAGE_SIZE); qrCode.setWidth(QR_CODE_IMAGE_SIZE); final Window mywindow = new Window(GOOGLE_AUTHENTICATOR_QR_CODE); mywindow.setHeight(MODAL_WINDOW_SIZE); mywindow.setWidth(MODAL_WINDOW_SIZE); mywindow.setPositionX(WINDOW_POSITION); mywindow.setPositionY(WINDOW_POSITION); final VerticalLayout panelContent = new VerticalLayout(); mywindow.setContent(panelContent); panelContent.addComponent(qrCode); mywindow.setModal(true); UI.getCurrent().addWindow(mywindow); } catch (final URISyntaxException e) { LOGGER.warn(PROBLEM_DISPLAYING_QR_CODE, e); Notification.show(PROBLEM_DISPLAYING_QR_CODE, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE); } } else { Notification.show(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE); LOGGER.info(PROBLEM_ENABLE_GOOGLE_AUTHENTICATOR_SESSIONID, googleAuthRequest.getSessionId()); } }
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/*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 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// ww w. j ava 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 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; }
From source file:com.hack23.cia.web.impl.ui.application.views.user.committee.pagemode.CommitteeOverviewPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override//w ww.j a v a2 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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager() .getDataContainer(ViewRiksdagenCommittee.class); final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId); if (viewRiksdagenCommittee != null) { getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId); LabelFactory.createHeader2Label(panelContent, OVERVIEW); final VerticalLayout overviewLayout = new VerticalLayout(); overviewLayout.setSizeFull(); panelContent.addComponent(overviewLayout); panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM); getCommitteeMenuItemFactory().createOverviewPage(overviewLayout, pageId); final Link addCommitteePageLink = getPageLinkFactory().addCommitteePageLink(viewRiksdagenCommittee); panelContent.addComponent(addCommitteePageLink); getFormFactory().addFormPanelTextFields(panelContent, new BeanItem<>(viewRiksdagenCommittee), ViewRiksdagenCommittee.class, Arrays.asList(new String[] { "embeddedId.detail", "active", "firstAssignmentDate", "lastAssignmentDate", "totalAssignments", "totalDaysServed", "currentMemberSize" })); panelContent.setExpandRatio(addCommitteePageLink, ContentRatio.SMALL); panel.setCaption(COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail()); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_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//from ww 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(); 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. jav a 2s . 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.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/*w w w. j a v a2 s.com*/ 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/* w w w . j a va2 s . 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.createCommitteeChartTimeSeriesCurrent(), "Current"); panelContent.addComponent(chartLayout); panel.setCaption(CHARTS + parameters); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_RANKING_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId); return panelContent; }