Search in sources :

Example 1 with PasswordField

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));
        }
    };
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) Form(com.vaadin.ui.Form) CheckBox(com.vaadin.ui.CheckBox) ClickEvent(com.vaadin.ui.Button.ClickEvent) TextField(com.vaadin.ui.TextField) PasswordField(com.vaadin.ui.PasswordField) HashMap(java.util.HashMap) Map(java.util.Map) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 2 with PasswordField

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)));
}
Also used : InvalidValueException(com.vaadin.data.Validator.InvalidValueException) StringLengthValidator(com.vaadin.data.validator.StringLengthValidator) TextField(com.vaadin.ui.TextField) PasswordField(com.vaadin.ui.PasswordField) StringLengthValidator(com.vaadin.data.validator.StringLengthValidator) Validator(com.vaadin.data.Validator)

Example 3 with PasswordField

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);
    }
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Label(com.vaadin.ui.Label) TextField(com.vaadin.ui.TextField) PasswordField(com.vaadin.ui.PasswordField) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 4 with PasswordField

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));
        }
    };
}
Also used : Form(com.vaadin.ui.Form) ClickEvent(com.vaadin.ui.Button.ClickEvent) TextField(com.vaadin.ui.TextField) PasswordField(com.vaadin.ui.PasswordField) HashMap(java.util.HashMap) Map(java.util.Map) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 5 with PasswordField

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);
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Label(com.vaadin.ui.Label) PasswordField(com.vaadin.ui.PasswordField)

Aggregations

PasswordField (com.vaadin.ui.PasswordField)5 TextField (com.vaadin.ui.TextField)4 ClickEvent (com.vaadin.ui.Button.ClickEvent)2 ClickListener (com.vaadin.ui.Button.ClickListener)2 Form (com.vaadin.ui.Form)2 GridLayout (com.vaadin.ui.GridLayout)2 Label (com.vaadin.ui.Label)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)2 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)1 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)1 Validator (com.vaadin.data.Validator)1 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)1 StringLengthValidator (com.vaadin.data.validator.StringLengthValidator)1 CheckBox (com.vaadin.ui.CheckBox)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1