本文整理汇总了Java中org.apache.wicket.markup.html.form.PasswordTextField.add方法的典型用法代码示例。如果您正苦于以下问题:Java PasswordTextField.add方法的具体用法?Java PasswordTextField.add怎么用?Java PasswordTextField.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.markup.html.form.PasswordTextField
的用法示例。
在下文中一共展示了PasswordTextField.add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitialize
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
input = new PasswordTextField("input", Model.of(getModelObject()));
input.setRequired(false);
input.setResetPassword(false);
add(input);
String autocomplete = EditableUtils.getAutocomplete(getPropertyDescriptor().getPropertyGetter());
if (autocomplete != null)
input.add(AttributeAppender.append("autocomplete", autocomplete));
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例2: AjaxPasswordFieldPanel
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
public AjaxPasswordFieldPanel(
final String id, final String name, final IModel<String> model, final boolean enableOnChange) {
super(id, name, model);
field = new PasswordTextField("passwordField", model);
add(field.setLabel(new ResourceModel(name, name)).setRequired(false).setOutputMarkupId(true));
if (enableOnChange && !isReadOnly()) {
field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget art) {
// nothing to do
}
});
}
}
示例3: onInitialize
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
input = new PasswordTextField("input", Model.of(getModelObject()));
input.setResetPassword(true);
input.setRequired(false);
add(input);
inputAgain = new PasswordTextField("inputAgain", Model.of(getModelObject()));
inputAgain.setResetPassword(true);
inputAgain.setRequired(false);
add(inputAgain);
String autocomplete = EditableUtils.getAutocomplete(getPropertyDescriptor().getPropertyGetter());
if (autocomplete != null) {
input.add(AttributeAppender.append("autocomplete", autocomplete));
inputAgain.add(AttributeAppender.append("autocomplete", autocomplete));
}
add(new AttributeAppender("class", new LoadableDetachableModel<String>() {
@Override
protected String load() {
if (hasErrors(true))
return " has-error";
else
return "";
}
}));
}
示例4: preparePasswordFieldPlaceholder
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
private void preparePasswordFieldPlaceholder() {
PasswordTextField passwordField = (PasswordTextField) get(ID_MAIL_SERVER_CONFIG_CONTAINER + ":" + ID_PASSWORD);
if (getModelObject() != null) {
if (getModelObject().getSelectedServer() != null
&& getModelObject().getSelectedServer().getPassword() != null) {
passwordField.add(new AttributeModifier("placeholder",
createStringResource("SystemConfigPanel.mail.password.placeholder.set")));
} else {
passwordField.add(new AttributeModifier("placeholder",
createStringResource("SystemConfigPanel.mail.password.placeholder.empty")));
}
}
}
示例5: AjaxPasswordFieldPanel
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
public AjaxPasswordFieldPanel(
final String id,
final String name,
final IModel<String> model,
final boolean active) {
super(id, name, model, active);
field = new PasswordTextField("passwordField", model);
field.setRequired(false);
add(field.setLabel(new Model(name)).setOutputMarkupId(true));
if (active) {
field.add(new AjaxFormComponentUpdatingBehavior("onchange") {
private static final long serialVersionUID =
-1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget art) {
// nothing to do
}
});
}
}
示例6: newPwdTextField
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
/**
*
* @return
*/
private PasswordTextField newPwdTextField() {
PasswordTextField pwdField = new PasswordTextField("adapterPassword",
new PropertyModel<String>(adapterSettings, "adapterPassword"));
pwdField.add(new PopoverBehavior(Model.of(""), new StringResourceModel("step7.password.popover.text", this, null), getPopoverConfig(false)));
pwdField.setRequired(false);
return pwdField;
}
示例7: initLayout
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
private void initLayout(final boolean oldPasswordVisible) {
model = (LoadableModel<MyPasswordsDto>) getModel();
Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
add(oldPasswordLabel);
oldPasswordLabel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return oldPasswordVisible;
}
});
Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
add(passwordLabel);
PasswordTextField oldPasswordField =
new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
oldPasswordField.setRequired(false);
oldPasswordField.setResetPassword(false);
add(oldPasswordField);
oldPasswordField.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
public boolean isVisible() {
return oldPasswordVisible;
};
});
PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD));
passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
add(passwordPanel);
WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
List<IColumn<PasswordAccountDto, String>> columns = initColumns();
ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this,
new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS));
TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
accounts.setItemsPerPage(30);
accounts.setShowPaging(false);
if (model.getObject().getPropagation() != null && model.getObject().getPropagation()
.equals(CredentialsPropagationUserControlType.MAPPING)){
accountContainer.setVisible(false);
}
accountContainer.add(accounts);
AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showHelpPerformed(target);
}
};
accountContainer.add(help);
add(accountContainer);
}
示例8: ResetPasswordPanel
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
protected ResetPasswordPanel(String id) {
super(id);
setVersioned(false);
final String passwordGenKey = WicketUtils.getParameter("key");
//If there is no key supplied, redirect to the login page
if (StringUtils.isEmpty(passwordGenKey)) {
setResponse();
return;
}
//If user is found
final UserInfo userInfo = findUserByKey(passwordGenKey);
if (userInfo != null) {
Form resetForm = new SecureForm("resetForm");
resetForm.add(new LabeledValue("description",
"Please choose a new password."));
final PasswordTextField passwordTextField = new PasswordTextField("password", new Model<String>());
passwordTextField.setRequired(true);
passwordTextField.add(PasswordStrengthValidator.getInstance());
resetForm.add(passwordTextField);
PasswordTextField retypedPasswordTextField = new PasswordTextField("retypedPassword", new Model<String>());
retypedPasswordTextField.setRequired(true);
resetForm.add(retypedPasswordTextField);
// validate password and retyped password
resetForm.add(new EqualPasswordInputValidator(passwordTextField, retypedPasswordTextField));
addButton(new TitledAjaxSubmitLink("reset", "Reset My Password", resetForm) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
/**
* We double check the key validity, since after the first reset, the user can back up into the page
* And won't have to pass the validity checks on init
*/
MutableUserInfo user = InfoFactoryHolder.get().copyUser(
userGroupService.findUser(userInfo.getUsername()));
String passwordKey = user.getGenPasswordKey();
if ((StringUtils.isEmpty(passwordKey)) || (!passwordKey.equals(passwordGenKey))) {
invalidKeyResponse();
return;
}
String chosenPassword = passwordTextField.getValue();
user.setPassword(securityService.generateSaltedPassword(chosenPassword));
user.setGenPasswordKey(null);
userGroupService.updateUser(user, false);
log.info("The user: '{}' has successfully reset his password.", user.getUsername());
Session.get().info("Password reset successfully.");
setResponse();
}
});
add(resetForm);
}
}
示例9: RegisterPage
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
public RegisterPage(PageParameters parameters) {
super(parameters);
Form<User> form = new InputValidationForm<User>("form") {
@Override
protected void onSubmit() {
tryToRegister();
}
};
mail = new TextField<>("mail", new PropertyModel<String>(newUser, "mail"));
InputBorder<String> mailValidationBorder = new OnEventInputBeanValidationBorder<>(
"mailValidationBorder", mail,
new StringResourceModel("label.mail", this, null),
new StringResourceModel("help.mail", this, null),
HtmlEvent.ONBLUR);
form.add(mailValidationBorder);
userName = new TextField<>("userName", new PropertyModel<String>(newUser, "userName"));
InputBorder<String> userNameValidationBorder = new OnEventInputBeanValidationBorder<>(
"userNameValidationBorder", userName,
new StringResourceModel("label.userName", this, null),
new StringResourceModel("help.userName", this, null),
HtmlEvent.ONBLUR);
form.add(userNameValidationBorder);
firstName = new TextField<>("firstName", new PropertyModel<String>(newUser, "firstName"));
InputBorder<String> firstNameValidationBorder = new OnEventInputBeanValidationBorder<>(
"firstNameValidationBorder", firstName,
new StringResourceModel("label.firstName", this, null), HtmlEvent.ONBLUR);
form.add(firstNameValidationBorder);
lastName = new TextField<>("lastName", new PropertyModel<String>(newUser, "lastName"));
InputBorder<String> lastNameValidationBorder = new OnEventInputBeanValidationBorder<>(
"lastNameValidationBorder", lastName,
new StringResourceModel("label.lastName", this, null), HtmlEvent.ONBLUR);
form.add(lastNameValidationBorder);
password = new PasswordTextField("password", Model.of(""));
password.add(new PatternValidator(AuthenticationService.PW_PATTERN));
InputBorder<String> passwordValidationBorder = new InputBorder(
"passwordValidationBorder", password,
new StringResourceModel("label.password", this, null),
new StringResourceModel("help.password", this, null));
form.add(passwordValidationBorder);
confirmPassword = new PasswordTextField("confirmPassword", Model.of(""));
InputBorder<String> confirmPasswordValidationBorder = new InputBorder(
"confirmPasswordValidationBorder", confirmPassword,
new StringResourceModel("label.password.confirm", this, null));
form.add(confirmPasswordValidationBorder);
form.add(new EqualPasswordInputValidator(password, confirmPassword));
add(form);
}
示例10: initLayout
import org.apache.wicket.markup.html.form.PasswordTextField; //导入方法依赖的package包/类
private void initLayout(final boolean oldPasswordVisible) {
model = (LoadableModel<MyPasswordsDto>) getModel();
Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel"));
add(oldPasswordLabel);
oldPasswordLabel.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return oldPasswordVisible;
}
});
Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1"));
add(passwordLabel);
PasswordTextField oldPasswordField =
new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD));
oldPasswordField.setRequired(false);
oldPasswordField.setResetPassword(false);
add(oldPasswordField);
oldPasswordField.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
public boolean isVisible() {
return oldPasswordVisible;
};
});
PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD));
passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", ""));
add(passwordPanel);
WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER);
List<IColumn<PasswordAccountDto, String>> columns = initColumns();
ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this,
new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS));
TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns);
accounts.setItemsPerPage(30);
accounts.setShowPaging(false);
if (model.getObject().getPropagation() != null && model.getObject().getPropagation()
.equals(CredentialsPropagationUserControlType.MAPPING)){
accountContainer.setVisible(false);
}
accountContainer.add(accounts);
AjaxLink help = new AjaxLink(ID_BUTTON_HELP) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
showHelpPerformed(target);
}
};
accountContainer.add(help);
add(accountContainer);
}