use of com.vaadin.ui.TextField in project unity by unity-idm.
the class EditOAuthProviderSubView method buildHeaderSection.
private FormLayoutWithFixedCaptionWidth buildHeaderSection(Set<String> providersIds) {
FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
header.setMargin(true);
loadTemplates();
templateCombo = new ComboBox<>();
templateCombo.setCaption(msg.getMessage("EditOAuthProviderSubView.template"));
templateCombo.setItems(templates.keySet().stream().sorted());
templateCombo.setEmptySelectionAllowed(false);
configBinder.forField(templateCombo).asRequired(msg.getMessage("fieldRequired")).bind("type");
if (!editMode) {
header.addComponent(templateCombo);
}
TextField id = new TextField(msg.getMessage("EditOAuthProviderSubView.id"));
configBinder.forField(id).asRequired(msg.getMessage("fieldRequired")).withValidator((s, c) -> {
if (providersIds.contains(s)) {
return ValidationResult.error(msg.getMessage("EditOAuthProviderSubView.idExists"));
} else {
return ValidationResult.ok();
}
}).withValidator(new NoSpaceValidator(msg)).bind("id");
id.setReadOnly(editMode);
header.addComponent(id);
I18nTextField name = new I18nTextField(msg, msg.getMessage("EditOAuthProviderSubView.name"));
configBinder.forField(name).asRequired(msg.getMessage("fieldRequired")).bind("name");
header.addComponent(name);
TextField clientId = new TextField(msg.getMessage("EditOAuthProviderSubView.clientId"));
clientId.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
configBinder.forField(clientId).asRequired(msg.getMessage("fieldRequired")).bind("clientId");
header.addComponent(clientId);
TextField clientSecret = new TextField(msg.getMessage("EditOAuthProviderSubView.clientSecret"));
clientSecret.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
configBinder.forField(clientSecret).asRequired(msg.getMessage("fieldRequired")).bind("clientSecret");
header.addComponent(clientSecret);
ChipsWithTextfield requestedScopes = new ChipsWithTextfield(msg);
requestedScopes.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
requestedScopes.setCaption(msg.getMessage("EditOAuthProviderSubView.requestedScopes"));
header.addComponent(requestedScopes);
configBinder.forField(requestedScopes).bind("requestedScopes");
ImageField logo = new ImageField(msg, uriAccessService, serverConfig.getFileSizeLimit());
logo.setCaption(msg.getMessage("EditOAuthProviderSubView.logo"));
logo.configureBinding(configBinder, "logo");
header.addComponent(logo);
CheckBox openIdConnect = new CheckBox(msg.getMessage("EditOAuthProviderSubView.openIdConnect"));
configBinder.forField(openIdConnect).bind("openIdConnect");
header.addComponent(openIdConnect);
TextField openIdDiscovery = new TextField(msg.getMessage("EditOAuthProviderSubView.openIdDiscoverEndpoint"));
openIdDiscovery.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
configBinder.forField(openIdDiscovery).asRequired(getOpenIdFieldValidator(openIdConnect, true)).bind("openIdDiscoverEndpoint");
openIdDiscovery.setVisible(false);
openIdDiscovery.setRequiredIndicatorVisible(false);
header.addComponent(openIdDiscovery);
openIdConnect.addValueChangeListener(e -> openIdDiscovery.setVisible(e.getValue()));
TextField authenticationEndpoint = new TextField(msg.getMessage("EditOAuthProviderSubView.authenticationEndpoint"));
configBinder.forField(authenticationEndpoint).asRequired(getOpenIdFieldValidator(openIdConnect, false)).bind("authenticationEndpoint");
authenticationEndpoint.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
authenticationEndpoint.setRequiredIndicatorVisible(false);
header.addComponent(authenticationEndpoint);
TextField accessTokenEndpoint = new TextField(msg.getMessage("EditOAuthProviderSubView.accessTokenEndpoint"));
accessTokenEndpoint.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
configBinder.forField(accessTokenEndpoint).asRequired(getOpenIdFieldValidator(openIdConnect, false)).bind("accessTokenEndpoint");
accessTokenEndpoint.setRequiredIndicatorVisible(false);
header.addComponent(accessTokenEndpoint);
TextField profileEndpoint = new TextField(msg.getMessage("EditOAuthProviderSubView.profileEndpoint"));
profileEndpoint.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
configBinder.forField(profileEndpoint).bind("profileEndpoint");
header.addComponent(profileEndpoint);
return header;
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class OAuthAuthenticatorEditor method getEditor.
@Override
public Component getEditor(AuthenticatorDefinition toEdit, SubViewSwitcher subViewSwitcher, boolean forceNameEditable) {
this.subViewSwitcher = subViewSwitcher;
boolean editMode = init(msg.getMessage("OAuthAuthenticatorEditor.defaultName"), toEdit, forceNameEditable);
configBinder = new Binder<>(OAuthConfiguration.class);
FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
header.setMargin(true);
header.addComponent(name);
CheckBox accountAssociation = new CheckBox(msg.getMessage("OAuthAuthenticatorEditor.accountAssociation"));
header.addComponent(accountAssociation);
TextField returnURLInfo = new TextField();
returnURLInfo.setValue(buildReturnURL());
returnURLInfo.setReadOnly(true);
returnURLInfo.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
CopyToClipboardButton copy = new CopyToClipboardButton(msg, returnURLInfo);
HorizontalLayout hr = new HorizontalLayout(returnURLInfo, copy);
hr.setComponentAlignment(copy, Alignment.MIDDLE_LEFT);
hr.setCaption(msg.getMessage("OAuthAuthenticatorEditor.returnURLInfo"));
header.addComponent(hr);
configBinder.forField(accountAssociation).bind("defAccountAssociation");
providersComponent = new ProvidersComponent();
providersComponent.setCaption(msg.getMessage("OAuthAuthenticatorEditor.providers"));
configBinder.forField(providersComponent).bind("providers");
header.addComponent(providersComponent);
VerticalLayout mainView = new VerticalLayout();
mainView.setMargin(false);
mainView.addComponent(header);
OAuthConfiguration config = new OAuthConfiguration();
if (editMode) {
config.fromProperties(toEdit.configuration, msg, pkiMan, imageAccessService);
}
configBinder.setBean(config);
return mainView;
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class OAuthRPAuthenticatorEditor method buildHeaderSection.
private FormLayout buildHeaderSection() {
FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
header.setMargin(true);
header.addComponent(name);
TextField clientId = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.clientId"));
clientId.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
configBinder.forField(clientId).asRequired(msg.getMessage("fieldRequired")).bind("clientId");
header.addComponent(clientId);
TextField clientSecret = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.clientSecret"));
clientSecret.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
configBinder.forField(clientSecret).asRequired(msg.getMessage("fieldRequired")).bind("clientSecret");
header.addComponent(clientSecret);
ChipsWithTextfield requiredScopes = new ChipsWithTextfield(msg);
requiredScopes.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
requiredScopes.setCaption(msg.getMessage("OAuthRPAuthenticatorEditor.requiredScopes"));
header.addComponent(requiredScopes);
configBinder.forField(requiredScopes).bind("requiredScopes");
ComboBox<VerificationProtocol> verificationProtocol = new ComboBox<>(msg.getMessage("OAuthRPAuthenticatorEditor.verificationProtocol"));
verificationProtocol.setItems(VerificationProtocol.values());
verificationProtocol.setEmptySelectionAllowed(false);
configBinder.forField(verificationProtocol).bind("verificationProtocol");
header.addComponent(verificationProtocol);
TextField verificationEndpoint = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.verificationEndpoint"));
verificationEndpoint.setWidth(LINK_FIELD_WIDTH, Unit.EM);
verificationEndpoint.setRequiredIndicatorVisible(false);
configBinder.forField(verificationEndpoint).asRequired((v, c) -> {
if (verificationProtocol.getValue() != VerificationProtocol.internal && v.isEmpty()) {
return ValidationResult.error(msg.getMessage("fieldRequired"));
} else {
return ValidationResult.ok();
}
}).bind("verificationEndpoint");
header.addComponent(verificationEndpoint);
TextField profileEndpoint = new TextField(msg.getMessage("OAuthRPAuthenticatorEditor.profileEndpoint"));
profileEndpoint.setWidth(LINK_FIELD_WIDTH, Unit.EM);
configBinder.forField(profileEndpoint).bind("profileEndpoint");
header.addComponent(profileEndpoint);
return header;
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class MobileNumberConfirmationDialog method getConfirmCodeComponent.
private Component getConfirmCodeComponent() {
field = new TextField();
field.setCaption(msg.getMessage("MobileNumberConfirmationDialog.code"));
field.setRequiredIndicatorVisible(true);
Label infoLabel = new Label(msg.getMessage("MobileNumberConfirmationDialog.confirmInfo", mobileToConfirm));
infoLabel.setSizeFull();
errorLabel = new Label();
errorLabel.setSizeFull();
errorLabel.setVisible(false);
errorLabel.setStyleName(Styles.error.toString());
CompactFormLayout mainForm = new CompactFormLayout();
mainForm.addComponents(field, errorLabel);
VerticalLayout wrapper = new VerticalLayout();
wrapper.setMargin(false);
wrapper.addComponents(infoLabel, mainForm);
return wrapper;
}
use of com.vaadin.ui.TextField in project unity by unity-idm.
the class IdentifierIdentityEditor method getEditor.
@Override
public ComponentsContainer getEditor(IdentityEditorContext context) {
binder = new SingleStringFieldBinder(msg);
this.context = context;
field = new TextField();
setLabel(new IdentifierIdentity().getHumanFriendlyName(msg));
if (context.isCustomWidth())
field.setWidth(context.getCustomWidth(), context.getCustomWidthUnit());
binder.forField(field, context.isRequired()).bind("value");
binder.setBean(new StringBindingValue(""));
return new ComponentsContainer(field);
}
Aggregations