Java 类com.vaadin.ui.PasswordField 实例源码

项目:osc-core    文件:BaseDAWindow.java   
protected Panel getAttributesPanel() {

        this.sharedKey = new PasswordField();
        this.sharedKey.setRequiredError("shared secret key cannot be empty");
        this.sharedKey.setRequired(true);
        // best show/hide this conditionally based on Manager type.
        this.sharedKey.setValue("dummy1234");

        this.attributes = new Table();
        this.attributes.setPageLength(0);
        this.attributes.setSelectable(true);
        this.attributes.setSizeFull();
        this.attributes.setImmediate(true);

        this.attributes.addContainerProperty("Attribute Name", String.class, null);
        this.attributes.addContainerProperty("Value", PasswordField.class, null);
        this.attributes.addItem(new Object[] { "Shared Secret key", this.sharedKey }, new Integer(1));
        // creating panel to store attributes table
        this.attributePanel = new Panel("Common Appliance Configuration Attributes:");
        this.attributePanel.addStyleName("form_Panel");
        this.attributePanel.setWidth(100, Sizeable.Unit.PERCENTAGE);
        this.attributePanel.setContent(this.attributes);

        return this.attributePanel;
    }
项目:SecureBPMN    文件:AccountSelectionPopup.java   
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));
    }
  };
}
项目:SecureBPMN    文件:ChangePasswordPopupWindow.java   
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);
}
项目:Plugins    文件:VirtuosoLoaderVaadinDialog.java   
@Override
protected void buildDialogLayout() {
    FormLayout mainLayout = new FormLayout();

    // top-level component properties
    setWidth("100%");
    setHeight("100%");

    final PasswordField passwordField = new PasswordField(PASSWORD_LABEL, password);
    passwordField.setWidth("100%");

    mainLayout.addComponent(createTextField(VIRTUOSO_URL_LABEL, virtuosoUrl));
    mainLayout.addComponent(createTextField(USERNAME_LABEL, username));
    mainLayout.addComponent(passwordField);
    mainLayout.addComponent(new CheckBox(CLEAR_DESTINATION_GRAPH_LABEL, clearDestinationGraph));
    mainLayout.addComponent(createTextField(LOAD_DIRECTORY_PATH_LABEL, loadDirectoryPath));
    mainLayout.addComponent(new CheckBox(INCLUDE_SUBDIRECTORIES_LABEL, includeSubdirectories));
    mainLayout.addComponent(createTextField(LOAD_FILE_PATTERN_LABEL, loadFilePattern));
    mainLayout.addComponent(createTextField(TARGET_CONTEXT_LABEL, targetContext));
    mainLayout.addComponent(createTextField(STATUS_UPDATE_INTERVAL_LABEL, statusUpdateInterval));
    mainLayout.addComponent(createTextField(THREAD_COUNT_LABEL, threadCount));
    mainLayout.addComponent(new CheckBox(SKIP_ON_ERROR_LABEL, skipOnError));

    setCompositionRoot(mainLayout);
}
项目:cdi-tutorial    文件:LoginView.java   
@Override
public void enter(ViewChangeEvent event) {

    usernameField = new TextField("Username");
    passwordField = new PasswordField("Password");
    loginButton = new Button("Login");
    loginButton.addClickListener(this);
    loginButton.setClickShortcut(KeyCode.ENTER);

    VerticalLayout layout = new VerticalLayout();
    setCompositionRoot(layout);
    layout.setSizeFull();

    layout.addComponent(usernameField);
    layout.addComponent(passwordField);
    layout.addComponent(loginButton);

}
项目:vaadin-security-template    文件:LoginUI.java   
private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    username.setTabIndex(1);
    username.focus();

    password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    password.setTabIndex(2);

    final Button signin = new Button("Sign In", this);
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.setTabIndex(4);

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    return fields;
}
项目:dhconvalidator    文件:LoginPanel.java   
/**
 * Setup UI.
 */
private void initComponents() {

    userNameInput = new TextField(Messages.getString("LoginPanel.userName"), ""); //$NON-NLS-1$ //$NON-NLS-2$
    userNameInput.focus();
    passwordInput = new PasswordField(Messages.getString("LoginPanel.password"), ""); //$NON-NLS-1$ //$NON-NLS-2$

    btLogin = new Button(Messages.getString("LoginPanel.login")); //$NON-NLS-1$
    btLogin.setClickShortcut(KeyCode.ENTER);

    Label caption = new Label(Messages.getString("LoginPanel.title"), ContentMode.HTML); //$NON-NLS-1$
    caption.addStyleName("login-caption"); //$NON-NLS-1$
    addCenteredComponent(caption);
    addCenteredComponent(userNameInput);
    addCenteredComponent(passwordInput);
    addCenteredComponent(btLogin);      
}
项目:FiWare-Template-Handler    文件:AccountSelectionPopup.java   
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));
    }
  };
}
项目:FiWare-Template-Handler    文件:ChangePasswordPopupWindow.java   
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);
}
项目:VaadinUtils    文件:MultiColumnFormLayout.java   
public PasswordField bindPasswordField(String fieldLabel, String fieldName)
{
    PasswordField field = formHelper.bindPasswordField(this, fieldGroup, fieldLabel, fieldName);

    this.fieldList.add(field);
    return field;
}
项目:osc-core    文件:AdvancedSettingsWindow.java   
@Override
public void populateForm() throws Exception {

    this.providerHttps = new CheckBox("Https");
    this.providerHttps.setValue(false);

    this.rabbitMQIp = new TextField("RabbitMQ IP");
    this.rabbitMQUserName = new TextField("RabbitMQ User Name");
    this.rabbitMQUserName.setRequired(true);
    this.rabbitMQUserPassword = new PasswordField("RabbitMQ Password");
    this.rabbitMQUserPassword.setRequired(true);
    this.rabbitMQPort = new TextField("RabbitMQ Port");
    this.rabbitMQPort.setRequired(true);

    this.rabbitMQUserName.setRequiredError(this.rabbitMQUserName.getCaption() + " cannot be empty");
    this.rabbitMQUserPassword.setRequiredError(this.rabbitMQUserPassword.getCaption() + " cannot be empty");
    this.rabbitMQPort.setRequiredError(this.rabbitMQPort.getCaption() + " cannot be empty");

    //fill this form with default/previous values
    this.providerHttps.setValue(new Boolean(this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_HTTPS)));
    if (this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_IP) != null) {
        this.rabbitMQIp.setValue(this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_IP));
    }
    if (this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_USER) != null) {
        this.rabbitMQUserName.setValue(this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_USER));
    }
    if (this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_USER_PASSWORD) != null) {
        this.rabbitMQUserPassword
                .setValue(this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_USER_PASSWORD));
    }
    if (this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_PORT) != null) {
        this.rabbitMQPort.setValue(this.baseVCWindow.providerAttributes.get(ATTRIBUTE_KEY_RABBITMQ_PORT));
    }

    this.form.addComponent(this.providerHttps);
    this.form.addComponent(this.rabbitMQIp);
    this.form.addComponent(this.rabbitMQUserName);
    this.form.addComponent(this.rabbitMQUserPassword);
    this.form.addComponent(this.rabbitMQPort);
}
项目:osc-core    文件:BaseVCWindow.java   
protected Panel providerPanel() {
    this.providerPanel = new Panel();
    this.providerPanel.setImmediate(true);
    this.providerPanel.setCaption(OPENSTACK_CAPTION);

    this.providerIP = new TextField("IP");
    this.providerIP.setImmediate(true);
    this.adminDomainId = new TextField("Admin Domain Id");
    this.adminDomainId.setImmediate(true);
    this.adminProjectName = new TextField("Admin Project Name");
    this.adminProjectName.setImmediate(true);
    this.providerUser = new TextField("User Name");
    this.providerUser.setImmediate(true);
    this.providerPW = new PasswordField("Password");
    this.providerPW.setImmediate(true);

    // adding not null constraint
    this.adminDomainId.setRequired(true);
    this.adminDomainId.setRequiredError(this.providerPanel.getCaption() + " Admin Domain Id cannot be empty");
    this.adminProjectName.setRequired(true);
    this.adminProjectName.setRequiredError(this.providerPanel.getCaption() + " Admin Project Name cannot be empty");
    this.providerIP.setRequired(true);
    this.providerIP.setRequiredError(this.providerPanel.getCaption() + " IP cannot be empty");
    this.providerUser.setRequired(true);
    this.providerUser.setRequiredError(this.providerPanel.getCaption() + " User Name cannot be empty");
    this.providerPW.setRequired(true);
    this.providerPW.setRequiredError(this.providerPanel.getCaption() + " Password cannot be empty");

    FormLayout providerFormPanel = new FormLayout();
    providerFormPanel.addComponent(this.providerIP);
    providerFormPanel.addComponent(this.adminDomainId);
    providerFormPanel.addComponent(this.adminProjectName);
    providerFormPanel.addComponent(this.providerUser);
    providerFormPanel.addComponent(this.providerPW);
    this.providerPanel.setContent(providerFormPanel);

    return this.providerPanel;
}
项目:osc-core    文件:AddUserWindow.java   
@Override
public void populateForm() {
    this.loginName = new TextField("User Name");
    this.loginName.setImmediate(true);
    this.firstName = new TextField("First Name");
    this.lastName = new TextField("Last Name");
    this.password = new PasswordField("Password");
    this.password.setImmediate(true);
    this.email = new TextField("Email");
    this.email.addValidator(new EmailValidator("Please enter a valid email address"));
    this.role = new ComboBox("Role");
    this.role.setTextInputAllowed(false);
    this.role.setNullSelectionAllowed(false);
    this.role.addItem(UpdateUserWindow.ROLE_ADMIN);
    this.role.select(UpdateUserWindow.ROLE_ADMIN);

    // adding not null constraint
    this.loginName.setRequired(true);
    this.loginName.setRequiredError("User Name cannot be empty");
    this.password.setRequired(true);
    this.password.setRequiredError("Password cannot be empty");
    this.role.setRequired(true);

    this.form.setMargin(true);
    this.form.setSizeUndefined();
    this.form.addComponent(this.loginName);
    this.form.addComponent(this.firstName);
    this.form.addComponent(this.lastName);
    this.form.addComponent(this.password);
    this.form.addComponent(this.email);
    this.form.addComponent(this.role);
    this.loginName.focus();
}
项目:osc-core    文件:PasswordWindow.java   
@Override
public void populateForm() throws Exception {
    this.form.setMargin(true);
       this.form.setSizeUndefined();

       HorizontalLayout layout = new HorizontalLayout();
       this.passwordField = new PasswordField();
       this.passwordField.setRequired(true);

       layout.addComponent(this.passwordField);
       layout.setCaption(VmidcMessages.getString(VmidcMessages_.PASSWORD_CAPTION));

       this.form.addComponent(layout);
}
项目:spring-boot-security-vaadin    文件:LoginUI.java   
@Override
protected void init(VaadinRequest request) {
    setSizeFull();

    user = new TextField("User:");
    user.setWidth("300px");
    user.setRequiredIndicatorVisible(true);

    password = new PasswordField("Password:");
    password.setWidth("300px");
    user.setRequiredIndicatorVisible(true);
    password.setValue("");

    VerticalLayout fields = new VerticalLayout(user, password, loginButton);
    fields.setCaption("Please login to access the application");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    VerticalLayout uiLayout = new VerticalLayout(fields);
    uiLayout.setSizeFull();
    uiLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);

    setFocusedComponent(user);

    setContent(uiLayout);
}
项目:incubator-tamaya-sandbox    文件:LoginBox.java   
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);
    loginForm.setSpacing(true);
    for(Component component:loginForm){
        component.setWidth("100%");
    }
    username.focus();
}
项目:vaadin-vertx-samples    文件:LoginView.java   
private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            DashboardEventBus.post(new UserLoginRequestedEvent(username
                    .getValue(), password.getValue()));
        }
    });
    return fields;
}
项目:hawkbit    文件:AbstractHawkbitLoginUI.java   
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");
}
项目:SecureBPMN    文件:UserDetailPanel.java   
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
  addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_ID), new Label(user.getId())); // details are non-editable
  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);
  }
}
项目:Plugins    文件:FilesUploadVaadinDialog.java   
@Override
protected void buildDialogLayout() {
    setSizeFull();

    final VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setHeight("-1px");
    mainLayout.setMargin(true);
    mainLayout.setSpacing(true);
    mainLayout.setWidth("100%");

    uri = new TextField(ctx.tr("FilesUploadVaadinDialog.uri"));
    uri.setDescription(ctx.tr("FilesUploadVaadinDialog.uri.description"));
    uri.setRequired(true);
    uri.setRequiredError(ctx.tr("FilesUploadVaadinDialog.uri.required"));
    uri.setWidth("100%");

    mainLayout.addComponent(uri);

    username = new TextField(ctx.tr("FilesUploadVaadinDialog.username"));
    username.setWidth("75%");
    mainLayout.addComponent(username);

    password = new PasswordField(ctx.tr("FilesUploadVaadinDialog.password"));
    password.setWidth("75%");
    mainLayout.addComponent(password);

    softFail = new CheckBox(ctx.tr("FilesUploadVaadinDialog.skip"));
    softFail.setWidth("100%");
    mainLayout.addComponent(softFail);

    moveFiles = new CheckBox(ctx.tr("FilesUploadVaadinDialog.move"));
    moveFiles.setWidth("100%");
    mainLayout.addComponent(moveFiles);

    setCompositionRoot(mainLayout);
}
项目:Vaadin4Spring-MVP-Sample-SpringSecurity    文件:SignUpViewImpl.java   
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");  
}
项目:mycollab    文件:PasswordChangeWindow.java   
private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth();

    final Label lbInstruct1 = new Label(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_1));
    mainLayout.addComponent(lbInstruct1);
    mainLayout.setComponentAlignment(lbInstruct1, Alignment.MIDDLE_LEFT);

    final Label lbInstruct2 = new Label(UserUIContext.getMessage(UserI18nEnum.MSG_PASSWORD_INSTRUCT_LABEL_2));
    mainLayout.addComponent(lbInstruct2);
    mainLayout.setComponentAlignment(lbInstruct2, Alignment.MIDDLE_LEFT);

    GridFormLayoutHelper passInfo = GridFormLayoutHelper.defaultFormLayoutHelper(1, 3);

    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(FontAwesome.SAVE).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(ShortcutAction.KeyCode.ENTER);

    MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(new MarginInfo(false, true, false, true));
    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);

    this.setContent(mainLayout);
}
项目:Vaadin4Spring-MVP-Sample-SpringSecuritySocial    文件:SignupContent.java   
private void buildForm() {
    username = new TextField("Username");
    username.setWidth("100%");
    username.setImmediate(true);
    username.setValidationVisible(false);
    username.setNullRepresentation("");
    form.addComponent(username);

    password = new PasswordField("Password");
    password.setWidth("100%");
    password.setImmediate(true);
    password.setValidationVisible(false);
    password.setNullRepresentation("");
    form.addComponent(password);

    firstName = new TextField("First name");
    firstName.setWidth("100%");
    firstName.setValidationVisible(false);
    firstName.setNullRepresentation("");
    firstName.setImmediate(true);
    form.addComponent(firstName);

    lastName = new TextField("Last name");
    lastName.setWidth("100%");
    lastName.setImmediate(true);
    lastName.setNullRepresentation("");
    lastName.setValidationVisible(false);
    form.addComponent(lastName);

    binder.bind(username, "username");
    binder.bind(password, "password");
    binder.bind(firstName, "firstName");
    binder.bind(lastName, "lastName");

}
项目:FiWare-Template-Handler    文件:UserDetailPanel.java   
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
  addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_ID), new Label(user.getId())); // details are non-editable
  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);
  }
}
项目:extacrm    文件:ChangePasswordForm.java   
/** {@inheritDoc} */
    @Override
    protected ComponentContainer createEditFields() {
        final FormLayout form = new ExtaFormLayout();

        passField = new PasswordField("Пароль");
//        passField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
//        passField.setIcon(Fontello.LOCK);
        passField.setImmediate(true);
        passField.setDescription("Введите пароль для входа в систему");
        passField.setInputPrompt("Пароль");
        passField.setRequired(true);
        passField.setRequiredError("Пароль пользователя не может быть пустым.");
        passField.setNullRepresentation("");
        form.addComponent(passField);

        passConfField = new PasswordField("Подтверждение пароля");
//        passConfField.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
//        passConfField.setIcon(Fontello.LOCK);
        passConfField.setImmediate(true);
        passConfField.setDescription("Введите повторно пароль для для его подтвержедения");
        passConfField.setInputPrompt("Подтверждение пароля");
        passConfField.setRequired(true);
        passConfField.setNullRepresentation("");
        // TODO: Сделать симметричную проверку пароля
        passConfField.addValidator(new Validator() {
            private static final long serialVersionUID = 1L;

            @Override
            public void validate(final Object value) throws InvalidValueException {
                if (!value.equals(passField.getValue()))
                    throw new InvalidValueException("Пароли не совпадают!");

            }
        });
        passConfField.setValue(getEntity().getPassword());
        form.addComponent(passConfField);

        return form;
    }
项目:vfs2-file-explorer    文件:ConfigView.java   
private void setVisibleFields(final OptionGroup group, final TextField tfKeyFile, final TextField tfProxyHost, final TextField tfProxyPort,
        final TextField tfUser, final PasswordField tfPw) {
    if (group.getValue() == null)
        group.setValue("FILE");
    String strGroup = group.getValue().toString();
    if (strGroup == "FTP") {
        tfKeyFile.setVisible(false);
        tfProxyHost.setVisible(false);
        tfProxyPort.setVisible(false);
        tfUser.setVisible(true);
        tfPw.setVisible(true);
    } else if (strGroup == "SFTP") {
        tfKeyFile.setVisible(true);
        tfProxyHost.setVisible(true);
        tfProxyPort.setVisible(true);
        tfUser.setVisible(true);
        tfPw.setVisible(true);
    } else {
        // File
        tfKeyFile.setVisible(false);
        tfProxyHost.setVisible(false);
        tfProxyPort.setVisible(false);
        tfUser.setVisible(false);
        tfPw.setVisible(false);

    }
}
项目:bootstrap-for-vaadin    文件:BootstrapDemoUI.java   
private void forms(CssLayout container) {
    VerticalLayout form = new VerticalLayout();
    form.addStyleName(Bootstrap.Forms.FORM.styleName());
    form.setSpacing(true);
    form.setCaption("Legend");

    TextField email = new TextField("Email address");
    email.setInputPrompt("Enter email");
    form.addComponent(email);

    PasswordField password = new PasswordField("Password");
    password.setInputPrompt("Password");
    form.addComponent(password);

    Upload upload = new Upload("File input", null);
    form.addComponent(upload);

    Label help = new Label("Example block-level help text here.");
    help.addStyleName("help-block");
    form.addComponent(help);

    CheckBox check = new CheckBox("Check me out");
    form.addComponent(check);

    Button submit = new Button("Submit");
    submit.addStyleName(Bootstrap.Buttons.DEFAULT.styleName());
    form.addComponent(submit);

    container.addComponent(form);
}
项目:VaadinUtils    文件:FormHelper.java   
public <M> PasswordField bindPasswordField(AbstractLayout form, FieldGroup group, String fieldLabel,
        SingularAttribute<E, M> member)
{
    PasswordField field = bindPasswordField(form, group, fieldLabel, (member != null ? member.getName() : null));
    this.fieldList.add(field);
    return field;
}
项目:VaadinUtils    文件:FormHelper.java   
public PasswordField bindPasswordField(AbstractLayout form, FieldGroup group, String fieldLabel, String fieldName)
{
    PasswordField field = new SplitPasswordField(fieldLabel);
    field.setWidth("100%");
    field.setImmediate(true);
    field.setNullRepresentation("");
    field.setNullSettingAllowed(false);
    field.setId(fieldLabel.replace(" ", ""));
    addValueChangeListeners(field);
    doBinding(group, fieldName, field);
    form.addComponent(field);
    return field;
}
项目:VaadinUtils    文件:MultiColumnFormLayout.java   
public PasswordField bindPasswordField(String fieldLabel, SingularAttribute<E, String> fieldName)
{
    PasswordField field = formHelper.bindPasswordField(this, fieldGroup, fieldLabel, fieldName);

    this.fieldList.add(field);
    return field;
}
项目:VaadinUtils    文件:MultiColumnFormLayout.java   
/**
 * Adds a text field to the form without binding it to the FieldGroup
 * 
 * @param caption
 * @return
 */
public PasswordField addPasswordField(String fieldLabel)
{
    PasswordField field = formHelper.bindPasswordField(this, (ValidatingFieldGroup<?>) null, fieldLabel,
            (SingularAttribute<E, String>) null);
    this.fieldList.add(field);
    return field;
}
项目:jdal    文件:FormUtils.java   
/**
 * 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;
}
项目:javamagazin-009-microkernel    文件:ComponentIDGenerator.java   
static BiFunction<Class, String, String> passwordID() {
  return (uiClass, label) -> genericID().apply(uiClass, PasswordField.class, label);
}
项目:osc-core    文件:BaseVCWindow.java   
protected Panel controllerPanel() {
    this.controllerPanel = new Panel();
    this.controllerPanel.setImmediate(true);
    this.controllerPanel.setCaption(SDN_CONTROLLER_CAPTION);

    this.controllerType = new ComboBox("Type");
    this.controllerType.setTextInputAllowed(false);
    this.controllerType.setNullSelectionAllowed(false);

    this.controllerType.addItem(NO_CONTROLLER_TYPE);
    for (String ct : this.pluginService.getControllerTypes()) {
        this.controllerType.addItem(ct);
    }

    this.controllerType.setVisible(true);

    this.controllerIP = new TextField("IP");
    this.controllerIP.setImmediate(true);
    this.controllerUser = new TextField("User Name");
    this.controllerUser.setImmediate(true);
    this.controllerPW = new PasswordField("Password");
    this.controllerPW.setImmediate(true);

    // adding not null constraint
    this.controllerIP.setRequired(true);
    this.controllerIP.setRequiredError(this.controllerPanel.getCaption() + " IP cannot be empty");
    this.controllerUser.setRequired(true);
    this.controllerUser.setRequiredError(this.controllerPanel.getCaption() + " User Name cannot be empty");
    this.controllerPW.setRequired(true);
    this.controllerPW.setRequiredError(this.controllerPanel.getCaption() + " Password cannot be empty");

    FormLayout sdn = new FormLayout();
    sdn.addComponent(this.controllerType);
    sdn.addComponent(this.controllerIP);
    sdn.addComponent(this.controllerUser);
    sdn.addComponent(this.controllerPW);

    this.controllerPanel.setContent(sdn);

    this.controllerType.addValueChangeListener(event -> updateControllerFields((String) BaseVCWindow.this.controllerType.getValue()));
    this.controllerType.select(NO_CONTROLLER_TYPE);

    return this.controllerPanel;
}
项目:osc-core    文件:UpdateManagerConnectorWindow.java   
@Override
public void populateForm() throws Exception {

    this.name = new TextField("Name");
    this.name.setImmediate(true);
    this.type = new TextField("Type");
    this.type.setImmediate(true);
    this.type.setEnabled(false);
    this.ip = new TextField("IP");
    this.ip.setImmediate(true);
    this.user = new TextField("UserName");
    this.user.setImmediate(true);
    this.pw = new PasswordField("Password");
    this.pw.setImmediate(true);

    this.apiKey = new PasswordField("API Key");
    this.apiKey.setVisible(false);
    this.apiKey.setImmediate(true);
    this.apiKey.setRequired(true);
    this.apiKey.setRequiredError("Api Key cannot be empty");

    // filling fields with existing information
    this.name.setValue(this.currentMCObject.getItemProperty("name").getValue().toString());
    this.type.setValue(this.currentMCObject.getItemProperty("managerType").getValue().toString());
    this.ip.setValue(this.currentMCObject.getItemProperty("ipAddress").getValue().toString());
    if (this.pluginService.isKeyAuth(this.currentMCObject.getItemProperty("managerType")
            .getValue().toString())) {
        this.apiKey.setVisible(true);
        this.apiKey.setValue(this.currentMCObject.getItemProperty("apiKey").getValue().toString());

        this.user.setVisible(false);
        this.user.setValue("");

        this.pw.setVisible(false);
        this.pw.setValue("");

    } else {
        this.apiKey.setVisible(false);

        this.user.setVisible(true);
        this.user.setValue(this.currentMCObject.getItemProperty("username").getValue().toString());

        this.pw.setVisible(true);
        this.pw.setValue(this.currentMCObject.getItemProperty("password").getValue().toString());
    }

    // adding not null constraint
    this.name.setRequired(true);
    this.name.setRequiredError("Name cannot be empty");
    this.type.setRequired(true);
    this.type.setRequiredError("Type cannot be empty");
    this.ip.setRequired(true);
    this.ip.setRequiredError("IP cannot be empty");
    this.user.setRequired(true);
    this.user.setRequiredError("User Name cannot be empty");
    this.pw.setRequired(true);
    this.pw.setRequiredError("Password cannot be empty");

    this.form.setMargin(true);
    this.form.setSizeUndefined();
    this.form.addComponent(this.name);
    this.form.addComponent(this.type);
    this.form.addComponent(this.ip);
    this.ip.focus();
    this.form.addComponent(this.user);
    this.form.addComponent(this.pw);
    this.form.addComponent(this.apiKey);

}
项目:osc-core    文件:UpdateUserWindow.java   
@Override
public void populateForm() {
    this.loginName = new TextField("User Name");
    this.loginName.setImmediate(true);
    this.firstName = new TextField("First Name");
    this.lastName = new TextField("Last Name");
    this.password = new PasswordField("Password");
    this.password.setImmediate(true);
    this.email = new TextField("Email");
    this.email.addValidator(new EmailValidator("Please enter a valid email address"));
    this.role = new ComboBox("Role");
    this.role.setTextInputAllowed(false);
    this.role.setNullSelectionAllowed(false);
    this.role.addItem(UpdateUserWindow.ROLE_ADMIN);
    this.role.select(UpdateUserWindow.ROLE_ADMIN);

    // filling fields with existing information
    this.loginName.setValue(this.currentUser.getItemProperty("loginName").getValue().toString());
    this.loginName.setEnabled(false);
    this.password.setValue(this.currentUser.getItemProperty("password").getValue().toString());
    if (this.currentUser.getItemProperty("email").getValue() != null) {
        this.email.setValue(this.currentUser.getItemProperty("email").getValue().toString());
    }
    if (this.currentUser.getItemProperty("firstName").getValue() != null) {
        this.firstName.setValue(this.currentUser.getItemProperty("firstName").getValue().toString());
    }
    if (this.currentUser.getItemProperty("lastName").getValue() != null) {
        this.lastName.setValue(this.currentUser.getItemProperty("lastName").getValue().toString());
    }
    this.role.setValue(this.currentUser.getItemProperty("role").getValue().toString());

    // adding not null constraint
    this.loginName.setRequired(true);
    this.loginName.setRequiredError("User Name cannot be Empty");
    this.password.setRequired(true);
    this.password.setRequiredError("Password Cannot be empty");
    this.role.setRequired(true);

    this.form.setMargin(true);
    this.form.setSizeUndefined();
    this.form.addComponent(this.loginName);
    this.form.addComponent(this.firstName);
    this.form.addComponent(this.lastName);
    this.form.addComponent(this.password);
    this.form.addComponent(this.email);
    this.form.addComponent(this.role);
    this.firstName.focus();
}
项目:osc-core    文件:SetEmailSettingsWindow.java   
@Override
public void populateForm() {
    this.smtp = new TextField("Outgoing Mail Server (SMTP)");
    this.smtp.setImmediate(true);
    this.port = new TextField("Port");
    this.port.setImmediate(true);
    this.emailId = new TextField("Email Id");
    this.emailId.setImmediate(true);
    this.password = new PasswordField("Password");
    this.password.setImmediate(true);

    // filling form with existing data
    BaseDtoResponse<EmailSettingsDto> res = new BaseDtoResponse<EmailSettingsDto>();
    try {
        res = this.getEmailSettingsService.dispatch(new Request() {
        });

        if (res.getDto() != null) {
            this.smtp.setValue(res.getDto().getMailServer());
            this.port.setValue(res.getDto().getPort());
            this.emailId.setValue(res.getDto().getEmailId());
            this.password.setValue(res.getDto().getPassword());
        }

        // adding not null constraint
        this.smtp.setRequired(true);
        this.smtp.setRequiredError("SMTP server cannot be empty");
        this.port.setRequired(true);
        this.port.setRequiredError("SMTP port cannot be empty");
        this.emailId.setRequired(true);
        this.emailId.setRequiredError("Email Id cannot be empty");

        this.form.addComponent(this.smtp);
        this.smtp.focus();
        this.form.addComponent(this.port);
        this.form.addComponent(this.emailId);
        this.form.addComponent(this.password);

    } catch (Exception ex) {
        log.error("Failed to get email settings", ex);
        ViewUtil.iscNotification("Failed to get email settings (" + ex.getMessage() + ")",
                Notification.Type.ERROR_MESSAGE);
    }

}
项目:vaadin-016-helloworld-14    文件:ComponentIDGenerator.java   
static BiFunction<Class, String, String> passwordID() {
  return (uiClass, label) -> genericID().apply(uiClass, PasswordField.class, label);
}
项目:bbplay    文件:PasswordUI.java   
@SuppressWarnings("serial")
@Override
protected void init(VaadinRequest request) {

    getUI().setLocale(BBPlay.getLanguage(request.getLocale().getLanguage()));
    I18n.init(i18n);
    getPage().setTitle("BBPlay");

    String token = request.getParameter("token");
    if (token == null || token.isEmpty()) {
        BBPlay.error(I18n.t("noToken"));
        return;
    }
    User user = userService.checkToken(token);
    if (user == null) {
        BBPlay.error(I18n.t("wrongPasswordToken"));
        return;
    }

    FormLayout loginForm = new FormLayout();
    loginForm.setSizeUndefined();

    passwordField = new PasswordField(I18n.t("changePassword.new"));
    passwordFieldRepeat = new PasswordField(I18n.t("changePassword.confirm"));
    passwordFieldRepeat.setImmediate(false);
    passwordFieldRepeat.addValidator(new AbstractStringValidator(I18n
            .t("changePassword.errorMatch")) {
        @Override
        protected boolean isValidValue(String value) {
            return value.equals(passwordField.getValue());
        }
    });
    reset = new Button(I18n.t("reset"));

    loginForm.addComponent(passwordField);
    loginForm.addComponent(passwordFieldRepeat);
    loginForm.addComponent(reset);

    reset.addStyleName(ValoTheme.BUTTON_PRIMARY);
    reset.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    reset.addClickListener(event -> reset(user));

    VerticalLayout loginLayout = new VerticalLayout();
    loginLayout.setSpacing(true);
    loginLayout.setSizeUndefined();

    loginLayout.addComponent(loginForm);
    loginLayout.setComponentAlignment(loginForm, Alignment.TOP_CENTER);

    VerticalLayout rootLayout = new VerticalLayout(loginLayout);
    rootLayout.setSizeFull();
    rootLayout.setComponentAlignment(loginLayout, Alignment.MIDDLE_CENTER);
    setContent(rootLayout);
    setSizeFull();

}