List of usage examples for com.vaadin.ui Panel setCaption
@Override public void setCaption(String caption)
From source file:com.arcusys.liferay.vaadinplugin.ui.OutputConsole.java
License:Apache License
public OutputConsole(String caption) { Panel panel = new Panel(); panel.setCaption(caption); panel.setSizeFull();//from ww w . j a va2 s.c om setCompositionRoot(panel); VerticalLayout layout = new VerticalLayout(); layout.setSizeUndefined(); panel.setContent(layout); VerticalLayout outputLabelLayout = new VerticalLayout(); outputLabelLayout.setSizeUndefined(); outputLabelLayout.setMargin(true); layout.addComponent(outputLabelLayout); outputLabel.setSizeUndefined(); outputLabelLayout.addComponent(outputLabel); scrollToLabel.setWidth("0px"); scrollToLabel.setHeight("0px"); layout.addComponent(scrollToLabel); }
From source file:com.cms.utils.CommonUtils.java
public static Panel addOg2Panel(OptionGroup og, String caption, String height) { og.setWidth("100%"); og.setHeight("-1px"); og.setImmediate(true);/* w w w .ja va 2 s.c om*/ og.setMultiSelect(true); VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined(); layout.setImmediate(true); layout.setMargin(true); layout.setSpacing(true); layout.addComponent(og); layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT); Panel panel = new Panel(); if (!DataUtil.isStringNullOrEmpty(caption)) { panel.setCaption(caption); } panel.setWidth("100%"); panel.setImmediate(true); if (!DataUtil.isStringNullOrEmpty(height)) { panel.setHeight(height); } else { panel.setHeight("200px"); } panel.addStyleName(Runo.PANEL_LIGHT); panel.setContent(layout); return panel; }
From source file:com.expressui.sample.view.LoginPage.java
License:Open Source License
@PostConstruct @Override/*from ww w . ja v a2 s. c o m*/ public void postConstruct() { super.postConstruct(); setSizeFull(); LoginForm loginForm = new LoginForm(); loginForm.addStyleName("border"); loginForm.setSizeUndefined(); loginForm.setLoginButtonCaption(uiMessageSource.getMessage("loginPage.button")); loginForm.setUsernameCaption(uiMessageSource.getMessage("loginPage.username")); loginForm.setPasswordCaption(uiMessageSource.getMessage("loginPage.password")); loginForm.addListener(new LoginHandler()); Panel panel = new Panel(); panel.addStyleName("loginPage"); panel.addStyleName("border"); panel.setSizeUndefined(); panel.setCaption(uiMessageSource.getMessage("loginPage.caption")); panel.addComponent(loginForm); panel.addComponent(new Label(uiMessageSource.getMessage("loginPage.tip"))); addComponent(panel); setComponentAlignment(panel, Alignment.MIDDLE_CENTER); }
From source file:com.github.peholmst.springsecuritydemo.ui.LoginView.java
License:Apache License
@SuppressWarnings("serial") protected void init() { final Panel loginPanel = new Panel(); loginPanel.setCaption(getApplication().getMessage("login.title")); ((VerticalLayout) loginPanel.getContent()).setSpacing(true); final TextField username = new TextField(getApplication().getMessage("login.username")); username.setWidth("100%"); loginPanel.addComponent(username);/* www. j a va2 s . co m*/ final TextField password = new TextField(getApplication().getMessage("login.password")); password.setSecret(true); password.setWidth("100%"); loginPanel.addComponent(password); final Button loginButton = new Button(getApplication().getMessage("login.button")); loginButton.setStyleName("primary"); // TODO Make it possible to submit the form by pressing <Enter> in any // of the text fields loginPanel.addComponent(loginButton); ((VerticalLayout) loginPanel.getContent()).setComponentAlignment(loginButton, Alignment.MIDDLE_RIGHT); loginButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { final Authentication auth = new UsernamePasswordAuthenticationToken(username.getValue(), password.getValue()); try { if (logger.isDebugEnabled()) { logger.debug("Attempting authentication for user '" + auth.getName() + "'"); } Authentication returned = getAuthenticationManager().authenticate(auth); if (logger.isDebugEnabled()) { logger.debug("Authentication for user '" + auth.getName() + "' succeeded"); } fireEvent(new LoginEvent(LoginView.this, returned)); } catch (BadCredentialsException e) { if (logger.isDebugEnabled()) { logger.debug("Bad credentials for user '" + auth.getName() + "'", e); } getWindow().showNotification(getApplication().getMessage("login.badCredentials.title"), getApplication().getMessage("login.badCredentials.descr"), Notification.TYPE_WARNING_MESSAGE); } catch (DisabledException e) { if (logger.isDebugEnabled()) { logger.debug("Account disabled for user '" + auth.getName() + "'", e); } getWindow().showNotification(getApplication().getMessage("login.disabled.title"), getApplication().getMessage("login.disabled.descr"), Notification.TYPE_WARNING_MESSAGE); } catch (LockedException e) { if (logger.isDebugEnabled()) { logger.debug("Account locked for user '" + auth.getName() + "'", e); } getWindow().showNotification(getApplication().getMessage("login.locked.title"), getApplication().getMessage("login.locked.descr"), Notification.TYPE_WARNING_MESSAGE); } catch (Exception e) { if (logger.isErrorEnabled()) { logger.error("Error while attempting authentication for user '" + auth.getName() + "'"); } ExceptionUtils.handleException(getWindow(), e); } } }); HorizontalLayout languages = new HorizontalLayout(); languages.setSpacing(true); final Button.ClickListener languageListener = new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Locale locale = (Locale) event.getButton().getData(); if (logger.isDebugEnabled()) { logger.debug("Changing locale to [" + locale + "] and restarting the application"); } getApplication().setLocale(locale); getApplication().close(); } }; for (Locale locale : getApplication().getSupportedLocales()) { if (!getLocale().equals(locale)) { final Button languageButton = new Button(getApplication().getLocaleDisplayName(locale)); languageButton.setStyleName(Button.STYLE_LINK); languageButton.setData(locale); languageButton.addListener(languageListener); languages.addComponent(languageButton); } } loginPanel.addComponent(languages); loginPanel.setWidth("300px"); final HorizontalLayout viewLayout = new HorizontalLayout(); viewLayout.addComponent(loginPanel); viewLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); viewLayout.setSizeFull(); viewLayout.setMargin(true); setCompositionRoot(viewLayout); setSizeFull(); }
From source file:com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode.EmailPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ADMIN" }) @Override//from ww w . ja va2 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); 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.pagemode.MainViewLoginPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS" }) @Override//from ww w.j a v a 2s . 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.MainViewOverviewPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override// w ww . j av 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); panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN); getMenuItemFactory().createMainPageMenuBar(menuBar); LabelFactory.createHeader2Label(panelContent, "MainOverview"); getMenuItemFactory().createOverviewPage(panelContent); panel.setCaption(CITIZEN_INTELLIGENCE_AGENCY_MAIN); getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MAIN_VIEW, ApplicationEventGroup.USER, CommonsViews.MAIN_VIEW_NAME, parameters, pageId); return panelContent; }
From source file:com.hack23.cia.web.impl.ui.application.views.common.pagemode.MainViewPageVisitHistoryPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override// ww w.j a v a 2s. c om 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); createPageVisitHistory(NAME, pageId, content); 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 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 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.user.ballot.pagemode.BallotChartsPageModContentFactoryImpl.java
License:Apache License
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" }) @Override/*from w w w. j a v a 2s . com*/ 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; }