Java Code Examples for org.apache.wicket.markup.html.form.PasswordTextField#setLabel()

The following examples show how to use org.apache.wicket.markup.html.form.PasswordTextField#setLabel() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PasswordPropertyEditor.java    From onedev with MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	input = new PasswordTextField("input", Model.of(getModelObject()));
	input.setRequired(false);
	input.setResetPassword(false);
	input.setLabel(Model.of(getDescriptor().getDisplayName()));
	add(input);

	Password password = getDescriptor().getPropertyGetter().getAnnotation(Password.class);
	String autoComplete = password.autoComplete();
	if (StringUtils.isNotBlank(autoComplete))
		input.add(AttributeAppender.append("autocomplete", autoComplete));
	input.add(new OnTypingDoneBehavior() {

		@Override
		protected void onTypingDone(AjaxRequestTarget target) {
			onPropertyUpdating(target);
		}
		
	});
}
 
Example 2
Source File: SecureStringEditor.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * Construct simple text editor.
 *
 * @param id         editor id.
 * @param markupProvider markup object.
 * @param model      model.
 * @param labelModel label model
 * @param errorLabelModel error label model
 * @param attrValue  {@link org.yes.cart.domain.entity.AttrValue}
 * @param readOnly  if true this component is read only
 */
public SecureStringEditor(final String id,
                          final MarkupContainer markupProvider,
                          final IModel<String> model,
                          final IModel<String> labelModel,
                          final IModel<String> errorLabelModel,
                          final AttrValueWithAttribute attrValue,
                          final boolean readOnly) {

    super(id, "secureStringEditor", markupProvider);

    final PasswordTextField textField = new PasswordTextField(EDIT, model);

    textField.setLabel(labelModel);
    textField.setRequired(attrValue.getAttribute().isMandatory());
    textField.setEnabled(!readOnly);

    if (StringUtils.isNotBlank(attrValue.getAttribute().getRegexp())) {
        textField.add(new CustomPatternValidator(attrValue.getAttribute().getRegexp(), errorLabelModel));
    }
    textField.add(new AttributeModifier("placeholder", labelModel));
    add(textField);
}
 
Example 3
Source File: ChangePasswordPopupPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, ChangePasswordPopupPanel.class);
	
	passwordForm = new Form<Void>("form");
	body.add(passwordForm);
	
	newPasswordField = new PasswordTextField("newPassword", Model.of(""));
	newPasswordField.setLabel(new ResourceModel("administration.user.field.newPassword"));
	newPasswordField.setRequired(true);
	passwordForm.add(newPasswordField);
	
	confirmPasswordField = new PasswordTextField("confirmPassword", Model.of(""));
	confirmPasswordField.setLabel(new ResourceModel("administration.user.field.confirmPassword"));
	confirmPasswordField.setRequired(true);
	passwordForm.add(confirmPasswordField);
	
	return body;
}
 
Example 4
Source File: UserFormPopupPanel.java    From artifact-listener with Apache License 2.0 4 votes vote down vote up
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, UserFormPopupPanel.class);
	
	userForm = new Form<User>("form", getModel());
	body.add(userForm);
	
	TextField<String> emailField = new EmailTextField("email", BindingModel.of(userForm.getModel(),
			Binding.user().email())) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(UserFormPopupPanel.this.isAddMode());
		}
	};
	emailField.setLabel(new ResourceModel("administration.user.field.email"));
	emailField.setRequired(isAddMode());
	userForm.add(emailField);
	
	TextField<String> fullNameField = new TextField<String>("fullName", BindingModel.of(userForm.getModel(),
			Binding.user().fullName()));
	fullNameField.setLabel(new ResourceModel("administration.user.field.fullName"));
	userForm.add(fullNameField);
	
	WebMarkupContainer passwordContainer = new WebMarkupContainer("passwordContainer") {
		private static final long serialVersionUID = 2727669661139358058L;
		
		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(UserFormPopupPanel.this.isAddMode());
		}
	};
	userForm.add(passwordContainer);
	
	CheckBox activeField = new CheckBox("active", BindingModel.of(userForm.getModel(), Binding.user().active()));
	activeField.setLabel(new ResourceModel("administration.user.field.active"));
	passwordContainer.add(activeField);
	
	newPasswordField = new PasswordTextField("newPassword", Model.of(""));
	newPasswordField.setLabel(new ResourceModel("administration.user.field.password"));
	newPasswordField.setRequired(true);
	passwordContainer.add(newPasswordField);
	
	confirmPasswordField = new PasswordTextField("confirmPassword", Model.of(""));
	confirmPasswordField.setLabel(new ResourceModel("administration.user.field.confirmPassword"));
	confirmPasswordField.setRequired(true);
	passwordContainer.add(confirmPasswordField);
	
	LocaleDropDownChoice localeField = new LocaleDropDownChoice("locale", BindingModel.of(userForm.getModel(), Binding.user().locale()));
	localeField.setLabel(new ResourceModel("administration.user.field.locale"));
	userForm.add(localeField);
	
	return body;
}