本文整理汇总了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);
}
示例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;
}
示例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;
}