List of usage examples for com.vaadin.server VaadinRequest getParameter
public String getParameter(String parameter);
From source file:org.vaadin.spring.samples.security.shared.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { getPage().setTitle("Vaadin Shared Security Demo Login"); FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined();//from w w w. j a v a2s . co m userName = new TextField("Username"); passwordField = new PasswordField("Password"); rememberMe = new CheckBox("Remember me"); login = new Button("Login"); loginForm.addComponent(userName); loginForm.addComponent(passwordField); loginForm.addComponent(rememberMe); loginForm.addComponent(login); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }
From source file:pl.exsio.frameset.vaadin.i18n.locale.provider.ClientLocaleProviderImpl.java
License:Open Source License
@Override public Locale getLocale() { VaadinRequest request = this.getCurrentVaadinRequest(); if (request instanceof VaadinRequest) { String forcedLocale = request.getParameter(FORCED_LOCALE_PARAM); if (forcedLocale != null && !forcedLocale.isEmpty()) { this.lastKnownLocale = this.getLocaleFromString(forcedLocale); } else {//from www. j av a2 s .com this.lastKnownLocale = request.getLocale(); } } return this.lastKnownLocale; }
From source file:pl.exsio.frameset.vaadin.i18n.locale.provider.FixedLocaleProviderImpl.java
License:Open Source License
@Override public Locale getLocale() { VaadinRequest request = this.getCurrentVaadinRequest(); if (request instanceof VaadinRequest) { String forcedLocale = request.getParameter(FORCED_LOCALE_PARAM); if (forcedLocale != null && !forcedLocale.isEmpty()) { this.lastKnownLocale = this.getLocaleFromString(forcedLocale); }//from w w w. j a v a 2 s.c om } return this.lastKnownLocale; }
From source file:ru.inovus.ui.SignInUI.java
License:Apache License
@Override protected void init(final VaadinRequest request) { boolean isLogout = request.getParameter("logout") != null; if (service.isAuthenticated()) { getPage().setLocation("welcome"); } else {//from w w w . j a v a2 s .c o m setContent(new UIFormBuilder(service, Form.SIGN_IN, isLogout, request).buildForm()); if (!isLogout) notification(); } }
From source file:trader.LoginUI.java
License:Apache License
@Override protected void init(VaadinRequest request) { setLocale(Locale.ENGLISH);//from w ww . j a va 2 s.c om FormLayout loginForm = new FormLayout(); loginForm.setSizeUndefined(); loginForm.addComponent(userName = new TextField("Username")); loginForm.addComponent(passwordField = new PasswordField("Password")); loginForm.addComponent(rememberMe = new CheckBox("Remember me")); loginForm.addComponent(login = new Button("Login")); login.addStyleName(ValoTheme.BUTTON_PRIMARY); login.setDisableOnClick(true); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addClickListener(new Button.ClickListener() { /** * */ private static final long serialVersionUID = 7813011112417170727L; @Override public void buttonClick(Button.ClickEvent event) { login(); } }); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setSpacing(true); loginLayout.setSizeUndefined(); if (request.getParameter("logout") != null) { loggedOutLabel = new Label("You have been logged out!"); loggedOutLabel.addStyleName(ValoTheme.LABEL_SUCCESS); loggedOutLabel.setSizeUndefined(); loginLayout.addComponent(loggedOutLabel); loginLayout.setComponentAlignment(loggedOutLabel, Alignment.BOTTOM_CENTER); } loginLayout.addComponent(loginFailedLabel = new Label()); loginLayout.setComponentAlignment(loginFailedLabel, Alignment.BOTTOM_CENTER); loginFailedLabel.setSizeUndefined(); loginFailedLabel.addStyleName(ValoTheme.LABEL_FAILURE); loginFailedLabel.setVisible(false); loginLayout.addComponent(loginForm); loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER); VerticalLayout rootLayout = new VerticalLayout(loginLayout); rootLayout.setSizeFull(); rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER); setContent(rootLayout); setSizeFull(); }