Search in sources :

Example 1 with DescriptionTextField

use of pl.edu.icm.unity.webui.common.widgets.DescriptionTextField in project unity by unity-idm.

the class TranslationProfileEditor method initUI.

protected void initUI() {
    rulesLayout = new VerticalLayout();
    rulesLayout.setSpacing(false);
    rulesLayout.setMargin(false);
    rulesLayout.setHeightUndefined();
    rulesLayout.setWidth(100, Unit.PERCENTAGE);
    rulesLayout.setStyleName(Styles.vDropLayout.toString());
    name = new TextField(msg.getMessage("TranslationProfileEditor.name"));
    description = new DescriptionTextField(msg);
    rulesHeader = new HorizontalLayout();
    rulesHeader.setMargin(false);
    addRule = new Button();
    addRule.setDescription(msg.getMessage("TranslationProfileEditor.newRule"));
    addRule.setIcon(Images.add.getResource());
    addRule.addStyleName(Styles.vButtonLink.toString());
    addRule.addStyleName(Styles.toolbarButton.toString());
    addRule.addClickListener(event -> addRuleComponent(null));
    testProfileButton = new StartStopButton();
    testProfileButton.setVisible(false);
    testProfileButton.setDescription(msg.getMessage("TranslationProfileEditor.testProfile"));
    testProfileButton.addClickListener(new StartStopButton.StartStopListener() {

        @Override
        public void onStop(ClickStopEvent event) {
            clearTestResults();
        }

        @Override
        public void onStart(ClickStartEvent event) {
            testRules();
        }
    });
    Label t = new Label(msg.getMessage("TranslationProfileEditor.rules"));
    rulesHeader.addComponents(t, addRule, testProfileButton);
    FormLayout main = new CompactFormLayout();
    main.addComponents(name, description);
    main.setSizeFull();
    VerticalLayout wrapper = new VerticalLayout();
    wrapper.addComponents(main, rulesHeader, rulesLayout);
    binder = new Binder<>(TranslationProfile.class);
    binder.forField(name).asRequired(msg.getMessage("fieldRequired")).bind("name");
    binder.bind(description, "description");
    binder.setBean(new TranslationProfile(msg.getMessage("TranslationProfileEditor.defaultName"), null, type, new ArrayList<TranslationRule>()));
    setSpacing(false);
    setMargin(false);
    addComponents(wrapper);
    refreshRules();
}
Also used : CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) FormLayout(com.vaadin.ui.FormLayout) CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) TranslationProfile(pl.edu.icm.unity.types.translation.TranslationProfile) ClickStartEvent(io.imunity.webconsole.tprofile.StartStopButton.ClickStartEvent) Label(com.vaadin.ui.Label) ArrayList(java.util.ArrayList) HorizontalLayout(com.vaadin.ui.HorizontalLayout) ClickStopEvent(io.imunity.webconsole.tprofile.StartStopButton.ClickStopEvent) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField)

Example 2 with DescriptionTextField

use of pl.edu.icm.unity.webui.common.widgets.DescriptionTextField in project unity by unity-idm.

the class CredentialRequirementEditor method init.

private void init(CredentialRequirements initial, Collection<CredentialDefinition> allCredentials) {
    setWidth(100, Unit.PERCENTAGE);
    TextField name = new TextField(msg.getMessage("CredentialRequirements.name"));
    addComponent(name);
    if (initial != null)
        name.setReadOnly(true);
    DescriptionTextField description = new DescriptionTextField(msg);
    addComponent(description);
    TwinColSelect<String> requiredCredentials = new TwinColSelect<>(msg.getMessage("CredentialRequirements.credentials"));
    requiredCredentials.setLeftColumnCaption(msg.getMessage("CredentialRequirements.available"));
    requiredCredentials.setRightColumnCaption(msg.getMessage("CredentialRequirements.chosen"));
    requiredCredentials.setWidth(48, Unit.EM);
    requiredCredentials.setRows(5);
    requiredCredentials.setItems(allCredentials.stream().map(cr -> cr.getName()));
    addComponent(requiredCredentials);
    CredentialRequirements cr = initial == null ? new CredentialRequirements(msg.getMessage("CredentialRequirements.defaultName"), "", new HashSet<>()) : initial;
    binder = new Binder<>(CredentialRequirements.class);
    binder.forField(name).asRequired(msg.getMessage("fieldRequired")).bind("name");
    binder.bind(description, "description");
    binder.bind(requiredCredentials, "requiredCredentials");
    binder.setBean(cr);
}
Also used : HashSet(java.util.HashSet) CompactFormLayout(pl.edu.icm.unity.webui.common.CompactFormLayout) TextField(com.vaadin.ui.TextField) TwinColSelect(com.vaadin.ui.TwinColSelect) CredentialDefinition(pl.edu.icm.unity.types.authn.CredentialDefinition) Collection(java.util.Collection) CredentialRequirements(pl.edu.icm.unity.types.authn.CredentialRequirements) Binder(com.vaadin.data.Binder) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) MessageSource(pl.edu.icm.unity.MessageSource) IllegalCredentialException(pl.edu.icm.unity.exceptions.IllegalCredentialException) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) CredentialRequirements(pl.edu.icm.unity.types.authn.CredentialRequirements) TextField(com.vaadin.ui.TextField) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) TwinColSelect(com.vaadin.ui.TwinColSelect) HashSet(java.util.HashSet)

Example 3 with DescriptionTextField

use of pl.edu.icm.unity.webui.common.widgets.DescriptionTextField in project unity by unity-idm.

the class BaseFormEditor method initNameAndDescFields.

protected void initNameAndDescFields(String defaultName) throws EngineException {
    name = new TextField(msg.getMessage("RegistrationFormEditor.name"));
    name.setValue(defaultName);
    description = new DescriptionTextField(msg);
    checkIdentityOnSubmit = new CheckBox(msg.getMessage("RegistrationFormEditor.checkIdentityOnSubmit"));
}
Also used : DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) CheckBox(com.vaadin.ui.CheckBox) TextField(com.vaadin.ui.TextField) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField)

Example 4 with DescriptionTextField

use of pl.edu.icm.unity.webui.common.widgets.DescriptionTextField 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);
}
Also used : ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) CustomComponent(com.vaadin.ui.CustomComponent) ServiceEditorTab(pl.edu.icm.unity.webui.console.services.ServiceEditorComponent.ServiceEditorTab) TextField(com.vaadin.ui.TextField) ServiceTypeInfoHelper(pl.edu.icm.unity.webui.console.services.ServiceTypeInfoHelper) VerticalLayout(com.vaadin.ui.VerticalLayout) WrongArgumentException(pl.edu.icm.unity.exceptions.WrongArgumentException) Set(java.util.Set) ValidationResult(com.vaadin.data.ValidationResult) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) Collectors(java.util.stream.Collectors) Binder(com.vaadin.data.Binder) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) EndpointPathValidator(pl.edu.icm.unity.engine.api.endpoint.EndpointPathValidator) Images(pl.edu.icm.unity.webui.common.Images) List(java.util.List) EndpointTypeDescription(pl.edu.icm.unity.types.endpoint.EndpointTypeDescription) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) EditorTab(pl.edu.icm.unity.webui.console.services.ServiceEditorBase.EditorTab) Label(com.vaadin.ui.Label) DefaultServiceDefinition(pl.edu.icm.unity.webui.console.services.DefaultServiceDefinition) MessageSource(pl.edu.icm.unity.MessageSource) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) ChipsWithTextfield(pl.edu.icm.unity.webui.common.chips.ChipsWithTextfield) Label(com.vaadin.ui.Label) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField)

Example 5 with DescriptionTextField

use of pl.edu.icm.unity.webui.common.widgets.DescriptionTextField in project unity by unity-idm.

the class SAMLEditorGeneralTab method buildHeaderSection.

private Component buildHeaderSection() {
    HorizontalLayout main = new HorizontalLayout();
    main.setMargin(new MarginInfo(true, false));
    FormLayoutWithFixedCaptionWidth mainGeneralLayout = new FormLayoutWithFixedCaptionWidth();
    main.addComponent(mainGeneralLayout);
    metaLinkButton = new Button();
    metaOffInfo = new Label();
    metaOffInfo.setCaption(msg.getMessage("SAMLEditorGeneralTab.metadataOff"));
    infoLayout = new HorizontalLayout();
    infoLayout.setMargin(new MarginInfo(false, true, false, true));
    infoLayout.setStyleName("u-marginLeftMinus30");
    infoLayout.addStyleName("u-border");
    VerticalLayout wrapper = new VerticalLayout();
    wrapper.setMargin(false);
    infoLayout.addComponent(wrapper);
    wrapper.addComponent(new Label(msg.getMessage("SAMLEditorGeneralTab.importantURLs")));
    FormLayout infoLayoutWrapper = new FormLayout();
    infoLayoutWrapper.setSpacing(false);
    infoLayoutWrapper.setMargin(false);
    wrapper.addComponent(infoLayoutWrapper);
    metaLinkButtonWrapper = new HorizontalLayout();
    metaLinkButtonWrapper.setCaption(msg.getMessage("SAMLEditorGeneralTab.metadataLink"));
    metaLinkButton.setStyleName(Styles.vButtonLink.toString());
    metaLinkButtonWrapper.addComponent(metaLinkButton);
    infoLayoutWrapper.addComponent(metaLinkButtonWrapper);
    infoLayoutWrapper.addComponent(metaOffInfo);
    metaOffInfo.setVisible(false);
    metaLinkButton.addClickListener(e -> {
        Page.getCurrent().open(metaLinkButton.getCaption(), "_blank", false);
    });
    main.addComponent(infoLayout);
    refreshMetaButton(false);
    TextField name = new TextField();
    name.setCaption(msg.getMessage("ServiceEditorBase.name"));
    name.setReadOnly(editMode);
    samlServiceBinder.forField(name).asRequired().bind("name");
    mainGeneralLayout.addComponent(name);
    TextField contextPath = new TextField();
    contextPath.setPlaceholder("/saml-idp");
    contextPath.setRequiredIndicatorVisible(true);
    contextPath.setCaption(msg.getMessage("SAMLEditorGeneralTab.contextPath"));
    contextPath.setReadOnly(editMode);
    samlServiceBinder.forField(contextPath).withValidator((v, c) -> {
        ValidationResult r;
        if (editMode) {
            r = validatePathForEdit(v);
        } else {
            r = validatePathForAdd(v);
        }
        if (!r.isError()) {
            metaLinkButton.setCaption(serverPrefix + v + "/metadata");
        }
        return r;
    }).bind("address");
    mainGeneralLayout.addComponent(contextPath);
    I18nTextField displayedName = new I18nTextField(msg);
    displayedName.setCaption(msg.getMessage("ServiceEditorBase.displayedName"));
    samlServiceBinder.forField(displayedName).bind("displayedName");
    mainGeneralLayout.addComponent(displayedName);
    TextField description = new DescriptionTextField(msg);
    samlServiceBinder.forField(description).bind("description");
    mainGeneralLayout.addComponent(description);
    TextField issuerURI = new TextField();
    issuerURI.setWidth(FieldSizeConstans.LINK_FIELD_WIDTH, FieldSizeConstans.LINK_FIELD_WIDTH_UNIT);
    issuerURI.setCaption(msg.getMessage("SAMLEditorGeneralTab.issuerURI"));
    configBinder.forField(issuerURI).asRequired().bind("issuerURI");
    mainGeneralLayout.addComponent(issuerURI);
    ComboBox<AssertionSigningPolicy> signAssertionPolicy = new ComboBox<>();
    signAssertionPolicy.setItems(AssertionSigningPolicy.values());
    signAssertionPolicy.setEmptySelectionAllowed(false);
    signAssertionPolicy.setCaption(msg.getMessage("SAMLEditorGeneralTab.signAssertionPolicy"));
    configBinder.forField(signAssertionPolicy).asRequired().bind("signAssertionPolicy");
    mainGeneralLayout.addComponent(signAssertionPolicy);
    ComboBox<ResponseSigningPolicy> signResponcePolicy = new ComboBox<>();
    signResponcePolicy.setItems(ResponseSigningPolicy.values());
    signResponcePolicy.setEmptySelectionAllowed(false);
    signResponcePolicy.setCaption(msg.getMessage("SAMLEditorGeneralTab.signResponcePolicy"));
    configBinder.forField(signResponcePolicy).asRequired().bind("signResponcePolicy");
    mainGeneralLayout.addComponent(signResponcePolicy);
    ComboBox<String> signResponseCredential = new ComboBox<>();
    signResponseCredential.setCaption(msg.getMessage("SAMLEditorGeneralTab.signResponseCredential"));
    signResponseCredential.setItems(credentials);
    configBinder.forField(signResponseCredential).asRequired((v, c) -> ((v == null || v.isEmpty())) ? ValidationResult.error(msg.getMessage("fieldRequired")) : ValidationResult.ok()).bind("signResponseCredential");
    mainGeneralLayout.addComponent(signResponseCredential);
    ComboBox<String> httpsTruststore = new ComboBox<>(msg.getMessage("SAMLEditorGeneralTab.httpsTruststore"));
    httpsTruststore.setItems(truststores);
    configBinder.forField(httpsTruststore).bind("httpsTruststore");
    mainGeneralLayout.addComponent(httpsTruststore);
    CheckBox skipConsentScreen = new CheckBox(msg.getMessage("SAMLEditorGeneralTab.skipConsentScreen"));
    configBinder.forField(skipConsentScreen).bind("skipConsentScreen");
    mainGeneralLayout.addComponent(skipConsentScreen);
    CheckBox editableConsentScreen = new CheckBox(msg.getMessage("SAMLEditorGeneralTab.editableConsentScreen"));
    configBinder.forField(editableConsentScreen).bind("editableConsentScreen");
    mainGeneralLayout.addComponent(editableConsentScreen);
    skipConsentScreen.addValueChangeListener(e -> editableConsentScreen.setEnabled(!e.getValue()));
    ComboBox<RequestAcceptancePolicy> acceptPolicy = new ComboBox<>();
    acceptPolicy.setItems(RequestAcceptancePolicy.values());
    acceptPolicy.setEmptySelectionAllowed(false);
    acceptPolicy.setCaption(msg.getMessage("SAMLEditorGeneralTab.acceptPolicy"));
    configBinder.forField(acceptPolicy).asRequired().bind("requestAcceptancePolicy");
    mainGeneralLayout.addComponent(acceptPolicy);
    return main;
}
Also used : FormLayout(com.vaadin.ui.FormLayout) FieldSizeConstans(pl.edu.icm.unity.webui.common.FieldSizeConstans) CustomComponent(com.vaadin.ui.CustomComponent) TextField(com.vaadin.ui.TextField) VerticalLayout(com.vaadin.ui.VerticalLayout) ComboBox(com.vaadin.ui.ComboBox) ValidationResult(com.vaadin.data.ValidationResult) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) OutputTranslationProfileFieldFactory(io.imunity.webconsole.utils.tprofile.OutputTranslationProfileFieldFactory) IdentityType(pl.edu.icm.unity.types.basic.IdentityType) UnityServerConfiguration(pl.edu.icm.unity.engine.api.config.UnityServerConfiguration) ByteArrayInputStream(java.io.ByteArrayInputStream) CheckBox(com.vaadin.ui.CheckBox) EditorTab(pl.edu.icm.unity.webui.console.services.ServiceEditorBase.EditorTab) Page(com.vaadin.server.Page) Label(com.vaadin.ui.Label) DefaultServiceDefinition(pl.edu.icm.unity.webui.console.services.DefaultServiceDefinition) AssertionSigningPolicy(pl.edu.icm.unity.saml.idp.SamlIdpProperties.AssertionSigningPolicy) MessageSource(pl.edu.icm.unity.MessageSource) IntegerRangeValidator(com.vaadin.data.validator.IntegerRangeValidator) RequestAcceptancePolicy(pl.edu.icm.unity.saml.idp.SamlIdpProperties.RequestAcceptancePolicy) ServiceEditorTab(pl.edu.icm.unity.webui.console.services.ServiceEditorComponent.ServiceEditorTab) CollapsibleLayout(pl.edu.icm.unity.webui.common.CollapsibleLayout) ResponseSigningPolicy(pl.edu.icm.unity.saml.idp.SamlIdpProperties.ResponseSigningPolicy) GridWithEditor(pl.edu.icm.unity.webui.common.GridWithEditor) Collection(java.util.Collection) WrongArgumentException(pl.edu.icm.unity.exceptions.WrongArgumentException) Set(java.util.Set) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) Collectors(java.util.stream.Collectors) Binder(com.vaadin.data.Binder) MarginInfo(com.vaadin.shared.ui.MarginInfo) EndpointPathValidator(pl.edu.icm.unity.engine.api.endpoint.EndpointPathValidator) Images(pl.edu.icm.unity.webui.common.Images) FileField(pl.edu.icm.unity.webui.common.file.FileField) List(java.util.List) Button(com.vaadin.ui.Button) SAMLIdentityMapping(pl.edu.icm.unity.saml.console.SAMLIdentityMapping) SubViewSwitcher(pl.edu.icm.unity.webui.common.webElements.SubViewSwitcher) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) HorizontalLayout(com.vaadin.ui.HorizontalLayout) EntityDescriptorDocument(xmlbeans.org.oasis.saml2.metadata.EntityDescriptorDocument) FormLayout(com.vaadin.ui.FormLayout) Styles(pl.edu.icm.unity.webui.common.Styles) Optional(java.util.Optional) IntStepper(org.vaadin.risto.stepper.IntStepper) Component(com.vaadin.ui.Component) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) ComboBox(com.vaadin.ui.ComboBox) Label(com.vaadin.ui.Label) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ValidationResult(com.vaadin.data.ValidationResult) AssertionSigningPolicy(pl.edu.icm.unity.saml.idp.SamlIdpProperties.AssertionSigningPolicy) HorizontalLayout(com.vaadin.ui.HorizontalLayout) FormLayoutWithFixedCaptionWidth(pl.edu.icm.unity.webui.common.FormLayoutWithFixedCaptionWidth) Button(com.vaadin.ui.Button) MarginInfo(com.vaadin.shared.ui.MarginInfo) CheckBox(com.vaadin.ui.CheckBox) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.ui.TextField) DescriptionTextField(pl.edu.icm.unity.webui.common.widgets.DescriptionTextField) I18nTextField(pl.edu.icm.unity.webui.common.i18n.I18nTextField) ResponseSigningPolicy(pl.edu.icm.unity.saml.idp.SamlIdpProperties.ResponseSigningPolicy) RequestAcceptancePolicy(pl.edu.icm.unity.saml.idp.SamlIdpProperties.RequestAcceptancePolicy)

Aggregations

TextField (com.vaadin.ui.TextField)8 DescriptionTextField (pl.edu.icm.unity.webui.common.widgets.DescriptionTextField)8 Binder (com.vaadin.data.Binder)5 Label (com.vaadin.ui.Label)5 MessageSource (pl.edu.icm.unity.MessageSource)5 I18nTextField (pl.edu.icm.unity.webui.common.i18n.I18nTextField)5 ValidationResult (com.vaadin.data.ValidationResult)4 Button (com.vaadin.ui.Button)4 CheckBox (com.vaadin.ui.CheckBox)4 HorizontalLayout (com.vaadin.ui.HorizontalLayout)4 VerticalLayout (com.vaadin.ui.VerticalLayout)4 Collection (java.util.Collection)4 Collectors (java.util.stream.Collectors)4 ComboBox (com.vaadin.ui.ComboBox)3 Component (com.vaadin.ui.Component)3 CustomComponent (com.vaadin.ui.CustomComponent)3 FormLayout (com.vaadin.ui.FormLayout)3 List (java.util.List)3 Set (java.util.Set)3 EndpointPathValidator (pl.edu.icm.unity.engine.api.endpoint.EndpointPathValidator)3