List of usage examples for com.vaadin.ui PasswordField PasswordField
public PasswordField(ValueChangeListener<String> valueChangeListener)
From source file:com.lst.deploymentautomation.vaadin.page.SettingsView.java
License:Open Source License
private VerticalLayout createUserDataSection(LspsUI ui, Person user) { VerticalLayout userData = new VerticalLayout(); Label userDataHeader = new Label("<h2>" + ui.getMessage("settings.userSection") + "</h2>", ContentMode.HTML);// www .j av a 2s . co m userData.addComponent(userDataHeader); FormLayout userDataContent = new FormLayout(); if ((userRights.contains(OsRights.CHANGE_OWN_PASSWORD)) || (userRights.contains(OsRights.MANAGE_PERSON))) { this.passwordField = new PasswordField(ui.getMessage("settings.password")); passwordField.setWidth("100%"); userDataContent.addComponent(passwordField); this.confirmation = new PasswordField(ui.getMessage("settings.passwordVerification")); confirmation.setWidth("100%"); userDataContent.addComponent(confirmation); } this.email = new TextField(ui.getMessage("settings.email")); email.setWidth("100%"); email.setValue(user.getEmail()); email.setNullRepresentation(""); userDataContent.addComponent(email); this.telephone = new TextField(ui.getMessage("settings.phoneNumber")); telephone.setWidth("100%"); telephone.setValue(user.getPhone()); telephone.setNullRepresentation(""); userDataContent.addComponent(telephone); userData.addComponent(userDataContent); return userData; }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.authentication.LoginScreen.java
License:Apache License
private Component buildLoginForm() { FormLayout loginForm = new FormLayout(); loginForm.addStyleName("login-form"); loginForm.setSizeUndefined();/*from ww w. j av a2s . co m*/ loginForm.setMargin(false); loginForm.addComponent(username = new TextField("Username", "admin")); username.setWidth(15, Unit.EM); loginForm.addComponent(password = new PasswordField("Password")); password.setWidth(15, Unit.EM); password.setDescription("Write anything"); CssLayout buttons = new CssLayout(); buttons.setStyleName("buttons"); loginForm.addComponent(buttons); buttons.addComponent(login = new Button("Login")); login.setDisableOnClick(true); login.addClickListener(new Button.ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { try { login(); } finally { login.setEnabled(true); } } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); buttons.addComponent(forgotPassword = new Button("Forgot password?")); forgotPassword.addClickListener(new Button.ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(Button.ClickEvent event) { showNotification(new Notification("Hint: Try anything")); } }); forgotPassword.addStyleName(ValoTheme.BUTTON_LINK); return loginForm; }
From source file:com.mycompany.exodious.login.java
public login() { this.setId("loginPanel"); this.setSpacing(true); Image logo = new Image(); logo.setId("logo"); logo.setSource(slikaLogo);/*from ww w. j a v a 2 s . c o m*/ logo.setHeight("18em"); logo.setWidth("30em"); Label welcome = new Label("Welcome, please login"); welcome.setId("welcome"); TextField username = new TextField("Your ID"); PasswordField password = new PasswordField("Password"); Button submit = new Button("Login"); submit.setIcon(FontAwesome.SIGN_IN); submit.addStyleName(ValoTheme.BUTTON_PRIMARY); submit.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { } }); addComponents(logo, welcome, username, password, submit); setComponentAlignment(logo, Alignment.MIDDLE_CENTER); setComponentAlignment(welcome, Alignment.MIDDLE_CENTER); setComponentAlignment(username, Alignment.MIDDLE_CENTER); setComponentAlignment(password, Alignment.MIDDLE_CENTER); setComponentAlignment(submit, Alignment.MIDDLE_CENTER); }
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Build login view//from w w w .ja v a2 s . c om * * @param exit */ private void buildLoginView(final boolean exit) { if (exit) { root.removeAllComponents(); } notifierService.closeAll(); addStyleName("login"); VerticalLayout loginLayout = new VerticalLayout(); loginLayout.setId("webconsole_loginlayout_id"); loginLayout.setSizeFull(); loginLayout.addStyleName("login-layout"); root.addComponent(loginLayout); final CssLayout loginPanel = new CssLayout(); loginPanel.addStyleName("login-panel"); HorizontalLayout labels = new HorizontalLayout(); labels.setWidth(MAX_WIDTH); labels.setMargin(true); loginPanel.addComponent(labels); Label welcome = new Label("Welcome"); welcome.addStyleName("h4"); labels.addComponent(welcome); labels.setComponentAlignment(welcome, Alignment.MIDDLE_LEFT); Label title = new Label(consoleName); //title.setSizeUndefined(); title.addStyleName("h2"); title.addStyleName("light"); labels.addComponent(title); labels.setComponentAlignment(title, Alignment.MIDDLE_RIGHT); HorizontalLayout fields = new HorizontalLayout(); fields.setSpacing(true); fields.setMargin(true); fields.addStyleName("fields"); final TextField username = new TextField("Username"); username.focus(); username.setId("webconsole_login_username"); fields.addComponent(username); final PasswordField password = new PasswordField("Password"); password.setId("webconsole_login_password"); fields.addComponent(password); final Button signin = new Button("Sign In"); signin.setId("webconsole_login_signin"); signin.addStyleName("default"); fields.addComponent(signin); fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT); final ShortcutListener enter = new ShortcutListener("Sign In", ShortcutAction.KeyCode.ENTER, null) { @Override public void handleAction(Object sender, Object target) { signin.click(); } }; signin.addShortcutListener(enter); loginPanel.addComponent(fields); HorizontalLayout bottomRow = new HorizontalLayout(); bottomRow.setWidth(MAX_WIDTH); bottomRow.setMargin(new MarginInfo(false, true, false, true)); final CheckBox keepLoggedIn = new CheckBox("Keep me logged in"); bottomRow.addComponent(keepLoggedIn); bottomRow.setComponentAlignment(keepLoggedIn, Alignment.MIDDLE_LEFT); // Add new error message final Label error = new Label("Wrong username or password.", ContentMode.HTML); error.setId("webconsole_login_error"); error.addStyleName("error"); error.setSizeUndefined(); error.addStyleName("light"); // Add animation error.addStyleName("v-animate-reveal"); error.setVisible(false); bottomRow.addComponent(error); bottomRow.setComponentAlignment(error, Alignment.MIDDLE_RIGHT); loginPanel.addComponent(bottomRow); signin.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (authenticate(username.getValue(), password.getValue())) { // if (keepLoggedIn.getValue()) { // //Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME); // if (getCookieByName(PEERGREEN_USER_COOKIE_NAME) == null) { // // Get a token for this user and create a cooki // Page.getCurrent().getJavaScript().execute( String.format("document.cookie = '%s=%s; path=%s'", // PEERGREEN_USER_COOKIE_NAME, token, VaadinService.getCurrentRequest().getContextPath())); // } else { // // update token // userCookie.setValue(token); // userCookie.setPath(VaadinService.getCurrentRequest().getContextPath()); // } // } buildMainView(); } else { error.setVisible(true); } } }); loginLayout.addComponent(loginPanel); loginLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); }
From source file:com.snowy.NewUserSubWindow.java
public void build() { //setClosable(false); setModal(true);/* w w w . j a va2s.c o m*/ setResizable(false); setResponsive(true); setDraggable(false); FormLayout fl = new FormLayout(); fl.setMargin(true); //fl.setSizeFull(); fl.setSizeUndefined(); fl.setSpacing(true); TextField uname = new TextField("Username"); uname.setRequired(true); //uname.addValidator(null); fl.addComponent(uname); TextField email = new TextField("Email"); email.setRequired(true); email.addValidator(new EmailValidator("A Valid Email is Required")); fl.addComponent(email); PasswordField pf1 = new PasswordField("Password"); pf1.setRequired(true); pf1.addValidator(new StringLengthValidator("Password must be between 8 and 60 characters", 8, 60, false)); fl.addComponent(pf1); PasswordField pf2 = new PasswordField("Confirm Password"); pf2.setRequired(true); pf2.addValidator((Object value) -> { if (!pf2.getValue().equals(pf1.getValue())) { throw new InvalidValueException("Passwords Must Match"); } }); //pf2.setImmediate(true); fl.addComponent(pf2); Button b = new Button("Submit"); b.addClickListener((Button.ClickEvent e) -> { if (uname.isValid() && email.isValid() && pf1.isValid() && pf2.isValid()) { String result = d.createUser(uname.getValue(), pf2.getValue(), email.getValue()); if (result.equals("Creation Sucess")) { fl.removeAllComponents(); fl.addComponent(new Label("User Created Sucessfully")); fl.addComponent(new Button("Close", (ee) -> { this.close(); })); } else { Notification.show(result); } } else { b.setComponentError(new UserError("Issues with required fields")); } //d.close(); }); fl.addComponent(b); setContent(fl); }
From source file:com.squadd.UI.LoginUI.java
private void configureComponents(Button first, Button second) { header = new HeaderLayout(); username = new TextField("Login"); password = new PasswordField("Password"); actions = new HorizontalLayout(first, second); configureActions();/* w w w. j av a 2s . co m*/ }
From source file:com.squadd.UI.MainInformationLayout.java
private void configureComponents() { login = new TextField("Login"); password = new PasswordField("Password"); confirmed = new PasswordField("Confirm Password"); }
From source file:com.toptal.ui.view.LoginView.java
License:Open Source License
/** * Generates content./*from w w w. j a va 2 s .co m*/ * @return Content. */ private Component content() { final HorizontalLayout content = new HorizontalLayout(); content.setSpacing(true); this.username = new TextField("Username"); this.username.setIcon(FontAwesome.USER); this.username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); this.password = new PasswordField("Password"); this.password.setIcon(FontAwesome.LOCK); this.password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON); final Button login = new Button("Log In"); login.addStyleName(ValoTheme.BUTTON_FRIENDLY); login.setClickShortcut(KeyCode.ENTER); login.focus(); login.addClickListener(e -> this.login(this.username.getValue(), this.password.getValue())); final Button signup = new Button("Sign Up"); signup.addStyleName(ValoTheme.BUTTON_PRIMARY); signup.addClickListener(e -> this.signup(this.username.getValue(), this.password.getValue())); content.addComponents(this.username, this.password, login, signup); content.setComponentAlignment(login, Alignment.BOTTOM_LEFT); content.setComponentAlignment(signup, Alignment.BOTTOM_LEFT); return content; }
From source file:com.trender.user.component.UserForm.java
public Component ProfilForm() { addStyleName("light"); setWidth(90, Unit.PERCENTAGE);//from w w w . ja v a2 s .c o m Label title = new Label(); title.setStyleName("h2"); title.setValue(""); passwordField = new PasswordField(" "); passwordField.setInputPrompt("12345678"); passwordField.setWidth(80, Unit.PERCENTAGE); surnameField = new TextField("?"); surnameField.addValidator(new StringLengthValidator( " , " + "? 2 ?, ?? 45", 2, 45, false)); surnameField.addValidator(new RegexpValidator(regexpValue, " " + " ?? ? ?")); surnameField.setInputPrompt("?"); surnameField.setWidth(80, Unit.PERCENTAGE); nameField = new TextField("?"); nameField.addValidator(new StringLengthValidator(" ?, ? " + " 2 ?, ?? 45", 2, 45, false)); nameField.addValidator(new RegexpValidator(regexpValue, " " + " ?? ? ?")); nameField.setInputPrompt("?"); nameField.setWidth(80, Unit.PERCENTAGE); performButton = new Button(""); performButton.setStyleName("v-button-friendly"); clearButton = new Button("?"); clearButton.setStyleName("v-button-quiet"); horizontalLayout = new HorizontalLayout(); horizontalLayout.addComponent(performButton); horizontalLayout.addComponent(clearButton); horizontalLayout.setSpacing(true); horizontalLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); horizontalLayout.setMargin(new MarginInfo(true, false, false, true)); addComponent(title); addComponent(passwordField); addComponent(surnameField); addComponent(nameField); addComponent(horizontalLayout); return this; }
From source file:com.trender.user.component.UserForm.java
private void init(String valueButtonPerform) { setStyleName("v-formlayout-contentcell"); emailField = new TextField(" Email ?"); emailField.addStyleName("v-textfield-borderless"); emailField.addValidator(new EmailValidator( " ? ? ")); emailField.setRequired(true);/* w w w .j a va 2 s . co m*/ emailField.setInputPrompt("user@domen.com"); passwordField = new PasswordField(" "); passwordField.setInputPrompt("12345678"); passwordField.setStyleName("v-textfield-borderless"); passwordField.setRequired(true); performButton = new Button(valueButtonPerform); performButton.setStyleName("v-button-friendly"); clearButton = new Button("?"); clearButton.setStyleName("v-button-quiet"); horizontalLayout = new HorizontalLayout(); horizontalLayout.addComponent(performButton); horizontalLayout.addComponent(clearButton); horizontalLayout.setSpacing(true); addComponent(emailField); addComponent(passwordField); //// clearButton.addClickListener(new Button.ClickListener() { //// @Override //// public void buttonClick(Button.ClickEvent event) { //// UserForm.this.clearForm(false); //// } //// }); //// //// performButton.addClickListener(new Button.ClickListener() { //// @Override //// public void buttonClick(Button.ClickEvent event) { //// UserForm.this.chengProfil(); //// } //// }); }