use of com.vaadin.ui.TextField in project unity by unity-idm.
the class UsernameIdentityEditor method getEditor.
@Override
public ComponentsContainer getEditor(IdentityEditorContext context) {
this.context = context;
field = new TextField();
setLabel(new UsernameIdentity().getHumanFriendlyName(msg));
field.setId("UsernameIdentityEditor.username");
if (context.isCustomWidth())
field.setWidth(context.getCustomWidth(), context.getCustomWidthUnit());
binder = new SingleStringFieldBinder(msg);
binder.forField(field, context.isRequired()).bind("value");
binder.setBean(new StringBindingValue(""));
return new ComponentsContainer(field);
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class X500IdentityEditor method getEditor.
@Override
public ComponentsContainer getEditor(IdentityEditorContext context) {
binder = new SingleStringFieldBinder(msg);
this.context = context;
field = new TextField();
if (context.isCustomWidth())
field.setWidth(context.getCustomWidth(), context.getCustomWidthUnit());
else
field.setWidth(100, Unit.PERCENTAGE);
Upload upload = new Upload();
upload.setButtonCaption(msg.getMessage("X500IdentityEditor.certUploadCaption"));
upload.addStyleName(Styles.vButtonLink.toString());
CertUploader uploader = new CertUploader();
upload.setReceiver(uploader);
upload.addSucceededListener(uploader);
setLabel(new X500Identity().getHumanFriendlyName(msg));
binder.forField(field, context.isRequired()).withValidator(this::validate).bind("value");
binder.setBean(new StringBindingValue(""));
return new ComponentsContainer(field, upload);
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class EmailConfirmationConfigurationEditor method initUI.
private void initUI() {
binder = new Binder<>(EmailConfirmationConfiguration.class);
msgTemplate = new CompatibleTemplatesComboBox(EmailConfirmationTemplateDef.NAME, msgTemplateMan);
msgTemplate.setCaption(msg.getMessage("EmailConfirmationConfiguration.confirmationMsgTemplate"));
msgTemplate.setDescription(msg.getMessage("EmailConfirmationConfiguration.confirmationMsgTemplateDesc"));
msgTemplate.setEmptySelectionAllowed(true);
validityTime = new TextField(msg.getMessage("EmailConfirmationConfiguration.validityTime"));
addFieldToLayout(this);
binder.forField(msgTemplate).bind("messageTemplate");
binder.forField(validityTime).asRequired(msg.getMessage("fieldRequired")).withConverter(new StringToIntegerConverter(msg.getMessage("notAnIntNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("outOfBoundsNumber", 1, 60 * 24 * 365), 1, 60 * 24 * 365)).bind("validityTime");
if (initial != null) {
binder.setBean(initial);
} else {
EmailConfirmationConfiguration init = new EmailConfirmationConfiguration();
init.setMessageTemplate(msgTemplate.getValue());
init.setValidityTime(EmailConfirmationConfiguration.DEFAULT_VALIDITY);
binder.setBean(init);
}
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class EditIndividualTrustedSPSubView method buildHeaderSection.
private FormLayout buildHeaderSection() {
FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
header.setMargin(true);
TextField name = new TextField(msg.getMessage("EditIndividualTrustedSPSubView.name"));
name.focus();
configBinder.forField(name).asRequired(msg.getMessage("fieldRequired")).withValidator(new NoSpaceValidator(msg)).withValidator((s, c) -> {
if (usedNames.contains(s)) {
return ValidationResult.error(msg.getMessage("EditIndividualTrustedSPSubView.nameExists"));
} else {
return ValidationResult.ok();
}
}).bind("name");
header.addComponent(name);
I18nTextField displayedName = new I18nTextField(msg, msg.getMessage("EditIndividualTrustedSPSubView.displayedName"));
configBinder.forField(displayedName).bind("displayedName");
header.addComponent(displayedName);
ImageField logo = new ImageField(msg, uriAccessService, serverConfig.getFileSizeLimit());
logo.setCaption(msg.getMessage("EditIndividualTrustedSPSubView.logo"));
logo.configureBinding(configBinder, "logo");
header.addComponent(logo);
CheckBox x500Name = new CheckBox(msg.getMessage("EditIndividualTrustedSPSubView.X500NameUse"));
configBinder.forField(x500Name).bind("x500Name");
header.addComponent(x500Name);
TextField id = new TextField(msg.getMessage("EditIndividualTrustedSPSubView.id"));
id.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
configBinder.forField(id).asRequired(msg.getMessage("fieldRequired")).withValidator((s, c) -> {
if (x500Name.getValue()) {
try {
new X500Name(s);
return ValidationResult.ok();
} catch (Exception e) {
return ValidationResult.error(msg.getMessage("EditIndividualTrustedSPSubView.invalidX500Name"));
}
} else {
return ValidationResult.ok();
}
}).bind("id");
header.addComponent(id);
ChipsWithDropdown<String> certificatesCombo = new ChipsWithDropdown<>();
certificatesCombo.setCaption(msg.getMessage("EditIndividualTrustedSPSubView.certificates"));
certificatesCombo.setItems(certificates.stream().collect(Collectors.toList()));
configBinder.forField(certificatesCombo).bind("certificates");
header.addComponent(certificatesCombo);
CheckBox encryptAssertions = new CheckBox(msg.getMessage("EditIndividualTrustedSPSubView.encryptAssertions"));
configBinder.forField(encryptAssertions).bind("encryptAssertions");
header.addComponent(encryptAssertions);
ChipsWithTextfield authorizedURIs = new ChipsWithTextfield(msg);
authorizedURIs.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
authorizedURIs.setCaption(msg.getMessage("EditIndividualTrustedSPSubView.authorizedURIs"));
configBinder.forField(authorizedURIs).withValidator((v, c) -> {
if (v == null || v.isEmpty()) {
return ValidationResult.error(msg.getMessage("fieldRequired"));
}
return ValidationResult.ok();
}).bind("authorizedRedirectsUri");
header.addComponent(authorizedURIs);
return header;
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class EditTrustedFederationSubView method buildHeaderSection.
private FormLayout buildHeaderSection() {
FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
header.setMargin(true);
TextField name = new TextField(msg.getMessage("EditTrustedFederationSubView.name"));
binder.forField(name).asRequired(msg.getMessage("fieldRequired")).withValidator(new NoSpaceValidator(msg)).withValidator((s, c) -> {
if (usedNames.contains(s)) {
return ValidationResult.error(msg.getMessage("EditTrustedFederationSubView.nameExists"));
} else {
return ValidationResult.ok();
}
}).bind("name");
header.addComponent(name);
name.focus();
url = new TextField(msg.getMessage("EditTrustedFederationSubView.url"));
url.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
binder.forField(url).asRequired(msg.getMessage("fieldRequired")).bind("url");
header.addComponent(url);
httpsTruststore = new ComboBox<>(msg.getMessage("EditTrustedFederationSubView.httpsTruststore"));
httpsTruststore.setItems(validators);
binder.forField(httpsTruststore).bind("httpsTruststore");
header.addComponent(httpsTruststore);
CheckBox ignoreSignatureVerification = new CheckBox(msg.getMessage("EditTrustedFederationSubView.ignoreSignatureVerification"));
binder.forField(ignoreSignatureVerification).bind("ignoreSignatureVerification");
header.addComponent(ignoreSignatureVerification);
ComboBox<String> signatureVerificationCertificate = new ComboBox<>(msg.getMessage("EditTrustedFederationSubView.signatureVerificationCertificate"));
signatureVerificationCertificate.setItems(certificates);
binder.forField(signatureVerificationCertificate).asRequired((v, c) -> ((v == null || v.isEmpty()) && !ignoreSignatureVerification.getValue()) ? ValidationResult.error(msg.getMessage("fieldRequired")) : ValidationResult.ok()).bind("signatureVerificationCertificate");
header.addComponent(signatureVerificationCertificate);
TextField refreshInterval = new TextField();
refreshInterval.setCaption(msg.getMessage("EditTrustedFederationSubView.refreshInterval"));
binder.forField(refreshInterval).asRequired(msg.getMessage("fieldRequired")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("refreshInterval");
header.addComponent(refreshInterval);
return header;
}
Aggregations