use of com.vaadin.ui.PasswordField in project Activiti by Activiti.
the class AccountSelectionPopup method initImapComponent.
protected void initImapComponent() {
imapForm = new Form();
imapForm.setDescription(i18nManager.getMessage(Messages.IMAP_DESCRIPTION));
final TextField imapServer = new TextField(i18nManager.getMessage(Messages.IMAP_SERVER));
imapForm.getLayout().addComponent(imapServer);
final TextField imapPort = new TextField(i18nManager.getMessage(Messages.IMAP_PORT));
imapPort.setWidth(30, UNITS_PIXELS);
// Default imap port (non-ssl)
imapPort.setValue(143);
imapForm.getLayout().addComponent(imapPort);
final CheckBox useSSL = new CheckBox(i18nManager.getMessage(Messages.IMAP_SSL));
useSSL.setValue(false);
useSSL.setImmediate(true);
imapForm.getLayout().addComponent(useSSL);
useSSL.addListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
imapPort.setValue(((Boolean) useSSL.getValue()) ? 993 : 143);
}
});
final TextField imapUserName = new TextField(i18nManager.getMessage(Messages.IMAP_USERNAME));
imapForm.getLayout().addComponent(imapUserName);
final PasswordField imapPassword = new PasswordField(i18nManager.getMessage(Messages.IMAP_PASSWORD));
imapForm.getLayout().addComponent(imapPassword);
// Matching listener
imapClickListener = new ClickListener() {
public void buttonClick(ClickEvent event) {
Map<String, Object> accountDetails = createAccountDetails("imap", imapUserName.getValue().toString(), imapPassword.getValue().toString(), "server", imapServer.getValue().toString(), "port", imapPort.getValue().toString(), "ssl", imapPort.getValue().toString());
fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
}
};
}
use of com.vaadin.ui.PasswordField in project Activiti by Activiti.
the class NewUserPopupWindow method initInputFields.
protected void initInputFields() {
// Input fields
form.addField("id", new TextField(i18nManager.getMessage(Messages.USER_ID)));
// Set id field to required
form.getField("id").setRequired(true);
form.getField("id").setRequiredError(i18nManager.getMessage(Messages.USER_ID_REQUIRED));
form.getField("id").focus();
// Set id field to be unique
form.getField("id").addValidator(new Validator() {
public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
throw new InvalidValueException(i18nManager.getMessage(Messages.USER_ID_UNIQUE));
}
}
public boolean isValid(Object value) {
if (value != null) {
return identityService.createUserQuery().userId(value.toString()).singleResult() == null;
}
return false;
}
});
// Password is required
form.addField("password", new PasswordField(i18nManager.getMessage(Messages.USER_PASSWORD)));
form.getField("password").setRequired(true);
form.getField("password").setRequiredError(i18nManager.getMessage(Messages.USER_PASSWORD_REQUIRED));
// Password must be at least 5 characters
StringLengthValidator passwordLengthValidator = new StringLengthValidator(i18nManager.getMessage(Messages.USER_PASSWORD_MIN_LENGTH, 5), 5, -1, false);
form.getField("password").addValidator(passwordLengthValidator);
form.addField("firstName", new TextField(i18nManager.getMessage(Messages.USER_FIRSTNAME)));
form.addField("lastName", new TextField(i18nManager.getMessage(Messages.USER_LASTNAME)));
form.addField("email", new TextField(i18nManager.getMessage(Messages.USER_EMAIL)));
}
use of com.vaadin.ui.PasswordField in project Activiti by Activiti.
the class UserDetailPanel method loadUserDetails.
protected void loadUserDetails() {
// Grid of details
GridLayout detailGrid = new GridLayout();
detailGrid.setColumns(2);
detailGrid.setSpacing(true);
detailGrid.setMargin(true, true, false, true);
userDetailsLayout.addComponent(detailGrid);
// Details
// details are non-editable
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_ID), new Label(user.getId()));
if (!editingDetails) {
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_FIRSTNAME), new Label(user.getFirstName()));
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_LASTNAME), new Label(user.getLastName()));
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), new Label(user.getEmail()));
} else {
firstNameField = new TextField(null, user.getFirstName() != null ? user.getFirstName() : "");
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_FIRSTNAME), firstNameField);
firstNameField.focus();
lastNameField = new TextField(null, user.getLastName() != null ? user.getLastName() : "");
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_LASTNAME), lastNameField);
emailField = new TextField(null, user.getEmail() != null ? user.getEmail() : "");
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), emailField);
passwordField = new PasswordField();
Label cautionLabel = new Label(i18nManager.getMessage(Messages.USER_RESET_PASSWORD));
cautionLabel.addStyleName(Reindeer.LABEL_SMALL);
HorizontalLayout passwordLayout = new HorizontalLayout();
passwordLayout.setSpacing(true);
passwordLayout.addComponent(passwordField);
passwordLayout.addComponent(cautionLabel);
passwordLayout.setComponentAlignment(cautionLabel, Alignment.MIDDLE_LEFT);
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_PASSWORD), passwordLayout);
}
}
use of com.vaadin.ui.PasswordField in project Activiti by Activiti.
the class AccountSelectionPopup method initAlfrescoComponent.
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));
}
};
}
use of com.vaadin.ui.PasswordField in project Activiti by Activiti.
the class ChangePasswordPopupWindow method initPasswordFields.
protected void initPasswordFields() {
inputGrid = new GridLayout(2, 2);
inputGrid.setSpacing(true);
layout.addComponent(inputGrid);
layout.setComponentAlignment(inputGrid, Alignment.MIDDLE_CENTER);
Label newPasswordLabel = new Label(i18nManager.getMessage(Messages.PROFILE_NEW_PASSWORD));
inputGrid.addComponent(newPasswordLabel);
passwordField1 = new PasswordField();
passwordField1.setWidth(150, UNITS_PIXELS);
inputGrid.addComponent(passwordField1);
passwordField1.focus();
Label confirmPasswordLabel = new Label(i18nManager.getMessage(Messages.PROFILE_CONFIRM_PASSWORD));
inputGrid.addComponent(confirmPasswordLabel);
passwordField2 = new PasswordField();
passwordField2.setWidth(150, UNITS_PIXELS);
inputGrid.addComponent(passwordField2);
}
Aggregations