com.vaadin.ui.PasswordField Java Examples
The following examples show how to use
com.vaadin.ui.PasswordField.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserBulkInviteViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 6 votes |
private void sendInviteBulkUsers() { int rows = bulkInviteUsersLayout.getRows(); List<Tuple2<String, String>> tuples = new ArrayList<>(); for (int i = 1; i < rows; i++) { EmailField emailField = (EmailField) bulkInviteUsersLayout.getComponent(0, i); PasswordField passwordField = (PasswordField) bulkInviteUsersLayout.getComponent(1, i); String email = emailField.getValue(); String password = passwordField.getValue(); if (StringUtils.isBlank(email)) { continue; } if (StringUtils.isBlank(password)) { password = RandomPasswordGenerator.generateRandomPassword(); } tuples.add(new Tuple2<>(email, password)); } if (CollectionUtils.isNotEmpty(tuples)) { UserService userService = AppContextUtil.getSpringBean(UserService.class); SimpleRole role = roleComboBox.getValue(); userService.bulkInviteUsers(tuples, role.getId(), AppUI.getSubDomain(), AppUI.getAccountId(), UserUIContext.getUsername(), true); } EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null)); }
Example #2
Source File: AbstractHawkbitLoginUI.java From hawkbit with Eclipse Public License 1.0 | 5 votes |
private void buildPasswordField() { password = new PasswordField(i18n.getMessage("label.login.password")); password.setIcon(FontAwesome.LOCK); 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()); } }
Example #3
Source File: FormFactoryImpl.java From cia with Apache License 2.0 | 5 votes |
/** * Creates the field. * * @param property the property * @return the abstract field */ private static AbstractField<?> createField(final String property) { if (StringUtils.containsIgnoreCase(property,HIDDEN_FIELD_NAME)) { return new PasswordField(); } else { return new TextField(); } }
Example #4
Source File: SignUpViewImpl.java From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 | 5 votes |
private void buildForm() { username = new TextField("Username"); username.setWidth("100%"); username.setImmediate(true); username.setValidationVisible(false); username.setNullRepresentation(""); username.setRequired(true); form.addComponent(username); password = new PasswordField("Password"); password.setWidth("100%"); password.setImmediate(true); password.setValidationVisible(false); password.setNullRepresentation(""); password.setRequired(true); form.addComponent(password); firstName = new TextField("First name"); firstName.setWidth("100%"); firstName.setValidationVisible(false); firstName.setNullRepresentation(""); firstName.setImmediate(true); firstName.setRequired(true); form.addComponent(firstName); lastName = new TextField("Last name"); lastName.setWidth("100%"); lastName.setImmediate(true); lastName.setNullRepresentation(""); lastName.setValidationVisible(false); lastName.setRequired(true); form.addComponent(lastName); binder.bind(username, "username"); binder.bind(password, "password"); binder.bind(firstName, "firstName"); binder.bind(lastName, "lastName"); }
Example #5
Source File: UserBulkInviteViewImpl.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
private void buildInviteUserBlock() { EmailField emailField = new EmailField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL)).withWidth("220px"); PasswordField passwordField = new PasswordField(); passwordField.setPlaceholder(UserUIContext.getMessage(UserI18nEnum.FORM_PASSWORD_HINT)); passwordField.setDescription(UserUIContext.getMessage(UserI18nEnum.FORM_PASSWORD_HINT)); MHorizontalLayout actionLayout = new MHorizontalLayout(); MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), (Button.ClickListener) event -> { buildInviteUserBlock(); }).withStyleName(WebThemes.BUTTON_ACTION); actionLayout.with(addBtn); if (bulkInviteUsersLayout.getRows() >= 2) { MButton removeBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), (Button.ClickListener) event -> { GridLayout.Area area = bulkInviteUsersLayout.getComponentArea(actionLayout); int row1 = area.getRow1(); bulkInviteUsersLayout.removeRow(row1); }).withStyleName(WebThemes.BUTTON_OPTION); actionLayout.with(removeBtn); } int rows = bulkInviteUsersLayout.getRows(); bulkInviteUsersLayout.insertRow(rows); bulkInviteUsersLayout.addComponent(emailField, 0, rows); bulkInviteUsersLayout.addComponent(passwordField, 1, rows); bulkInviteUsersLayout.addComponent(actionLayout, 2, rows); }
Example #6
Source File: PasswordChangeWindow.java From mycollab with GNU Affero General Public License v3.0 | 5 votes |
private void initUI() { final MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth(); Label lbInstruct1 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_1)).withFullWidth(); mainLayout.addComponent(lbInstruct1); mainLayout.setComponentAlignment(lbInstruct1, Alignment.MIDDLE_LEFT); final Label lbInstruct2 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_2)).withFullWidth(); mainLayout.addComponent(lbInstruct2); mainLayout.setComponentAlignment(lbInstruct2, Alignment.MIDDLE_LEFT); GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN); txtNewPassword = new PasswordField(); passInfo.addComponent(txtNewPassword, UserUIContext.getMessage(ShellI18nEnum.OPT_NEW_PASSWORD), 0, 0); txtConfirmPassword = new PasswordField(); passInfo.addComponent(txtConfirmPassword, UserUIContext.getMessage(ShellI18nEnum.OPT_CONFIRMED_PASSWORD), 0, 1); mainLayout.addComponent(passInfo.getLayout()); mainLayout.setComponentAlignment(passInfo.getLayout(), Alignment.MIDDLE_CENTER); MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()) .withStyleName(WebThemes.BUTTON_OPTION); MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changePassword()) .withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER); MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(false); mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT); this.setContent(mainLayout); }
Example #7
Source File: FormUtils.java From jdal with Apache License 2.0 | 5 votes |
/** * Create a new {@link PasswordField} * @return new PasswordField with null representation set to emptry string. */ public static PasswordField newPasswordField() { PasswordField pf = new PasswordField(); pf.setNullRepresentation(""); return pf; }
Example #8
Source File: AbstractHawkbitLoginUI.java From hawkbit with Eclipse Public License 1.0 | 4 votes |
protected PasswordField getPassword() { return password; }
Example #9
Source File: SignInViewImpl.java From Vaadin4Spring-MVP-Sample-SpringSecurity with Apache License 2.0 | 4 votes |
@Override public void postConstruct() { super.postConstruct(); setSizeFull(); layout = new VerticalLayout(); layout.setSizeFull(); layout.setSpacing(true); setCompositionRoot(layout); caption = new Label("Sign in to Vaadin4Spring Security Demo"); caption.addStyleName(ValoTheme.LABEL_H2); caption.setSizeUndefined(); layout.addComponent(caption); layout.setComponentAlignment(caption, Alignment.MIDDLE_CENTER); loginPanel = new VerticalLayout(); loginPanel.setSizeUndefined(); loginPanel.setSpacing(true); loginPanel.setMargin(true); layout.addComponent(loginPanel); layout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); layout.setExpandRatio(loginPanel, 1); errorMessage = new Label(); errorMessage.setWidth("300px"); errorMessage.addStyleName(ValoTheme.LABEL_FAILURE); errorMessage.setVisible(false); loginPanel.addComponent(errorMessage); username = new TextField("Username"); username.setImmediate(true); username.setWidth("300px"); username.setNullRepresentation(""); username.setInputPrompt("Enter your username"); loginPanel.addComponent(username); password = new PasswordField("Password"); password.setImmediate(true); password.setWidth("300px"); password.setNullRepresentation(""); loginPanel.addComponent(password); rememberMe = new CheckBox("Remember me"); rememberMe.setValue(false); rememberMe.addStyleName(ValoTheme.CHECKBOX_LARGE); loginPanel.addComponent(rememberMe); btnLogin = new Button("Signin", FontAwesome.UNLOCK); btnLogin.addStyleName(ValoTheme.BUTTON_PRIMARY); btnLogin.addClickListener(this); btnLogin.setWidth("100%"); loginPanel.addComponent(btnLogin); final Label infoLabel = new Label(FontAwesome.INFO_CIRCLE.getHtml() + " You can sign in as: <br/>\"user\" with password \"user\" <br/>\"admin\" with password \"admin\".", ContentMode.HTML); infoLabel.setWidth("300px"); loginPanel.addComponent(infoLabel); }
Example #10
Source File: SQLPIPConfigurationComponent.java From XACML with MIT License | 4 votes |
@AutoGenerated private VerticalLayout buildMainLayout() { // common part: create layout mainLayout = new VerticalLayout(); mainLayout.setImmediate(false); mainLayout.setWidth("-1px"); mainLayout.setHeight("-1px"); mainLayout.setMargin(false); mainLayout.setSpacing(true); // top-level component properties setWidth("-1px"); setHeight("-1px"); // comboBoxConnectionType comboBoxConnectionType = new ComboBox(); comboBoxConnectionType.setCaption("Type of SQL Connection"); comboBoxConnectionType.setImmediate(false); comboBoxConnectionType.setWidth("-1px"); comboBoxConnectionType.setHeight("-1px"); mainLayout.addComponent(comboBoxConnectionType); // textFieldDataSource textFieldDataSource = new TextField(); textFieldDataSource.setCaption("Data Source"); textFieldDataSource.setImmediate(false); textFieldDataSource.setWidth("-1px"); textFieldDataSource.setHeight("-1px"); mainLayout.addComponent(textFieldDataSource); mainLayout.setExpandRatio(textFieldDataSource, 1.0f); // comboBoxSQLDriver comboBoxSQLDriver = new ComboBox(); comboBoxSQLDriver.setCaption("JDBC Driver"); comboBoxSQLDriver.setImmediate(false); comboBoxSQLDriver.setWidth("-1px"); comboBoxSQLDriver.setHeight("-1px"); mainLayout.addComponent(comboBoxSQLDriver); mainLayout.setExpandRatio(comboBoxSQLDriver, 1.0f); // textFieldConnectionURL textFieldConnectionURL = new TextField(); textFieldConnectionURL.setCaption("Connection URL"); textFieldConnectionURL.setImmediate(false); textFieldConnectionURL.setWidth("-1px"); textFieldConnectionURL.setHeight("-1px"); mainLayout.addComponent(textFieldConnectionURL); mainLayout.setExpandRatio(textFieldConnectionURL, 1.0f); // textFieldUser textFieldUser = new TextField(); textFieldUser.setCaption("User"); textFieldUser.setImmediate(false); textFieldUser.setWidth("-1px"); textFieldUser.setHeight("-1px"); mainLayout.addComponent(textFieldUser); mainLayout.setExpandRatio(textFieldUser, 1.0f); // textFieldPassword textFieldPassword = new PasswordField(); textFieldPassword.setCaption("Password"); textFieldPassword.setImmediate(false); textFieldPassword.setWidth("-1px"); textFieldPassword.setHeight("-1px"); mainLayout.addComponent(textFieldPassword); mainLayout.setExpandRatio(textFieldPassword, 1.0f); // buttonTest buttonTest = new Button(); buttonTest.setCaption("Test Connection"); buttonTest.setImmediate(true); buttonTest.setWidth("-1px"); buttonTest.setHeight("-1px"); mainLayout.addComponent(buttonTest); mainLayout.setComponentAlignment(buttonTest, new Alignment(48)); return mainLayout; }