Search in sources :

Example 56 with TextField

use of com.vaadin.ui.TextField in project unity by unity-idm.

the class OTPWithLDAPAuthenticatorEditor method buildUserDNResolvingSection.

private CollapsibleLayout buildUserDNResolvingSection() {
    FormLayoutWithFixedCaptionWidth userDNResolvingLayout = new FormLayoutWithFixedCaptionWidth();
    userDNResolvingLayout.setMargin(false);
    userDNResolvingMode = new RadioButtonGroup<>();
    userDNResolvingMode.setItemCaptionGenerator(v -> msg.getMessage("LdapAuthenticatorEditor.userDNResolvingMode." + v.toString()));
    userDNResolvingMode.setItems(UserDNResolving.values());
    configBinder.forField(userDNResolvingMode).bind("userDNResolving");
    userDNResolvingLayout.addComponent(userDNResolvingMode);
    TextField userDNtemplate = new TextField(msg.getMessage("LdapAuthenticatorEditor.userDNtemplate"));
    userDNtemplate.setPlaceholder("uid={USERNAME},dc=myorg,dc=global");
    userDNtemplate.setDescription(msg.getMessage("LdapAuthenticatorEditor.userDNtemplate.desc"));
    userDNtemplate.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(userDNtemplate).withValidator((v, c) -> {
        if (v != null && v.contains("{USERNAME}") || !userDNResolvingMode.getValue().equals(UserDNResolving.template)) {
            return ValidationResult.ok();
        } else {
            return ValidationResult.error(msg.getMessage("LdapAuthenticatorEditor.invalidUserDNtemplate"));
        }
    }).bind("userDNTemplate");
    userDNResolvingLayout.addComponent(userDNtemplate);
    TextField ldapSearchBaseName = new TextField(msg.getMessage("LdapAuthenticatorEditor.searchSpecification.baseName"));
    ldapSearchBaseName.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(ldapSearchBaseName).asRequired(getLdapSearchRequiredValidator()).bind("ldapSearchBaseName");
    userDNResolvingLayout.addComponent(ldapSearchBaseName);
    TextField ldapSearchFilter = new TextField(msg.getMessage("LdapAuthenticatorEditor.searchSpecification.filter"));
    ldapSearchFilter.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(ldapSearchFilter).withValidator((v, c) -> {
        if (userDNResolvingMode.getValue().equals(UserDNResolving.ldapSearch)) {
            return getFilterValidator().apply(v, c);
        } else {
            return ValidationResult.ok();
        }
    }).bind("ldapSearchFilter");
    userDNResolvingLayout.addComponent(ldapSearchFilter);
    ComboBox<SearchScope> ldapSearchScope = new ComboBox<>(msg.getMessage("LdapAuthenticatorEditor.searchSpecification.scope"));
    ldapSearchScope.setEmptySelectionAllowed(false);
    ldapSearchScope.setItems(SearchScope.values());
    configBinder.forField(ldapSearchScope).bind("ldapSearchScope");
    userDNResolvingLayout.addComponent(ldapSearchScope);
    userDNResolvingMode.addValueChangeListener(e -> {
        UserDNResolving v = userDNResolvingMode.getValue();
        userDNtemplate.setVisible(v.equals(UserDNResolving.template));
        ldapSearchBaseName.setVisible(v.equals(UserDNResolving.ldapSearch));
        ldapSearchFilter.setVisible(v.equals(UserDNResolving.ldapSearch));
        ldapSearchScope.setVisible(v.equals(UserDNResolving.ldapSearch));
        if (v.equals(UserDNResolving.template)) {
            ldapSearchBaseName.clear();
            ldapSearchFilter.clear();
        } else {
            userDNtemplate.clear();
        }
    });
    return new CollapsibleLayout(msg.getMessage("OTPWithLDAPAuthenticatorEditor.userDNResolving"), userDNResolvingLayout);
}
Also used : FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) TextField(com.vaadin.ui.TextField) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) Autowired(org.springframework.beans.factory.annotation.Autowired) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) ValidationResult(com.vaadin.data.ValidationResult) PKIManagement(pl.edu.icm.unity.engine.api.PKIManagement) Validator(com.vaadin.data.Validator) CheckBox(com.vaadin.ui.CheckBox) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) LDAPException(com.unboundid.ldap.sdk.LDAPException) SearchSpecification(pl.edu.icm.unity.ldap.client.config.SearchSpecification) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) TooltipExtension.tooltip(io.imunity.tooltip.TooltipExtension.tooltip) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) Set(java.util.Set) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) Binder(com.vaadin.data.Binder) HashFunction(io.imunity.otp.HashFunction) EngineException(pl.edu.icm.unity.exceptions.EngineException) ObjectFactory(org.springframework.beans.factory.ObjectFactory) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) AuthenticatorEditorFactory(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditorFactory) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) RadioButtonGroup(com.vaadin.ui.RadioButtonGroup) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) Optional(java.util.Optional) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter) Filter(com.unboundid.ldap.sdk.Filter) Unit(com.vaadin.server.Sizeable.Unit) IntStepper(org.vaadin.risto.stepper.IntStepper) Component(com.vaadin.ui.Component) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) ComboBox(com.vaadin.ui.ComboBox) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving)

Example 57 with TextField

use of com.vaadin.ui.TextField in project unity by unity-idm.

the class OTPWithLDAPAuthenticatorEditor method buildServersConnectionConfigurationSection.

private CollapsibleLayout buildServersConnectionConfigurationSection() {
    FormLayoutWithFixedCaptionWidth serverConnectionLayout = new FormLayoutWithFixedCaptionWidth();
    serverConnectionLayout.setMargin(false);
    GridWithEditor<ServerSpecification> serverConfig = new GridWithEditor<>(msg, ServerSpecification.class);
    serverConnectionLayout.addComponent(serverConfig);
    serverConfig.addTextColumn(s -> s.getServer(), (t, v) -> t.setServer(v), msg.getMessage("LdapAuthenticatorEditor.server"), 40, true);
    serverConfig.addIntColumn(s -> s.getPort(), (t, v) -> t.setPort(v), msg.getMessage("LdapAuthenticatorEditor.port"), 10, Optional.of(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 1, 65535)));
    serverConfig.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(serverConfig).withValidator((v, c) -> {
        if (v == null || v.isEmpty()) {
            return ValidationResult.error(msg.getMessage("fieldRequired"));
        } else {
            return ValidationResult.ok();
        }
    }).bind("servers");
    ComboBox<ConnectionMode> connectionMode = new ComboBox<>(msg.getMessage("LdapAuthenticatorEditor.connectionMode"));
    connectionMode.setItems(ConnectionMode.values());
    connectionMode.setEmptySelectionAllowed(false);
    configBinder.forField(connectionMode).bind("connectionMode");
    serverConnectionLayout.addComponent(connectionMode);
    TextField followReferrals = new TextField(msg.getMessage("LdapAuthenticatorEditor.followReferrals"));
    configBinder.forField(followReferrals).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("followReferrals");
    serverConnectionLayout.addComponent(followReferrals);
    TextField searchTimeLimit = new TextField(msg.getMessage("LdapAuthenticatorEditor.searchTimeLimit"));
    configBinder.forField(searchTimeLimit).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("searchTimeLimit");
    serverConnectionLayout.addComponent(searchTimeLimit);
    TextField socketTimeout = new TextField(msg.getMessage("LdapAuthenticatorEditor.socketTimeout"));
    configBinder.forField(socketTimeout).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("socketTimeout");
    serverConnectionLayout.addComponent(socketTimeout);
    CheckBox trustAllCerts = new CheckBox(msg.getMessage("LdapAuthenticatorEditor.trustAllCerts"));
    configBinder.forField(trustAllCerts).bind("trustAllCerts");
    serverConnectionLayout.addComponent(trustAllCerts);
    ComboBox<String> clientTrustStore = new ComboBox<>(msg.getMessage("LdapAuthenticatorEditor.clientTrustStore"));
    clientTrustStore.setItems(validators);
    configBinder.forField(clientTrustStore).bind("clientTrustStore");
    serverConnectionLayout.addComponent(clientTrustStore);
    trustAllCerts.addValueChangeListener(e -> {
        clientTrustStore.setEnabled(!e.getValue());
    });
    TextField resultEntriesLimit = new TextField(msg.getMessage("LdapAuthenticatorEditor.resultEntriesLimit"));
    configBinder.forField(resultEntriesLimit).asRequired(msg.getMessage("notAPositiveNumber")).withConverter(new StringToIntegerConverter(msg.getMessage("notAPositiveNumber"))).withValidator(new IntegerRangeValidator(msg.getMessage("notAPositiveNumber"), 0, null)).bind("resultEntriesLimit");
    serverConnectionLayout.addComponent(resultEntriesLimit);
    return new CollapsibleLayout(msg.getMessage("OTPWithLDAPAuthenticatorEditor.serverConnectionConfiguration"), serverConnectionLayout);
}
Also used : IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) TextField(com.vaadin.ui.TextField) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) Autowired(org.springframework.beans.factory.annotation.Autowired) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) ValidationResult(com.vaadin.data.ValidationResult) PKIManagement(pl.edu.icm.unity.engine.api.PKIManagement) Validator(com.vaadin.data.Validator) CheckBox(com.vaadin.ui.CheckBox) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) LDAPException(com.unboundid.ldap.sdk.LDAPException) SearchSpecification(pl.edu.icm.unity.ldap.client.config.SearchSpecification) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) TooltipExtension.tooltip(io.imunity.tooltip.TooltipExtension.tooltip) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) Set(java.util.Set) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) Binder(com.vaadin.data.Binder) HashFunction(io.imunity.otp.HashFunction) EngineException(pl.edu.icm.unity.exceptions.EngineException) ObjectFactory(org.springframework.beans.factory.ObjectFactory) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) AuthenticatorEditorFactory(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditorFactory) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) RadioButtonGroup(com.vaadin.ui.RadioButtonGroup) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) Optional(java.util.Optional) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter) Filter(com.unboundid.ldap.sdk.Filter) Unit(com.vaadin.server.Sizeable.Unit) IntStepper(org.vaadin.risto.stepper.IntStepper) Component(com.vaadin.ui.Component) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) ComboBox(com.vaadin.ui.ComboBox) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) CheckBox(com.vaadin.ui.CheckBox) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter)

Example 58 with TextField

use of com.vaadin.ui.TextField in project unity by unity-idm.

the class OTPWithLDAPAuthenticatorEditor method buildLdapHeaderSection.

private CollapsibleLayout buildLdapHeaderSection() {
    FormLayoutWithFixedCaptionWidth ldap = new FormLayoutWithFixedCaptionWidth();
    TextField systemDN = new TextField(msg.getMessage("LdapAuthenticatorEditor.systemDN"));
    systemDN.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(systemDN).asRequired().bind("systemDN");
    ldap.addComponent(systemDN);
    TextField systemPassword = new TextField(msg.getMessage("LdapAuthenticatorEditor.systemPassword"));
    systemPassword.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(systemPassword).asRequired().bind("systemPassword");
    ldap.addComponent(systemPassword);
    TextField validUserFilter = new TextField(msg.getMessage("LdapAuthenticatorEditor.validUserFilter"));
    validUserFilter.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(validUserFilter).withValidator((v, c) -> {
        try {
            Filter.create(v);
        } catch (LDAPException e) {
            return ValidationResult.error(msg.getMessage("LdapAuthenticatorEditor.invalidValidUserFilter"));
        }
        return ValidationResult.ok();
    }).bind("validUserFilter");
    ldap.addComponent(validUserFilter);
    TextField secretAttribute = new TextField(msg.getMessage("OTPWithLDAPAuthenticatorEditor.secretAttribute"));
    configBinder.forField(secretAttribute).asRequired().bind("secretAttribute");
    ldap.addComponent(secretAttribute);
    TextField usernameExtractorRegexp = new TextField(msg.getMessage("LdapAuthenticatorEditor.usernameExtractorRegexp"));
    usernameExtractorRegexp.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(usernameExtractorRegexp).bind("usernameExtractorRegexp");
    ldap.addComponent(usernameExtractorRegexp);
    return new CollapsibleLayout(msg.getMessage("OTPWithLDAPAuthenticatorEditor.ldap"), ldap);
}
Also used : FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) TextField(com.vaadin.ui.TextField) PrototypeComponent(pl.edu.icm.unity.engine.api.utils.PrototypeComponent) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) Autowired(org.springframework.beans.factory.annotation.Autowired) ServerSpecification(pl.edu.icm.unity.ldap.client.config.ServerSpecification) ValidationResult(com.vaadin.data.ValidationResult) PKIManagement(pl.edu.icm.unity.engine.api.PKIManagement) Validator(com.vaadin.data.Validator) CheckBox(com.vaadin.ui.CheckBox) UserDNResolving(pl.edu.icm.unity.ldap.client.config.common.LDAPCommonConfiguration.UserDNResolving) AuthenticatorDefinition(pl.edu.icm.unity.types.authn.AuthenticatorDefinition) LDAPException(com.unboundid.ldap.sdk.LDAPException) SearchSpecification(pl.edu.icm.unity.ldap.client.config.SearchSpecification) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) TooltipExtension.tooltip(io.imunity.tooltip.TooltipExtension.tooltip) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) Set(java.util.Set) EnumComboBox(pl.edu.icm.unity.webui.common.EnumComboBox) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) SearchScope(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.SearchScope) Binder(com.vaadin.data.Binder) HashFunction(io.imunity.otp.HashFunction) EngineException(pl.edu.icm.unity.exceptions.EngineException) ObjectFactory(org.springframework.beans.factory.ObjectFactory) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) AuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditor) AuthenticatorEditorFactory(pl.edu.icm.unity.webui.authn.authenticators.AuthenticatorEditorFactory) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ConnectionMode(pl.edu.icm.unity.ldap.client.config.common.LDAPConnectionProperties.ConnectionMode) BaseAuthenticatorEditor(pl.edu.icm.unity.webui.authn.authenticators.BaseAuthenticatorEditor) RadioButtonGroup(com.vaadin.ui.RadioButtonGroup) FormValidationException(pl.edu.icm.unity.webui.common.FormValidationException) Optional(java.util.Optional) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter) Filter(com.unboundid.ldap.sdk.Filter) Unit(com.vaadin.server.Sizeable.Unit) IntStepper(org.vaadin.risto.stepper.IntStepper) Component(com.vaadin.ui.Component) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) LDAPException(com.unboundid.ldap.sdk.LDAPException) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField)

Example 59 with TextField

use of com.vaadin.ui.TextField in project unity by unity-idm.

the class GroupEditDialog method getContents.

@Override
protected Component getContents() {
    FormLayout fl = new CompactFormLayout();
    fl.setMargin(true);
    fl.setSpacing(true);
    path = new TextField(msg.getMessage("GroupEditDialog.groupPath"));
    path.setValue(originalGroup.getPathEncoded());
    path.setReadOnly(true);
    path.setWidthFull();
    fl.addComponent(path);
    displayedName = new I18nTextField(msg, msg.getMessage("displayedNameF"));
    displayedName.setValue(originalGroup.getDisplayedName());
    description = new I18nTextArea(msg, msg.getMessage("GroupEditDialog.groupDesc"));
    description.setValue(originalGroup.getDescription());
    isPublic = new CheckBox(msg.getMessage("GroupEditDialog.public"));
    isPublic.setValue(originalGroup.isPublic());
    propertiesEditor = new GridWithEditor<>(msg, GroupPropertyBean.class, t -> false, false, false);
    propertiesEditor.setCaption(msg.getMessage("GroupEditDialog.groupProperties"));
    propertiesEditor.getEditor().addOpenListener(e -> edited = e.getBean());
    propertiesEditor.addTextColumn(s -> s.key, (t, v) -> t.setKey(v), msg.getMessage("GroupEditDialog.propertyName"), 10, true, Optional.of((value, context) -> {
        if (propertiesEditor.getValue().stream().filter(k -> !k.key.equals(edited.key)).map(k -> k.key).anyMatch(k -> k.equals(value))) {
            return ValidationResult.error(msg.getMessage("GroupEditDialog.propertyNameExists"));
        }
        return new StringLengthValidator(msg.getMessage("maxLength", GroupProperty.MAX_KEY_LENGTH), 0, GroupProperty.MAX_KEY_LENGTH).apply(value, context);
    }));
    propertiesEditor.addTextColumn(s -> s.getValue(), (t, v) -> t.setValue(v), msg.getMessage("GroupEditDialog.propertyValue"), 40, false, Optional.of(new StringLengthValidator(msg.getMessage("maxLength", GroupProperty.MAX_VALUE_LENGHT), 0, GroupProperty.MAX_VALUE_LENGHT)));
    propertiesEditor.setValue(originalGroup.getProperties().values().stream().map(p -> new GroupPropertyBean(p)).collect(Collectors.toList()));
    fl.addComponents(displayedName, description, isPublic, propertiesEditor);
    description.focus();
    return fl;
}
Also used : CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) FormLayout(com.vaadin.ui.FormLayout) StringLengthValidator(com.vaadin.data.validator.StringLengthValidator) CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) TextField(com.vaadin.ui.TextField) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) I18nString(pl.edu.icm.unity.types.I18nString) ValidationResult(com.vaadin.data.ValidationResult) Collectors(java.util.stream.Collectors) GroupProperty(pl.edu.icm.unity.types.basic.GroupProperty) CheckBox(com.vaadin.ui.CheckBox) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) FormLayout(com.vaadin.ui.FormLayout) Optional(java.util.Optional) UserError(com.vaadin.server.UserError) Group(pl.edu.icm.unity.types.basic.Group) I18nTextArea(pl.edu.icm.unity.webui.common.i18n.I18nTextArea) MessageSource(pl.edu.icm.unity.MessageSource) AbstractDialog(pl.edu.icm.unity.webui.common.AbstractDialog) Component(com.vaadin.ui.Component) CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) CheckBox(com.vaadin.ui.CheckBox) StringLengthValidator(com.vaadin.data.validator.StringLengthValidator) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) I18nTextArea(pl.edu.icm.unity.webui.common.i18n.I18nTextArea)

Example 60 with TextField

use of com.vaadin.ui.TextField in project unity by unity-idm.

the class AddFilterDialog method getContents.

@Override
protected Component getContents() {
    Label info = new Label(msg.getMessage("AddFilterDialog.column"));
    column = new ComboBox<>();
    column.setItems(columns.stream().filter(c -> !c.equals(IdentitiesGridColumnConstans.ACTION_COLUMN_ID)).collect(Collectors.toList()));
    column.setEmptySelectionAllowed(false);
    column.setSelectedItem(columns.iterator().next());
    column.setItemCaptionGenerator(i -> {
        if (i.startsWith(IdentitiesGridColumnConstans.ATTR_COL_PREFIX))
            return i.substring(IdentitiesGridColumnConstans.ATTR_COL_PREFIX.length());
        else if (i.startsWith(IdentitiesGridColumnConstans.CRED_STATUS_COL_PREFIX))
            return i.substring(IdentitiesGridColumnConstans.CRED_STATUS_COL_PREFIX.length());
        else
            return msg.getMessage("Identities." + i);
    });
    operand = new EnumComboBox<>(msg, "AddFilterDialog.operand.", Operand.class, Operand.contain);
    argument = new TextField();
    HorizontalLayout filter = new HorizontalLayout();
    filter.setMargin(false);
    filter.addComponents(info, column, operand, argument);
    return filter;
}
Also used : Label(com.vaadin.ui.Label) TextField(com.vaadin.ui.TextField) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Aggregations

TextField (com.vaadin.ui.TextField)185 VerticalLayout (com.vaadin.ui.VerticalLayout)51 CheckBox (com.vaadin.ui.CheckBox)45 Label (com.vaadin.ui.Label)41 Button (com.vaadin.ui.Button)40 ComboBox (com.vaadin.ui.ComboBox)39 HorizontalLayout (com.vaadin.ui.HorizontalLayout)39 FormLayoutWithFixedCaptionWidth (pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth)38 FormLayout (com.vaadin.ui.FormLayout)28 CollapsibleLayout (pl.edu.icm.unity.webui.common.CollapsibleLayout)28 I18nTextField (pl.edu.icm.unity.webui.common.i18n.I18nTextField)27 Binder (com.vaadin.data.Binder)23 StringToIntegerConverter (com.vaadin.data.converter.StringToIntegerConverter)23 Test (org.junit.Test)22 MessageSource (pl.edu.icm.unity.MessageSource)22 Component (com.vaadin.ui.Component)21 ValidationResult (com.vaadin.data.ValidationResult)19 List (java.util.List)18 IntegerRangeValidator (com.vaadin.data.validator.IntegerRangeValidator)17 Set (java.util.Set)17