use of com.vaadin.ui.TextField in project unity by unity-idm.
the class SAMLAuthenticatorEditor method buildSAMLMetadaPublishingSection.
private CollapsibleLayout buildSAMLMetadaPublishingSection() {
FormLayoutWithFixedCaptionWidth metadataPublishing = new FormLayoutWithFixedCaptionWidth();
metadataPublishing.setMargin(false);
CheckBox publishMetadata = new CheckBox(msg.getMessage("SAMLAuthenticatorEditor.publishMetadata"));
configBinder.forField(publishMetadata).bind("publishMetadata");
metadataPublishing.addComponent(publishMetadata);
TextField metadataPath = new TextField(msg.getMessage("SAMLAuthenticatorEditor.metadataPath"));
metadataPath.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
configBinder.forField(metadataPath).asRequired((v, c) -> ((v == null || v.isEmpty()) && publishMetadata.getValue()) ? ValidationResult.error(msg.getMessage("fieldRequired")) : ValidationResult.ok()).bind("metadataPath");
metadataPath.setEnabled(false);
metadataPublishing.addComponent(metadataPath);
signMetadata = new CheckBox(msg.getMessage("SAMLAuthenticatorEditor.signMetadata"));
configBinder.forField(signMetadata).bind("signMetadata");
signMetadata.setEnabled(false);
metadataPublishing.addComponent(signMetadata);
CheckBox autoGenerateMetadata = new CheckBox(msg.getMessage("SAMLAuthenticatorEditor.autoGenerateMetadata"));
configBinder.forField(autoGenerateMetadata).bind("autoGenerateMetadata");
autoGenerateMetadata.setEnabled(false);
metadataPublishing.addComponent(autoGenerateMetadata);
FileField metadataSource = new FileField(msg, "text/xml", "metadata.xml", serverConfig.getFileSizeLimit());
metadataSource.setCaption(msg.getMessage("SAMLAuthenticatorEditor.metadataFile"));
metadataSource.configureBinding(configBinder, "metadataSource", Optional.of((value, context) -> {
if (value != null && value.getLocal() != null) {
try {
EntityDescriptorDocument.Factory.parse(new ByteArrayInputStream(value.getLocal()));
} catch (Exception e) {
return ValidationResult.error(msg.getMessage("SAMLAuthenticatorEditor.invalidMetadataFile"));
}
}
boolean isEmpty = value == null || (value.getLocal() == null && (value.getRemote() == null || value.getRemote().isEmpty()));
if (publishMetadata.getValue() && (!autoGenerateMetadata.getValue() && isEmpty)) {
return ValidationResult.error(msg.getMessage("SAMLAuthenticatorEditor.spMetaEmpty"));
}
return ValidationResult.ok();
}));
metadataSource.setEnabled(false);
metadataPublishing.addComponent(metadataSource);
publishMetadata.addValueChangeListener(e -> {
boolean v = e.getValue();
metadataPath.setEnabled(v);
signMetadata.setEnabled(v);
autoGenerateMetadata.setEnabled(v);
metadataSource.setEnabled(!autoGenerateMetadata.getValue() && v);
});
autoGenerateMetadata.addValueChangeListener(e -> {
metadataSource.setEnabled(!e.getValue() && publishMetadata.getValue());
});
return new CollapsibleLayout(msg.getMessage("SAMLAuthenticatorEditor.metadataPublishing"), metadataPublishing);
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class SAMLAuthenticatorEditor method buildSingleLogoutSection.
private CollapsibleLayout buildSingleLogoutSection() {
FormLayoutWithFixedCaptionWidth singleLogout = new FormLayoutWithFixedCaptionWidth();
singleLogout.setMargin(false);
TextField sloPath = new TextField(msg.getMessage("SAMLAuthenticatorEditor.sloPath"));
configBinder.forField(sloPath).bind("sloPath");
singleLogout.addComponent(sloPath);
ComboBox<String> sloRealm = new ComboBox<>(msg.getMessage("SAMLAuthenticatorEditor.sloRealm"));
sloRealm.setItems(realms);
singleLogout.addComponent(sloRealm);
configBinder.forField(sloRealm).bind("sloRealm");
GridWithEditor<SAMLIdentityMapping> sloMappings = new GridWithEditor<>(msg, SAMLIdentityMapping.class);
sloMappings.setCaption(msg.getMessage("SAMLAuthenticatorEditor.sloMappings"));
singleLogout.addComponent(sloMappings);
sloMappings.addComboColumn(s -> s.getUnityId(), (t, v) -> t.setUnityId(v), msg.getMessage("SAMLAuthenticatorEditor.sloMappings.unityId"), idTypes, 30, false);
sloMappings.addTextColumn(s -> s.getSamlId(), (t, v) -> t.setSamlId(v), msg.getMessage("SAMLAuthenticatorEditor.sloMappings.samlId"), 70, false);
sloMappings.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
configBinder.forField(sloMappings).bind("sloMappings");
return new CollapsibleLayout(msg.getMessage("SAMLAuthenticatorEditor.singleLogout"), singleLogout);
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class GeneralTab method initUI.
public void initUI(Binder<DefaultServiceDefinition> binder, boolean editMode) {
setCaption(msg.getMessage("ServiceEditorBase.general"));
setIcon(Images.cogs.getResource());
mainLayout = new VerticalLayout();
mainLayout.setMargin(false);
FormLayoutWithFixedCaptionWidth mainGeneralLayout = new FormLayoutWithFixedCaptionWidth();
TextField name = new TextField();
name.setCaption(msg.getMessage("ServiceEditorBase.name"));
name.setReadOnly(editMode);
binder.forField(name).asRequired().bind("name");
mainGeneralLayout.addComponent(name);
Label binding = new Label();
binding.setCaption(msg.getMessage("ServiceEditorBase.binding"));
binding.setValue(ServiceTypeInfoHelper.getBinding(msg, type.getSupportedBinding()));
mainGeneralLayout.addComponent(binding);
if (type.getPaths() != null && !type.getPaths().isEmpty() && !type.getPaths().keySet().iterator().next().isEmpty()) {
ChipsWithTextfield paths = new ChipsWithTextfield(msg);
paths.setCaption(msg.getMessage("ServiceEditorBase.paths"));
List<String> pathsList = type.getPaths().keySet().stream().collect(Collectors.toList());
pathsList.set(0, pathsList.get(0).isEmpty() ? "" : pathsList.get(0) + " (" + msg.getMessage("default") + ")");
paths.setValue(pathsList);
paths.setReadOnly(true);
mainGeneralLayout.addComponent(paths);
}
TextField contextPath = new TextField();
contextPath.setCaption(msg.getMessage("ServiceEditorBase.contextPath"));
contextPath.setReadOnly(editMode);
binder.forField(contextPath).asRequired().withValidator((v, c) -> {
return editMode ? validatePathForEdit(v) : validatePathForAdd(v);
}).bind("address");
mainGeneralLayout.addComponent(contextPath);
I18nTextField displayedName = new I18nTextField(msg);
displayedName.setCaption(msg.getMessage("ServiceEditorBase.displayedName"));
binder.forField(displayedName).bind("displayedName");
mainGeneralLayout.addComponent(displayedName);
TextField description = new DescriptionTextField(msg);
binder.forField(description).bind("description");
mainGeneralLayout.addComponent(description);
mainLayout.addComponent(mainGeneralLayout);
setCompositionRoot(mainLayout);
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class WebServiceAuthenticationTab method buildRegistrationSection.
private Component buildRegistrationSection() {
FormLayoutWithFixedCaptionWidth main = new FormLayoutWithFixedCaptionWidth();
main.setMargin(false);
CheckBox enableRegistration = new CheckBox();
enableRegistration.setCaption(msg.getMessage("WebServiceEditorBase.enableRegistration"));
webConfigBinder.forField(enableRegistration).bind("enableRegistration");
main.addComponent(enableRegistration);
CheckBox showRegistrationFormsInHeader = new CheckBox();
showRegistrationFormsInHeader.setCaption(msg.getMessage("WebServiceEditorBase.showRegistrationFormsInHeader"));
showRegistrationFormsInHeader.setEnabled(false);
webConfigBinder.forField(showRegistrationFormsInHeader).bind("showRegistrationFormsInHeader");
main.addComponent(showRegistrationFormsInHeader);
TextField externalRegistrationURL = new TextField();
externalRegistrationURL.setEnabled(false);
externalRegistrationURL.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
externalRegistrationURL.setCaption(msg.getMessage("WebServiceEditorBase.externalRegistrationURL"));
webConfigBinder.forField(externalRegistrationURL).bind("externalRegistrationURL");
main.addComponent(externalRegistrationURL);
ChipsWithDropdown<String> regFormsCombo = new ChipsWithDropdown<>();
regFormsCombo.setEnabled(false);
regFormsCombo.setCaption(msg.getMessage("WebServiceEditorBase.registrationForms"));
regFormsCombo.setItems(registrationForms);
webConfigBinder.forField(regFormsCombo).bind("registrationForms");
main.addComponent(regFormsCombo);
enableRegistration.addValueChangeListener(e -> {
boolean v = e.getValue();
showRegistrationFormsInHeader.setEnabled(v);
externalRegistrationURL.setEnabled(v);
regFormsCombo.setEnabled(v);
});
CollapsibleLayout regSection = new CollapsibleLayout(msg.getMessage("WebServiceEditorBase.usersRegistration"), main);
regSection.expand();
return regSection;
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class GetRegistrationCodeDialog method getContents.
@Override
protected Component getContents() throws Exception {
VerticalLayout main = new VerticalLayout();
main.setMargin(false);
main.addComponent(new Label(information));
FormLayout sub = new FormLayout();
codeTextField = new TextField(codeCaption);
codeTextField.setWidth("70%");
binder = new Binder<>(CodeBean.class);
binder.forField(codeTextField).asRequired(msg.getMessage("fieldRequired")).bind("code");
binder.setBean(new CodeBean());
sub.addComponent(codeTextField);
main.addComponent(sub);
return main;
}
Aggregations