当前位置: 首页>>代码示例>>Java>>正文


Java PasswordField.setValue方法代码示例

本文整理汇总了Java中com.vaadin.ui.PasswordField.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java PasswordField.setValue方法的具体用法?Java PasswordField.setValue怎么用?Java PasswordField.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.ui.PasswordField的用法示例。


在下文中一共展示了PasswordField.setValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.vaadin.ui.PasswordField; //导入方法依赖的package包/类
@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);
}
 
开发者ID:kuylim,项目名称:spring-boot-security-vaadin,代码行数:28,代码来源:LoginUI.java

示例2: createEditFields

import com.vaadin.ui.PasswordField; //导入方法依赖的package包/类
/** {@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;
    }
 
开发者ID:ExtaSoft,项目名称:extacrm,代码行数:41,代码来源:ChangePasswordForm.java

示例3: buildFields

import com.vaadin.ui.PasswordField; //导入方法依赖的package包/类
private Component buildFields() {
	HorizontalLayout fields = new HorizontalLayout();
	fields.setSpacing(true);
	fields.addStyleName("fields");

	final TextField username = new TextField("Username");
	// Pre-populate for convenience
	username.setValue("admin");
	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);
	password.setValue("[email protected]");

	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() {
		/**
		 * 
		 */
		private static final long serialVersionUID = -8816421044737741430L;

		@Override
		public void buttonClick(final ClickEvent event) {
			try {
				VaadinServletService.getCurrentServletRequest().login(
						username.getValue(), password.getValue());
			} catch (ServletException e) {
				Notification.show("Authentication Failed");
				return;
			}
			Page.getCurrent().setLocation("secured");
		}
	});
	return fields;
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:45,代码来源:LoginUI.java


注:本文中的com.vaadin.ui.PasswordField.setValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。