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();
}
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);
}
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"));
}
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);
}
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;
}
Aggregations