List of usage examples for com.vaadin.ui PasswordField PasswordField
public PasswordField(ValueChangeListener<String> valueChangeListener)
From source file:org.activiti.explorer.ui.profile.AccountSelectionPopup.java
License:Apache License
protected void initAlfrescoComponent() { alfrescoForm = new Form(); alfrescoForm.setDescription(i18nManager.getMessage(Messages.ALFRESCO_DESCRIPTION)); final TextField alfrescoServer = new TextField(i18nManager.getMessage(Messages.ALFRESCO_SERVER)); alfrescoForm.getLayout().addComponent(alfrescoServer); final TextField alfrescoUserName = new TextField(i18nManager.getMessage(Messages.ALFRESCO_USERNAME)); alfrescoForm.getLayout().addComponent(alfrescoUserName); final PasswordField alfrescoPassword = new PasswordField( i18nManager.getMessage(Messages.ALFRESCO_PASSWORD)); alfrescoForm.getLayout().addComponent(alfrescoPassword); // Matching listener alfrescoClickListener = new ClickListener() { public void buttonClick(ClickEvent event) { Map<String, Object> accountDetails = createAccountDetails("alfresco", alfrescoUserName.getValue().toString(), alfrescoPassword.getValue().toString(), "server", alfrescoServer.getValue().toString()); fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails)); }/*from ww w.ja v a 2 s. co m*/ }; }
From source file:org.apache.tamaya.ui.views.login.LoginBox.java
License:Apache License
private void addForm() { FormLayout loginForm = new FormLayout(); MessageProvider mp = ServiceContextManager.getServiceContext().getService(MessageProvider.class); username = new TextField(mp.getMessage("default.label.username")); password = new PasswordField(mp.getMessage("default.label.password")); loginForm.addComponents(username, password); addComponent(loginForm);/*ww w . jav a2 s. c o m*/ loginForm.setSpacing(true); for (Component component : loginForm) { component.setWidth("100%"); } username.focus(); }
From source file:org.balisunrise.vaadin.components.user.UserPanel.java
License:Open Source License
private void init() { model = new CreateUserModel(); BeanItem<CreateUserModel> item = new BeanItem<>(model); FieldGroup fg = new FieldGroup(item); nome = new TextField("Nome"); nome.setWidth("100%"); nome.setMaxLength(50);//from www.ja v a 2 s. c o m fg.bind(nome, "nome"); login = new TextField("Login"); login.setWidth("100%"); login.setMaxLength(32); fg.bind(login, "login"); senha = new PasswordField("Senha"); senha.setWidth("100%"); senha.setMaxLength(32); fg.bind(senha, "senha"); repita = new PasswordField("Repita a senha"); repita.setWidth("100%"); repita.setMaxLength(32); fg.bind(repita, "repita"); GridLayout grid = new GridLayout(20, 1); grid.setWidth("100%"); grid.setHeightUndefined(); grid.setSpacing(true); grid.addComponent(nome, 0, 0, 9, 0); grid.addComponent(login, 10, 0, 19, 0); grid.setRows(2); grid.addComponent(senha, 0, 1, 9, 1); grid.addComponent(repita, 10, 1, 19, 1); addComponent(grid); setSpacing(true); repita.addBlurListener((e) -> { try { fg.commit(); Notification.show("Changes committed!\n" + model.toString(), Notification.Type.TRAY_NOTIFICATION); } catch (final FieldGroup.CommitException ex) { Notification.show("Commit failed: " + ex.getCause().getMessage(), Notification.Type.TRAY_NOTIFICATION); } }); }
From source file:org.eclipse.hawkbit.ui.login.AbstractHawkbitLoginUI.java
License:Open Source License
private void buildPasswordField() { password = new PasswordField(i18n.getMessage("label.login.password")); password.setIcon(FontAwesome.LOCK);//from www. j a va 2 s .c o m password.addStyleName( ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD); password.setId("login-password"); if (isDemo && !uiProperties.getDemo().getPassword().isEmpty()) { password.setValue(uiProperties.getDemo().getPassword()); } }
From source file:org.eclipse.hawkbit.ui.login.LoginView.java
License:Open Source License
private void buildPasswordField() { password = new PasswordField(i18n.getMessage("label.login.password")); password.setIcon(FontAwesome.LOCK);//from w w w. ja va 2 s .c o m password.addStyleName( ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD); password.setId("login-password"); }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Form buildCreateUserAccountForm() { final Form form = new Form(); form.setImmediate(true);/* ww w . ja va 2 s . c om*/ // loginName final TextField loginNameField = new TextField("Login Name"); loginNameField.setImmediate(false); loginNameField.setWidth("-1px"); loginNameField.setHeight("-1px"); form.addField("loginName", loginNameField); // Name final TextField realNameField = new TextField(); realNameField.setCaption("Real Name"); realNameField.setImmediate(false); realNameField.setWidth("-1px"); realNameField.setHeight("-1px"); realNameField.setInvalidAllowed(false); realNameField.setRequired(true); form.addField("realName", realNameField); // Password final PasswordField txtPassword = new PasswordField("Password"); txtPassword.setImmediate(false); txtPassword.setNullSettingAllowed(false); txtPassword.setWidth("-1px"); txtPassword.setHeight("-1px"); form.addField("txtPassword", txtPassword); // Verify Password final PasswordField txtPassword2 = new PasswordField("Verify Password"); txtPassword2.setImmediate(false); txtPassword2.setWidth("-1px"); txtPassword2.setHeight("-1px"); form.addField("txtPassword2", txtPassword2); // btnAddContext final Button addButton = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -1373866726572059290L; @Override public void buttonClick(final ClickEvent event) { try { form.commit(); if (!txtPassword.getValue().equals(txtPassword2.getValue())) { router.getMainWindow().showNotification( "Password verification failed, please try again and make sure you are typing the same password twice ", Window.Notification.TYPE_WARNING_MESSAGE); return; } controller.createResourceAddUserAccount(realNameField.getValue().toString(), loginNameField.getValue().toString(), txtPassword.getValue().toString()); router.getMainWindow().showNotification( "User Account" + realNameField.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); form.getField("loginName").setValue(""); form.getField("realName").setValue(""); form.getField("txtPassword").setValue(""); form.getField("txtPassword2").setValue(""); } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final Exception e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); addButton.setWidth("-1px"); addButton.setHeight("-1px"); form.getLayout().addComponent(addButton); form.getField("loginName").setRequired(true); form.getField("loginName").setRequiredError("Login Name is missing"); form.getField("realName").setRequired(true); form.getField("realName").setRequiredError("Real Name is missing"); return form; }
From source file:org.fatal1t.finbe.ui.views.SimpleLoginView.java
@Autowired public SimpleLoginView(LoginService service, AuthenticationService authenticationService1) { setSizeFull();/*from www . java 2 s .c o m*/ this.loginService = service; this.authenticationService = authenticationService1; // Create login & registration button and add them to separate component loginButton = new Button("Login"); registerButton = new Button("Register"); buttons = new HorizontalLayout(loginButton, registerButton); // Create the user input field user = new TextField("User:"); user.setWidth("300px"); user.setRequired(true); user.setInputPrompt("Your username (eg. joe@email.com)"); user.setValue("test"); //user.addValidator(new EmailValidator( // "Username must be an email address")); //user.setInvalidAllowed(false); // Create the password input field password = new PasswordField("Password:"); password.setWidth("300px"); //password.addValidator(new PasswordValidator()); password.setRequired(true); password.setValue("123456"); password.setNullRepresentation(""); //add listeners and shortcuts this.loginButton.addClickListener(e -> this.loginButtonClick(e)); this.loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER); this.registerButton.addClickListener(e -> { System.out.println("Pozadavek na registraci"); this.getUI().getNavigator().navigateTo(RegistrationView.NAME); }); // Add both to a panel VerticalLayout fields = new VerticalLayout(user, password, buttons); fields.setCaption("Please login to access the application. (test@test.com/passw0rd)"); fields.setSpacing(true); fields.setMargin(new MarginInfo(true, true, true, true)); fields.setSizeUndefined(); // The view root layout VerticalLayout viewLayout = new VerticalLayout(fields); viewLayout.setSizeFull(); viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER); setCompositionRoot(viewLayout); }
From source file:org.fossa.rolp.ui.lehrer.LehrerAnlegenFormFields.java
License:Open Source License
@Override public Field createField(Item item, Object propertyId, Component uiContext) { Field field = super.createField(item, propertyId, uiContext); if (propertyId.equals(FossaUserPojo.FIRSTNAME_COLUMN)) { field.setCaption("Vorname: "); field.setRequired(true);/* w ww. jav a 2 s .c o m*/ } else if (propertyId.equals(FossaUserPojo.LASTNAME_COLUMN)) { field.setCaption("Name: "); field.setRequired(true); } else if (propertyId.equals(FossaUserPojo.USERNAME_COLUMN)) { field.setCaption("Benutzername: "); field.setRequired(true); } else if (propertyId.equals(LehrerPojo.MAIL_COLUMN)) { field.setCaption("E-Mail: "); } else if (propertyId.equals(FossaUserLaso.FORM_PW_ONE_COLUMN)) { PasswordField passwordfield = new PasswordField("Neues Passwort: "); passwordfield.setRequired(true); return passwordfield; } else if (propertyId.equals(FossaUserLaso.FORM_PW_TWO_COLUMN)) { PasswordField passwordfield = new PasswordField("Passwort wiederholen: "); passwordfield.setRequired(true); return passwordfield; } return field; }
From source file:org.jpos.qi.eeuser.UsersView.java
License:Open Source License
private Panel createPasswordPanel() { passwordPanel = new Panel(getApp().getMessage("changePassword")); passwordPanel.setIcon(VaadinIcons.LOCK); passwordPanel.addStyleName("color1"); passwordPanel.addStyleName("margin-top-panel"); VerticalLayout panelContent = new VerticalLayout(); panelContent.setSizeFull();/*from www.j av a 2 s. c om*/ panelContent.setMargin(true); panelContent.setSpacing(true); FormLayout form = new FormLayout(); form.setSizeFull(); panelContent.addComponent(form); panelContent.setExpandRatio(form, 1f); passwordBinder = new Binder<>(); passwordBinder.setReadOnly(true); binderIsReadOnly = true; if (selectedU.getId() != null) { currentPasswordField = new PasswordField(getApp().getMessage("passwordForm.currentPassword")); currentPasswordField.setWidth("80%"); passwordBinder.forField(currentPasswordField) .asRequired(getApp().getMessage("errorMessage.req", currentPasswordField.getCaption())) .withValidator(((UsersHelper) getHelper()).getCurrentPasswordMatchValidator()) .bind(string -> string, null); form.addComponent(currentPasswordField); } PasswordField newPasswordField = new PasswordField(getApp().getMessage("passwordForm.newPassword")); newPasswordField.setWidth("80%"); passwordBinder.forField(newPasswordField) .asRequired(getApp().getMessage("errorMessage.req", newPasswordField.getCaption())) .withValidator(((UsersHelper) getHelper()).getNewPasswordNotUsedValidator()) .bind(string -> string, null); form.addComponent(newPasswordField); repeatPasswordField = new PasswordField(getApp().getMessage("passwordForm.confirmPassword")); repeatPasswordField.setWidth("80%"); passwordBinder.forField(repeatPasswordField) .asRequired(getApp().getMessage("errorMessage.req", repeatPasswordField.getCaption())) .withValidator(((UsersHelper) getHelper()).getPasswordsMatchValidator(newPasswordField)) .bind(string -> string, null); form.addComponent(repeatPasswordField); passwordPanel.setVisible(forcePasswordChange); passwordPanel.setContent(panelContent); return passwordPanel; }
From source file:org.jumpmind.metl.ui.init.LoginDialog.java
License:Open Source License
public LoginDialog(ApplicationContext context, LoginListener loginListener) { super("Login to Metl"); this.context = context; this.loginListener = loginListener; setWidth(300, Unit.PIXELS);/*from ww w . ja va 2 s .c om*/ setResizable(false); setReadOnly(true); setModal(true); setClosable(false); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); userField = new TextField("User Id"); userField.setWidth(100, Unit.PERCENTAGE); layout.addComponent(userField); passwordField = new PasswordField("Password"); passwordField.setImmediate(true); passwordField.setWidth(100, Unit.PERCENTAGE); layout.addComponent(passwordField); HorizontalLayout buttonLayout = new HorizontalLayout(); Button loginButton = new Button("Login"); loginButton.addClickListener(new LoginClickListener()); loginButton.setStyleName("primary"); loginButton.setClickShortcut(KeyCode.ENTER); buttonLayout.addComponent(loginButton); buttonLayout.setWidth(100, Unit.PERCENTAGE); layout.addComponent(buttonLayout); buttonLayout.addComponent(loginButton); buttonLayout.setComponentAlignment(loginButton, Alignment.BOTTOM_RIGHT); setContent(layout); userField.focus(); }