/** * Constructs an empty PasswordField. */ public PasswordField() { setValue(""); }
/** * Constructs a PasswordField with given value and caption. * * @param caption * the caption for the field * @param value * the value for the field, not {@code null} */ public PasswordField(String caption, String value) { setValue(value); setCaption(caption); }
@Override public void setValue(String value) { super.setValue((value == null) ? "" : value); }
@Override public void setPassword(String password) { passwordBox.setValue(password); }
public String getPasswordAndReset() { String value = this.passwordField.getValue(); this.passwordField.setValue(""); return value; }
@Override public void setValue(String newValue) throws ReadOnlyException { super.setValue(sanitizeValue(newValue)); }
public void setValue(String value) { this.field.setValue(value); updateFloatingLabelPosition(value); }
@Override protected void setValue(Object value) throws MException { ((PasswordField)getComponentEditor()).setValue(MCast.toString(value)); }
@Override public void buttonClick(ClickEvent event) { try { passwordField.validate(); passwordConfirmField.validate(); if(!passwordField.getValue() .equals(passwordConfirmField.getValue())) { Notification.show("Password and confirmation must be the same!", Type.ERROR_MESSAGE); return; } } catch (InvalidValueException e) { passwordField.setValidationVisible(true); passwordConfirmField.setValidationVisible(true); return; } password = passwordField.getValue(); passwordField.setValue(""); passwordConfirmField.setValue(""); close(); } });
private void initializeUserDTO(User user) { m_userDTO = new UserDTO((String) user.getProperties().get("username"), (String) user.getCredentials().get("password"), m_userUtil.getGroup(user).getName()); m_usernameTextField.setValue(m_userDTO.getUsername()); m_passwordTextField.setValue(m_userDTO.getPassword()); m_groupField.setValue(m_userDTO.getGroupname()); }
/** * Called when the selected user is changed. * * @param user * the selected user, can be <code>null</code> in case no user is selected. */ protected void selectUser(UserDTO user) { if (user != null) { m_usernameTextField.setValue(user.getUsername()); m_passwordTextField.setValue(user.getPassword()); m_groupSelect.setValue(user.getGroupname()); } else { m_usernameTextField.setValue(""); m_passwordTextField.setValue(""); m_groupSelect.setValue(null); } updateState(user, user != null /* editAllowed */); m_cancelButton.setEnabled(false); }
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()); } }
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()); } }
@Override public void buttonClick(ClickEvent event) { try { userNameField.validate(); passwordField.validate(); } catch (InvalidValueException e) { userNameField.setValidationVisible(true); passwordField.setValidationVisible(true); return; } try { binder.commit(); userNameField.setValue(""); passwordField.setValue(""); commitHandler.postCommit(); } catch (CommitException e) { passwordField.setValue(""); Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); } } });
@Override protected void initContent(VerticalLayout layout) throws Exception { label = new Label(message); label.setContentMode(ContentMode.HTML); layout.addComponent(label); textField = new PasswordField(); textField.setValue(txtInput); textField.setWidth("100%"); textField.focus(); textField.addShortcutListener(new ShortcutListener("Confirm", ShortcutAction.KeyCode.ENTER, null) { private static final long serialVersionUID = 1L; @Override public void handleAction(Object sender, Object target) { confirm.doAction(PasswordInputDialog.this); } }); layout.addComponent(textField); txtInput = null; }
@Override public void buttonClick(ClickEvent event) { try { userNameField.validate(); passwordField.validate(); } catch (InvalidValueException e) { userNameField.setValidationVisible(true); passwordField.setValidationVisible(true); return; } try { binder.commit(); ikasanAuthentication = (IkasanAuthentication)authenticationService.authenticateLocal (userNameField.getValue(), passwordField.getValue()); userNameField.setValue(""); passwordField.setValue(""); close(); } catch (Exception e) { Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); } } });
@Override protected void initContent(VerticalLayout layout) throws Exception { label = new Label(message); label.setContentMode(Label.CONTENT_XHTML); layout.addComponent(label); textField = new PasswordField(); textField.setValue(txtInput); textField.setWidth("100%"); textField.focus(); textField.addShortcutListener(new ShortcutListener("Confirm", ShortcutAction.KeyCode.ENTER, null) { private static final long serialVersionUID = 1L; @Override public void handleAction(Object sender, Object target) { confirm.doAction(PasswordInputDialog.this); } }); textField.setImmediate(true); layout.addComponent(textField); txtInput = null; }
@Override public void buttonClick(ClickEvent event) { try { userNameField.validate(); passwordField.validate(); } catch (InvalidValueException e) { userNameField.setValidationVisible(true); passwordField.setValidationVisible(true); return; } try { binder.commit(); userNameField.setValue(""); passwordField.setValue(""); close(); commitHandler.postCommit(); } catch (CommitException e) { Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE); } } });
public LoginForm(LoginCallback callback) { setMargin(true); setSpacing(true); TextField username = new TextField("Username"); addComponent(username); PasswordField password = new PasswordField("Password"); addComponent(password); Button login = new Button("Login", evt -> { String pword = password.getValue(); password.setValue(""); if (!callback.login(username.getValue(), pword)) { Notification.show("Login failed"); username.focus(); } }); login.setClickShortcut(ShortcutAction.KeyCode.ENTER); addComponent(login); }
this.passwordField.setValue(this.platformConfigurationService.getWebServicePassword());