Search in sources :

Example 71 with TextField

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

the class AttributePolicyConfigurationEditor method init.

private void init() {
    binder = new Binder<>(AttributePolicyBean.class);
    main = new VerticalLayout();
    FormLayoutWithFixedCaptionWidth header = new FormLayoutWithFixedCaptionWidth();
    header.setMargin(false);
    main.addComponent(header);
    name = new TextField(msg.getMessage("AttributePolicyConfigurationEditor.name"));
    header.addComponent(name);
    binder.forField(name).bind("name");
    ChipsWithDropdown<String> targetIdps = new ChipsWithDropdown<>(p -> getDisplayeName(p), true);
    targetIdps.setItems(idPs.keySet());
    targetIdps.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    targetIdps.setCaption(msg.getMessage("AttributePolicyConfigurationEditor.targetIdps"));
    binder.forField(targetIdps).bind("targetIdps");
    header.addComponent(targetIdps);
    ChipsWithDropdown<String> targetFederations = new ChipsWithDropdown<>(p -> getGroupDisplayeName(p), true);
    targetFederations.setItems(IdPsGroups.keySet());
    targetFederations.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    targetFederations.setCaption(msg.getMessage("AttributePolicyConfigurationEditor.targetFederations"));
    binder.forField(targetFederations).bind("targetFederations");
    header.addComponent(targetFederations);
    AttributesGrid attributes = new AttributesGrid(msg);
    binder.forField(attributes).bind("attributes");
    main.addComponent(attributes);
    binder.addValueChangeListener(e -> fireEvent(new ValueChangeEvent<>(this, getValue(), true)));
}
Also used : FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) ChipsWithDropdown(pl.edu.icm.unity.webui.common.chips.ChipsWithDropdown)

Example 72 with TextField

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

the class RegistrationFormEditor method initDisplaySettingsTab.

private void initDisplaySettingsTab() throws EngineException {
    FormLayout main = new CompactFormLayout();
    initCommonDisplayedFields();
    title2ndStage = new I18nTextField(msg, msg.getMessage("RegistrationFormViewer.title2ndStage"));
    showGotoSignin = new CheckBox(msg.getMessage("RegistrationFormViewer.showGotoSignin"));
    showGotoSignin.addValueChangeListener(v -> signInUrl.setEnabled(showGotoSignin.getValue()));
    signInUrl = new TextField(msg.getMessage("RegistrationFormEditor.signinURL"));
    signInUrl.setWidth(100, Unit.PERCENTAGE);
    signInUrl.setEnabled(false);
    showCancel = new CheckBox(msg.getMessage("FormLayoutEditor.showCancel"));
    localSignupEmbeddedAsButton = new CheckBox(msg.getMessage("FormLayoutEditor.localSignupEmbeddedAsButton"));
    switchToEnquiryInfo = new I18nTextArea(msg, msg.getMessage("RegistrationFormEditor.switchToEnquiryInfo"));
    switchToEnquiryInfo.setValue(RegistrationForm.getDefaultSwitchToEnquiryInfo(msg));
    tooltip(switchToEnquiryInfo, msg.getMessage("RegistrationFormEditor.switchToEnquiryInfo.tip"));
    main.addComponents(displayedName, title2ndStage, formInformation, switchToEnquiryInfo, pageTitle, showGotoSignin, signInUrl, showCancel, localSignupEmbeddedAsButton);
    layoutSettingsEditor = new RegistrationFormLayoutSettingsEditor(msg, serverConfig, fileStorageService, uriAccessService, imageAccessService);
    VerticalLayout wrapper = new VerticalLayout(main, layoutSettingsEditor);
    wrapper.setMargin(true);
    wrapper.setSpacing(false);
    tabs.addTab(wrapper, msg.getMessage("RegistrationFormViewer.displayTab"));
}
Also used : CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) FormLayout(com.vaadin.ui.FormLayout) CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) CheckBox(com.vaadin.ui.CheckBox) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) VerticalLayout(com.vaadin.ui.VerticalLayout) I18nTextArea(pl.edu.icm.unity.webui.common.i18n.I18nTextArea)

Example 73 with TextField

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

the class RegistrationFormLayoutSettingsEditor method initUI.

private void initUI() {
    FormLayout main = new FormLayout();
    main.setSpacing(true);
    CheckBox compactInputs = new CheckBox(msg.getMessage("FormLayoutEditor.compactInputs"));
    ImageField logo = new ImageField(msg, uriAccessService, serverConfig.getFileSizeLimit());
    logo.setCaption(msg.getMessage("FormLayoutEditor.logo"));
    logo.setDescription(msg.getMessage("FormLayoutEditor.logoDesc"));
    TextField columnWidth = new TextField(msg.getMessage("FormLayoutEditor.columnWidth"));
    ComboBox<String> columnWidthUnit = new NotNullComboBox<>(msg.getMessage("FormLayoutEditor.columnWidthUnit"));
    columnWidthUnit.setItems(Stream.of(Unit.values()).map(Unit::toString));
    main.addComponents(logo, columnWidth, columnWidthUnit, compactInputs);
    setCompositionRoot(main);
    binder = new Binder<>(FormLayoutSettingsWithLogo.class);
    binder.forField(compactInputs).bind("compactInputs");
    logo.configureBinding(binder, "logo");
    binder.forField(columnWidth).asRequired(msg.getMessage("fieldRequired")).withConverter(new StringToFloatConverter(msg.getMessage("FormLayoutEditor.columnWidth.mustBeFloat"))).withValidator(new FloatRangeValidator(msg.getMessage("FormLayoutEditor.columnWidth.mustBePositive"), 0f, Float.MAX_VALUE)).bind("columnWidth");
    binder.forField(columnWidthUnit).asRequired(msg.getMessage("fieldRequired")).bind("columnWidthUnit");
    binder.setBean(new FormLayoutSettingsWithLogo(FormLayoutSettings.DEFAULT, imageAccessService));
}
Also used : FormLayout(com.vaadin.ui.FormLayout) StringToFloatConverter(com.vaadin.data.converter.StringToFloatConverter) ImageField(pl.edu.icm.unity.webui.common.file.ImageField) CheckBox(com.vaadin.ui.CheckBox) NotNullComboBox(pl.edu.icm.unity.webui.common.NotNullComboBox) FloatRangeValidator(com.vaadin.data.validator.FloatRangeValidator) TextField(com.vaadin.ui.TextField)

Example 74 with TextField

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

the class LdapAuthenticatorEditor method buildGroupRetrievalSettingsSection.

private CollapsibleLayout buildGroupRetrievalSettingsSection() {
    FormLayoutWithFixedCaptionWidth groupRetSettingsLayout = new FormLayoutWithFixedCaptionWidth();
    groupRetSettingsLayout.setMargin(false);
    CheckBox delegateGroupFiltering = new CheckBox(msg.getMessage("LdapAuthenticatorEditor.delegateGroupFiltering"));
    configBinder.forField(delegateGroupFiltering).bind("delegateGroupFiltering");
    groupRetSettingsLayout.addComponent(delegateGroupFiltering);
    TextField groupsBaseName = new TextField(msg.getMessage("LdapAuthenticatorEditor.groupsBaseName"));
    groupsBaseName.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(groupsBaseName).bind("groupsBaseName");
    groupRetSettingsLayout.addComponent(groupsBaseName);
    TextField memberOfAttribute = new TextField(msg.getMessage("LdapAuthenticatorEditor.memberOfAttribute"));
    memberOfAttribute.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(memberOfAttribute).bind("memberOfAttribute");
    groupRetSettingsLayout.addComponent(memberOfAttribute);
    TextField memberOfGroupAttribute = new TextField(msg.getMessage("LdapAuthenticatorEditor.memberOfGroupAttribute"));
    memberOfGroupAttribute.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(memberOfGroupAttribute).bind("memberOfGroupAttribute");
    groupRetSettingsLayout.addComponent(memberOfGroupAttribute);
    GridWithEditor<GroupSpecification> groupConfig = new GridWithEditor<>(msg, GroupSpecification.class);
    groupConfig.setCaption(msg.getMessage("LdapAuthenticatorEditor.groupSpecifications"));
    groupRetSettingsLayout.addComponent(groupConfig);
    groupConfig.addTextColumn(s -> s.getMatchByMemberAttribute(), (t, v) -> t.setMatchByMemberAttribute(v), msg.getMessage("LdapAuthenticatorEditor.groupSpecification.matchByMemberAttribute"), 20, false);
    groupConfig.addTextColumn(s -> s.getMemberAttribute(), (t, v) -> t.setMemberAttribute(v), msg.getMessage("LdapAuthenticatorEditor.groupSpecification.memberAttribute"), 20, true);
    groupConfig.addTextColumn(s -> s.getGroupNameAttribute(), (t, v) -> t.setGroupNameAttribute(v), msg.getMessage("LdapAuthenticatorEditor.groupSpecification.nameAttribute"), 20, false);
    groupConfig.addTextColumn(s -> s.getObjectClass(), (t, v) -> t.setObjectClass(v), msg.getMessage("LdapAuthenticatorEditor.groupSpecification.objectClass"), 20, true);
    groupConfig.setWidth(100, Unit.PERCENTAGE);
    configBinder.forField(groupConfig).bind("groupSpecifications");
    return new CollapsibleLayout(msg.getMessage("LdapAuthenticatorEditor.groupRetrievalSettings"), groupRetSettingsLayout);
}
Also used : CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) CheckBox(com.vaadin.ui.CheckBox) GroupSpecification(pl.edu.icm.unity.ldap.client.config.GroupSpecification) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor)

Example 75 with TextField

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

the class LdapAuthenticatorEditor method buildAdvancedAttributeSearchSettingsSection.

private CollapsibleLayout buildAdvancedAttributeSearchSettingsSection() {
    FormLayoutWithFixedCaptionWidth advancedAttrSearchLayout = new FormLayoutWithFixedCaptionWidth();
    advancedAttrSearchLayout.setMargin(false);
    ChipsWithTextfield retrievalLdapAttr = new ChipsWithTextfield(msg);
    retrievalLdapAttr.setCaption(msg.getMessage("LdapAuthenticatorEditor.retrievedAttributes"));
    advancedAttrSearchLayout.addComponent(retrievalLdapAttr);
    configBinder.forField(retrievalLdapAttr).bind("retrievalLdapAttributes");
    GridWithEditor<SearchSpecification> searchConfig = new GridWithEditor<>(msg, SearchSpecification.class);
    searchConfig.setCaption(msg.getMessage("LdapAuthenticatorEditor.searchSpecifications"));
    advancedAttrSearchLayout.addComponent(searchConfig);
    searchConfig.addTextColumn(s -> s.getBaseDN(), (t, v) -> t.setBaseDN(v), msg.getMessage("LdapAuthenticatorEditor.searchSpecification.baseName"), 30, true);
    searchConfig.addTextColumn(s -> s.getFilter(), (t, v) -> t.setFilter(v), msg.getMessage("LdapAuthenticatorEditor.searchSpecification.filter"), 30, true, Optional.of(getFilterValidator()));
    searchConfig.addTextColumn(s -> s.getAttributes(), (t, v) -> t.setAttributes(v), msg.getMessage("LdapAuthenticatorEditor.searchSpecification.attributes"), 20, true);
    searchConfig.addComboColumn(s -> s.getScope(), (t, v) -> t.setScope(v), SearchScope.class, msg.getMessage("LdapAuthenticatorEditor.searchSpecification.scope"), 10);
    searchConfig.setWidth(100, Unit.PERCENTAGE);
    configBinder.forField(searchConfig).bind("searchSpecifications");
    TextField usernameExtractorRegexp = new TextField(msg.getMessage("LdapAuthenticatorEditor.usernameExtractorRegexp"));
    usernameExtractorRegexp.setWidth(FieldSizeConstans.WIDE_FIELD_WIDTH, FieldSizeConstans.WIDE_FIELD_WIDTH_UNIT);
    configBinder.forField(usernameExtractorRegexp).bind("usernameExtractorRegexp");
    advancedAttrSearchLayout.addComponent(usernameExtractorRegexp);
    return new CollapsibleLayout(msg.getMessage("LdapAuthenticatorEditor.advancedAttributeSearchSettings"), advancedAttrSearchLayout);
}
Also used : SearchSpecification(pl.edu.icm.unity.ldap.client.config.SearchSpecification) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) TextField(com.vaadin.ui.TextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor)

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