diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java index 480b9c5d50a..f0dc3632eb4 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppModalPanelBuilder.java @@ -45,11 +45,11 @@ import org.apache.syncope.client.console.wicket.markup.html.form.PolicyRenderer; import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.BinaryFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.MultiFieldPanel; import org.apache.syncope.client.ui.commons.pages.BaseWebPage; @@ -318,16 +318,18 @@ protected void onUpdate(final AjaxRequestTarget target) { "field", "idTokenIssuer", new PropertyModel<>(clientAppTO, "idTokenIssuer"), false); fields.add(idTokenIssuer); - AjaxCheckBoxPanel signIdToken = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel signIdToken = new AjaxTripleStateButtonPanel( "field", "signIdToken", new PropertyModel<>(clientAppTO, "signIdToken")); + signIdToken.addRequiredLabel(); fields.add(signIdToken); AjaxDropDownChoicePanel idTokenSigningAlg = new AjaxDropDownChoicePanel<>( "field", "idTokenSigningAlg", new PropertyModel<>(clientAppTO, "idTokenSigningAlg"), false); idTokenSigningAlg.setChoices(List.of(OIDCTokenSigningAlg.values())); fields.add(idTokenSigningAlg.addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( - "field", "encryptIdToken", new PropertyModel<>(clientAppTO, "encryptIdToken"))); + fields.add(new AjaxTripleStateButtonPanel( + "field", "encryptIdToken", new PropertyModel<>(clientAppTO, "encryptIdToken")). + addRequiredLabel()); AjaxDropDownChoicePanel idTokenEncryptionAlg = new AjaxDropDownChoicePanel<>( "field", @@ -369,12 +371,15 @@ protected void onUpdate(final AjaxRequestTarget target) { userInfoEncryptedResponseEncoding.setChoices(List.of(OIDCTokenEncryptionEncoding.values())); fields.add(userInfoEncryptedResponseEncoding); - fields.add(new AjaxCheckBoxPanel( - "field", "jwtAccessToken", new PropertyModel<>(clientAppTO, "jwtAccessToken"))); - fields.add(new AjaxCheckBoxPanel( - "field", "bypassApprovalPrompt", new PropertyModel<>(clientAppTO, "bypassApprovalPrompt"))); - fields.add(new AjaxCheckBoxPanel( - "field", "generateRefreshToken", new PropertyModel<>(clientAppTO, "generateRefreshToken"))); + fields.add(new AjaxTripleStateButtonPanel( + "field", "jwtAccessToken", new PropertyModel<>(clientAppTO, "jwtAccessToken")). + addRequiredLabel()); + fields.add(new AjaxTripleStateButtonPanel( + "field", "bypassApprovalPrompt", new PropertyModel<>(clientAppTO, "bypassApprovalPrompt")). + addRequiredLabel()); + fields.add(new AjaxTripleStateButtonPanel( + "field", "generateRefreshToken", new PropertyModel<>(clientAppTO, "generateRefreshToken")). + addRequiredLabel()); AjaxDropDownChoicePanel subjectType = new AjaxDropDownChoicePanel<>( "field", "subjectType", new PropertyModel<>(clientAppTO, "subjectType"), false); @@ -553,97 +558,109 @@ public String getObject() { logoutResponseBinding.setChoices(List.of(SAML2BindingType.values())); fields.add(logoutResponseBinding); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "logoutResponseEnabled", - new PropertyModel<>(clientAppTO, "logoutResponseEnabled"))); + new PropertyModel<>(clientAppTO, "logoutResponseEnabled")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "requireSignedRoot", - new PropertyModel<>(clientAppTO, "requireSignedRoot"))); + new PropertyModel<>(clientAppTO, "requireSignedRoot")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( - "field", "signAssertions", new PropertyModel<>(clientAppTO, "signAssertions"))); + fields.add(new AjaxTripleStateButtonPanel( + "field", "signAssertions", new PropertyModel<>(clientAppTO, "signAssertions")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( - "field", "signResponses", new PropertyModel<>(clientAppTO, "signResponses"))); + fields.add(new AjaxTripleStateButtonPanel( + "field", "signResponses", new PropertyModel<>(clientAppTO, "signResponses")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( - "field", "encryptionOptional", new PropertyModel<>(clientAppTO, "encryptionOptional"))); + fields.add(new AjaxTripleStateButtonPanel( + "field", "encryptionOptional", new PropertyModel<>(clientAppTO, "encryptionOptional")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( - "field", "encryptAssertions", new PropertyModel<>(clientAppTO, "encryptAssertions"))); + fields.add(new AjaxTripleStateButtonPanel( + "field", "encryptAssertions", new PropertyModel<>(clientAppTO, "encryptAssertions")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "encryptAttributes", - new PropertyModel<>(clientAppTO, "encryptAttributes"))); + new PropertyModel<>(clientAppTO, "encryptAttributes")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingAssertionNameId", - new PropertyModel<>(clientAppTO, "skipGeneratingAssertionNameId"))); + new PropertyModel<>(clientAppTO, "skipGeneratingAssertionNameId")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSubjectConfirmationInResponseTo", - new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationInResponseTo"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationInResponseTo")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingResponseInResponseTo", - new PropertyModel<>(clientAppTO, "skipGeneratingResponseInResponseTo"))); + new PropertyModel<>(clientAppTO, "skipGeneratingResponseInResponseTo")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSubjectConfirmationNotOnOrAfter", - new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationNotOnOrAfter"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationNotOnOrAfter")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSubjectConfirmationRecipient", - new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationRecipient"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationRecipient")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSubjectConfirmationRecipient", - new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationRecipient"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationRecipient")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSubjectConfirmationAddress", - new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationAddress"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationAddress")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSubjectConfirmationNotBefore", - new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationNotBefore"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationNotBefore")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSubjectConfirmationNameId", - new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationNameId"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSubjectConfirmationNameId")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingNameIdQualifiers", - new PropertyModel<>(clientAppTO, "skipGeneratingNameIdQualifiers"))); + new PropertyModel<>(clientAppTO, "skipGeneratingNameIdQualifiers")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingTransientNameId", - new PropertyModel<>(clientAppTO, "skipGeneratingTransientNameId"))); + new PropertyModel<>(clientAppTO, "skipGeneratingTransientNameId")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipValidatingAuthnRequest", - new PropertyModel<>(clientAppTO, "skipValidatingAuthnRequest"))); + new PropertyModel<>(clientAppTO, "skipValidatingAuthnRequest")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingServiceProviderNameIdQualifier", - new PropertyModel<>(clientAppTO, "skipGeneratingServiceProviderNameIdQualifier"))); + new PropertyModel<>(clientAppTO, "skipGeneratingServiceProviderNameIdQualifier")). + addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingAuthenticatingAuthority", - new PropertyModel<>(clientAppTO, "skipGeneratingAuthenticatingAuthority"))); + new PropertyModel<>(clientAppTO, "skipGeneratingAuthenticatingAuthority")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingNameIdQualifier", - new PropertyModel<>(clientAppTO, "skipGeneratingNameIdQualifier"))); + new PropertyModel<>(clientAppTO, "skipGeneratingNameIdQualifier")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "skipGeneratingSessionNotOnOrAfter", - new PropertyModel<>(clientAppTO, "skipGeneratingSessionNotOnOrAfter"))); + new PropertyModel<>(clientAppTO, "skipGeneratingSessionNotOnOrAfter")).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "validateMetadataCertificates", - new PropertyModel<>(clientAppTO, "validateMetadataCertificates"))); + new PropertyModel<>(clientAppTO, "validateMetadataCertificates")).addRequiredLabel()); fields.add(new AjaxTextFieldPanel( "field", "requiredAuthenticationContextClass", diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARoutePredicatePanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARoutePredicatePanel.java index caa8532f750..5e190a1a2da 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARoutePredicatePanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARoutePredicatePanel.java @@ -26,9 +26,9 @@ import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.types.SRARoutePredicate; import org.apache.syncope.common.lib.types.SRARoutePredicateCond; import org.apache.syncope.common.lib.types.SRARoutePredicateFactory; @@ -76,8 +76,9 @@ protected String createRelAttribute() { protected void populateItem(final ListItem item) { SRARoutePredicate predicate = item.getModelObject(); - AjaxCheckBoxPanel negate = - new AjaxCheckBoxPanel("negate", "negate", new PropertyModel<>(predicate, "negate")); + AjaxTripleStateButtonPanel negate = + new AjaxTripleStateButtonPanel("negate", "negate", new PropertyModel<>(predicate, "negate")); + negate.setRequired(true); item.add(negate.hideLabel()); AjaxDropDownChoicePanel factory = diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARouteWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARouteWizardBuilder.java index 1505753740f..eeb0e88fd7b 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARouteWizardBuilder.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/panels/SRARouteWizardBuilder.java @@ -25,10 +25,10 @@ import org.apache.syncope.client.console.rest.SRARouteRestClient; import org.apache.syncope.client.console.wizards.BaseAjaxWizardBuilder; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.to.SRARouteTO; import org.apache.syncope.common.lib.types.SRARouteType; import org.apache.wicket.PageReference; @@ -129,7 +129,8 @@ public void setObject(final String object) { type.addRequiredLabel().setEnabled(true); add(type); - add(new AjaxCheckBoxPanel("logout", "logout", new PropertyModel<>(route, "logout"))); + add(new AjaxTripleStateButtonPanel("logout", "logout", new PropertyModel<>(route, "logout")). + addRequiredLabel()); AjaxTextFieldPanel postLogout = new AjaxTextFieldPanel("postLogout", "postLogout", new IModel<>() { @@ -152,7 +153,7 @@ public void setObject(final String object) { postLogout.getField().add(new UrlValidator(new String[] { "http", "https" })); add(postLogout); - add(new AjaxCheckBoxPanel("csrf", "csrf", new PropertyModel<>(route, "csrf"))); + add(new AjaxTripleStateButtonPanel("csrf", "csrf", new PropertyModel<>(route, "csrf")).addRequiredLabel()); add(new AjaxNumberFieldPanel.Builder().min(0).build( "order", "order", Integer.class, new PropertyModel<>(route, "order")). diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AttrReleasePolicyModalPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AttrReleasePolicyModalPanel.java index ca413343d8f..cb415c4c5e8 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AttrReleasePolicyModalPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AttrReleasePolicyModalPanel.java @@ -27,12 +27,12 @@ import org.apache.syncope.client.console.rest.PolicyRestClient; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxGridFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.MultiFieldPanel; import org.apache.syncope.client.ui.commons.pages.BaseWebPage; import org.apache.syncope.common.lib.policy.AttrReleasePolicyTO; @@ -114,11 +114,11 @@ public AttrReleasePolicyModalPanel( mergingStrategy.setNullValid(false); add(mergingStrategy); - add(new AjaxCheckBoxPanel( + add(new AjaxTripleStateButtonPanel( "ignoreResolvedAttributes", "ignoreResolvedAttributes", new PropertyModel<>(model.getObject().getConf(), "principalAttrRepoConf.ignoreResolvedAttributes"), - false)); + false).addRequiredLabel()); add(new AjaxNumberFieldPanel.Builder().build( "expiration", diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AuthPolicyModalPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AuthPolicyModalPanel.java index e4edc93d09e..d4a6b50fcb6 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AuthPolicyModalPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/policies/AuthPolicyModalPanel.java @@ -26,9 +26,9 @@ import org.apache.syncope.client.console.rest.PolicyRestClient; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.pages.BaseWebPage; import org.apache.syncope.common.lib.policy.AuthPolicyTO; import org.apache.syncope.common.lib.to.AuthModuleTO; @@ -70,28 +70,28 @@ public AuthPolicyModalPanel( super(modal, pageRef); this.model = model; - add(new AjaxCheckBoxPanel( + add(new AjaxTripleStateButtonPanel( "tryAll", "tryAll", new PropertyModel<>(model.getObject().getConf(), "tryAll"), - false)); + false).addRequiredLabel()); add(new AjaxPalettePanel.Builder().setName("authModules").build( "authModules", new PropertyModel<>(model.getObject().getConf(), "authModules"), allAuthModules)); - add(new AjaxCheckBoxPanel( + add(new AjaxTripleStateButtonPanel( "bypassEnabled", "bypassEnabled", new PropertyModel<>(model.getObject().getConf(), "bypassEnabled"), - false)); + false).addRequiredLabel()); - add(new AjaxCheckBoxPanel( + add(new AjaxTripleStateButtonPanel( "forceMfaExecution", "forceMfaExecution", new PropertyModel<>(model.getObject().getConf(), "forceMfaExecution"), - false)); + false).addRequiredLabel()); add(new AjaxTextFieldPanel( "bypassPrincipalAttributeName", @@ -105,11 +105,11 @@ public AuthPolicyModalPanel( new PropertyModel<>(model.getObject().getConf(), "bypassPrincipalAttributeValue"), false)); - add(new AjaxCheckBoxPanel( + add(new AjaxTripleStateButtonPanel( "bypassTrustedDeviceEnabled", "bypassTrustedDeviceEnabled", new PropertyModel<>(model.getObject().getConf(), "bypassTrustedDeviceEnabled"), - false)); + false).addRequiredLabel()); } @Override diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/policies/TicketExpirationPolicyModalPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/policies/TicketExpirationPolicyModalPanel.java index c62a3649406..6015c0ef6ed 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/policies/TicketExpirationPolicyModalPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/policies/TicketExpirationPolicyModalPanel.java @@ -25,8 +25,8 @@ import org.apache.syncope.client.console.rest.PolicyRestClient; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.pages.BaseWebPage; import org.apache.syncope.common.lib.policy.DefaultTicketExpirationPolicyConf; import org.apache.syncope.common.lib.policy.TicketExpirationPolicyTO; @@ -63,7 +63,8 @@ public TicketExpirationPolicyModalPanel( private void conf(final String field, final T newInstance) { PropertyModel beanPanelModel = new PropertyModel<>(model.getObject(), "conf." + field); - AjaxCheckBoxPanel enable = new AjaxCheckBoxPanel("enable." + field, "enable." + field, new IModel() { + AjaxTripleStateButtonPanel enable = new AjaxTripleStateButtonPanel( + "enable." + field, "enable." + field, new IModel() { private static final long serialVersionUID = -7126718045816207110L; @@ -76,8 +77,9 @@ public Boolean getObject() { public void setObject(final Boolean object) { // nothing to do } - }); - enable.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + }, false); + enable.addRequiredLabel(); + enable.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java index 92677033f03..53d18270131 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java @@ -30,11 +30,11 @@ import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel; import org.apache.syncope.client.console.wizards.mapping.AuthModuleMappingPanel; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.BinaryFieldPanel; import org.apache.syncope.client.ui.commons.wizards.AjaxWizard; import org.apache.syncope.common.lib.AbstractLDAPConf; @@ -256,7 +256,7 @@ protected class AuthModuleConfLDAP extends WizardStep implements WizardModel.ICo PropertyModel beanPanelModel = new PropertyModel<>(authModule, "conf.ldap"); - AjaxCheckBoxPanel enable = new AjaxCheckBoxPanel("enable", "enableLDAP", new IModel() { + AjaxTripleStateButtonPanel enable = new AjaxTripleStateButtonPanel("enable", "enableLDAP", new IModel<>() { private static final long serialVersionUID = -7126718045816207110L; @@ -269,8 +269,9 @@ public Boolean getObject() { public void setObject(final Boolean object) { // nothing to do } - }); - enable.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + }, false); + enable.addRequiredLabel(); + enable.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/PasswordManagementWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/PasswordManagementWizardBuilder.java index 54f459ee531..d98bac783a6 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/PasswordManagementWizardBuilder.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/PasswordManagementWizardBuilder.java @@ -25,9 +25,9 @@ import org.apache.syncope.client.console.panels.BeanPanel; import org.apache.syncope.client.console.rest.PasswordManagementRestClient; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.wizards.AjaxWizard; import org.apache.syncope.common.lib.password.PasswordManagementConf; import org.apache.syncope.common.lib.to.PasswordManagementTO; @@ -113,8 +113,9 @@ Constants.DESCRIPTION_FIELD_NAME, getString(Constants.DESCRIPTION_FIELD_NAME), new PropertyModel<>(passwordManagement, Constants.DESCRIPTION_FIELD_NAME)); add(description); - AjaxCheckBoxPanel isEnabled = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel isEnabled = new AjaxTripleStateButtonPanel( "enabled", "enabled", new PropertyModel<>(passwordManagement, "enabled")); + isEnabled.addRequiredLabel(); add(isEnabled); AjaxDropDownChoicePanel conf = new AjaxDropDownChoicePanel<>("conf", getString("type"), isNew diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/CSVConfPanel.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/CSVConfPanel.java index 352547f6bc9..38488143bbc 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/CSVConfPanel.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/panels/CSVConfPanel.java @@ -23,9 +23,9 @@ import java.util.stream.Stream; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCharacterFieldPanel; import org.apache.syncope.client.console.wizards.CSVPullWizardBuilder; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.rest.api.beans.AbstractCSVSpec; import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.markup.html.panel.Panel; @@ -98,8 +98,9 @@ public String getObject( nullValue.setRequired(false); add(nullValue); - AjaxCheckBoxPanel allowComments = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel allowComments = new AjaxTripleStateButtonPanel( "allowComments", "allowComments", new PropertyModel<>(spec, "allowComments"), true); + allowComments.addRequiredLabel(); add(allowComments); } } diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/policies/ProvisioningPolicyModalPanel.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/policies/ProvisioningPolicyModalPanel.java index 1d8b5693255..af5919e6f63 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/policies/ProvisioningPolicyModalPanel.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/policies/ProvisioningPolicyModalPanel.java @@ -38,9 +38,9 @@ import org.apache.syncope.client.console.wicket.markup.html.form.MultiPanel; import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.pages.BaseWebPage; import org.apache.syncope.common.lib.policy.AbstractCorrelationRuleConf; import org.apache.syncope.common.lib.policy.DefaultInboundCorrelationRuleConf; @@ -236,7 +236,9 @@ public void setObject(final Boolean object) { } } }; - AjaxCheckBoxPanel orSchemas = new AjaxCheckBoxPanel("orSchemas", "orSchemas", orSchemasModel, false); + AjaxTripleStateButtonPanel orSchemas = new AjaxTripleStateButtonPanel( + "orSchemas", "orSchemas", orSchemasModel, false); + orSchemas.addRequiredLabel(); orSchemas.setOutputMarkupPlaceholderTag(true); add(orSchemas.setVisible(correlationRule.getObject().getDefaultRuleConf() != null)); diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java index 0f656fd1001..12b9dcec7c1 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/status/ReconTaskPanel.java @@ -32,9 +32,9 @@ import org.apache.syncope.client.console.rest.ReconciliationRestClient; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSearchFieldPanel; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.to.ImplementationTO; import org.apache.syncope.common.lib.to.ProvisioningTaskTO; @@ -158,8 +158,9 @@ protected Iterator getChoices(final String input) { } form.add(realm); - form.add(new AjaxCheckBoxPanel( - "remediation", "remediation", new PropertyModel<>(taskTO, "remediation"), false)); + form.add(new AjaxTripleStateButtonPanel( + "remediation", "remediation", new PropertyModel<>(taskTO, "remediation"), false). + addRequiredLabel()); } AjaxPalettePanel actions = new AjaxPalettePanel.Builder(). @@ -183,23 +184,27 @@ protected Iterator getChoices(final String input) { form.add(unmatchingRule); taskTO.setPerformCreate(true); - AjaxCheckBoxPanel performCreate = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel performCreate = new AjaxTripleStateButtonPanel( "performCreate", "performCreate", new PropertyModel<>(taskTO, "performCreate"), false); + performCreate.addRequiredLabel(); form.add(performCreate); taskTO.setPerformUpdate(true); - AjaxCheckBoxPanel performUpdate = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel performUpdate = new AjaxTripleStateButtonPanel( "performUpdate", "performUpdate", new PropertyModel<>(taskTO, "performUpdate"), false); + performUpdate.addRequiredLabel(); form.add(performUpdate); taskTO.setPerformDelete(true); - AjaxCheckBoxPanel performDelete = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel performDelete = new AjaxTripleStateButtonPanel( "performDelete", "performDelete", new PropertyModel<>(taskTO, "performDelete"), false); + performDelete.addRequiredLabel(); form.add(performDelete); taskTO.setSyncStatus(true); - AjaxCheckBoxPanel syncStatus = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel syncStatus = new AjaxTripleStateButtonPanel( "syncStatus", "syncStatus", new PropertyModel<>(taskTO, "syncStatus"), false); + syncStatus.addRequiredLabel(); form.add(syncStatus); form.add(new AjaxSubmitLink("reconcile") { diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java index 2bac130c1c1..8a09f5da490 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/list/ConnConfPropertyListView.java @@ -28,10 +28,10 @@ import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.markup.html.form.AbstractFieldPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPasswordFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.MultiFieldPanel; import org.apache.syncope.common.lib.types.ConnConfProperty; @@ -104,7 +104,8 @@ protected void populateItem(final ListItem item) { "panel", label, AjaxNumberFieldPanel.cast(propertySchemaClass), new Model<>()); required = property.getSchema().isRequired(); } else if (ClassUtils.isAssignable(Boolean.class, propertySchemaClass)) { - field = new AjaxCheckBoxPanel("panel", label, new Model<>()); + field = new AjaxTripleStateButtonPanel("panel", label, new Model<>()); + required = property.getSchema().isRequired(); } else { field = new AjaxTextFieldPanel("panel", label, new Model<>()); required = property.getSchema().isRequired(); diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java index 6fcbc5fba65..417ce803d56 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java @@ -34,9 +34,9 @@ import org.apache.syncope.client.console.rest.ImplementationRestClient; import org.apache.syncope.client.console.rest.ReconciliationRestClient; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.to.ImplementationTO; import org.apache.syncope.common.lib.to.ProvisioningReport; import org.apache.syncope.common.lib.types.ConflictResolutionAction; @@ -263,8 +263,9 @@ protected List load() { }; public PullTask(final CSVPullSpec spec) { - AjaxCheckBoxPanel remediation = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel remediation = new AjaxTripleStateButtonPanel( "remediation", "remediation", new PropertyModel<>(spec, "remediation"), false); + remediation.addRequiredLabel(); add(remediation); AjaxDropDownChoicePanel matchingRule = new AjaxDropDownChoicePanel<>( diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPushWizardBuilder.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPushWizardBuilder.java index 1035c4e5198..a89b7a6cd9a 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPushWizardBuilder.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPushWizardBuilder.java @@ -26,9 +26,9 @@ import org.apache.syncope.client.console.rest.ReconciliationRestClient; import org.apache.syncope.client.console.wicket.ajax.form.AjaxDownloadBehavior; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.rest.ResponseHolder; import org.apache.syncope.common.lib.to.ImplementationTO; import org.apache.syncope.common.lib.types.IdMImplementationType; @@ -139,8 +139,9 @@ protected List load() { }; public PushTask(final CSVPushSpec spec) { - AjaxCheckBoxPanel ignorePaging = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel ignorePaging = new AjaxTripleStateButtonPanel( "ignorePaging", "ignorePaging", new PropertyModel<>(spec, "ignorePaging"), true); + ignorePaging.addRequiredLabel(); add(ignorePaging); AjaxPalettePanel propagationActions = diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java index b7db1ee1680..78ea5e197e9 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ProvisionWizardBuilder.java @@ -28,10 +28,9 @@ import org.apache.syncope.client.console.wizards.mapping.ItemTransformersTogglePanel; import org.apache.syncope.client.console.wizards.mapping.JEXLTransformersTogglePanel; import org.apache.syncope.client.ui.commons.ConnIdSpecialName; -import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.to.Provision; import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.types.AnyTypeKind; @@ -106,11 +105,12 @@ protected static final class ConnObjectLink extends WizardStep { connObjectLinkEnabled = true; } - final AjaxCheckBoxPanel connObjectLinkCheckbox = new AjaxCheckBoxPanel( + final AjaxTripleStateButtonPanel connObjectLinkCheckbox = new AjaxTripleStateButtonPanel( "connObjectLinkCheckbox", new ResourceModel("connObjectLinkCheckbox", "connObjectLinkCheckbox").getObject(), new Model<>(connObjectLinkEnabled), false); + connObjectLinkCheckbox.addRequiredLabel(); connObjectLinkCheckbox.setEnabled(true); connObjectLinkContainer.add(connObjectLinkCheckbox); @@ -124,7 +124,7 @@ protected static final class ConnObjectLink extends WizardStep { connObjectLink.setEnabled(connObjectLinkEnabled); connObjectLinkContainer.add(connObjectLink); - connObjectLinkCheckbox.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + connObjectLinkCheckbox.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; @@ -160,8 +160,9 @@ protected final class ObjectType extends WizardStep { clazz.setChoices(connectorRestClient.getObjectClasses(resourceTO.getConnector())); container.add(clazz); - AjaxCheckBoxPanel ignoreCaseMatch = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel ignoreCaseMatch = new AjaxTripleStateButtonPanel( "ignoreCaseMatch", "ignoreCaseMatch", new PropertyModel<>(resourceProvision, "ignoreCaseMatch")); + ignoreCaseMatch.addRequiredLabel(); container.add(ignoreCaseMatch); } } diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java index c6662bb1d59..f8ada17e388 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceConnCapabilitiesPanel.java @@ -24,9 +24,8 @@ import java.util.Optional; import java.util.Set; import org.apache.commons.lang3.BooleanUtils; -import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.types.ConnectorCapability; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -70,7 +69,7 @@ public void setObject(final List object) { connCapabilitiesPanel.setEnabled(!resourceTO.getCapabilitiesOverride().isEmpty()); add(connCapabilitiesPanel); - AjaxCheckBoxPanel overrideCapabilities = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel overrideCapabilities = new AjaxTripleStateButtonPanel( "overrideCapabilities", new ResourceModel("overrideCapabilities", "overrideCapabilities").getObject(), new IModel() { @@ -90,8 +89,9 @@ public void setObject(final Boolean object) { resourceTO.setCapabilitiesOverride(Optional.empty()); } } - }); - overrideCapabilities.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + }, false); + overrideCapabilities.addRequiredLabel(); + overrideCapabilities.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; diff --git a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java index 3aced1c64e1..296c6e168fd 100644 --- a/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java +++ b/client/idm/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceDetailsPanel.java @@ -26,11 +26,11 @@ import org.apache.syncope.client.console.rest.ConnectorRestClient; import org.apache.syncope.client.console.rest.ImplementationRestClient; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.to.ConnInstanceTO; import org.apache.syncope.common.lib.to.ImplementationTO; import org.apache.syncope.common.lib.to.ResourceTO; @@ -96,11 +96,11 @@ public ResourceDetailsPanel(final ResourceTO resourceTO, final boolean createFla new PropertyModel<>(resourceTO, Constants.KEY_FIELD_NAME), false).addRequiredLabel().setEnabled(createFlag)); - container.add(new AjaxCheckBoxPanel( + container.add(new AjaxTripleStateButtonPanel( "enforceMandatoryCondition", new ResourceModel("enforceMandatoryCondition", "enforceMandatoryCondition").getObject(), new PropertyModel<>(resourceTO, "enforceMandatoryCondition"), - false)); + false).addRequiredLabel()); container.add(new AjaxNumberFieldPanel.Builder().build( "propagationPriority", diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxCheckBoxPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxCheckBoxPanel.java deleted file mode 100644 index 36f546e60b6..00000000000 --- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxCheckBoxPanel.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.client.ui.commons.markup.html.form; - -import java.io.Serializable; -import java.util.List; -import java.util.Optional; -import java.util.function.Predicate; -import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.common.lib.Attr; -import org.apache.syncope.common.lib.to.AttributableTO; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.markup.html.form.CheckBox; -import org.apache.wicket.markup.html.list.ListItem; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; - -public class AjaxCheckBoxPanel extends FieldPanel { - - private static final long serialVersionUID = 5664138233103884310L; - - public AjaxCheckBoxPanel(final String id, final String name, final IModel model) { - this(id, name, model, true); - } - - public AjaxCheckBoxPanel( - final String id, final String name, final IModel model, final boolean enableOnChange) { - - super(id, name, model); - - field = new CheckBox("checkboxField", model); - add(field.setLabel(new ResourceModel(name, name)).setOutputMarkupId(true)); - - if (enableOnChange && !isReadOnly()) { - field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - // nothing to do - } - }); - } - } - - @Override - public FieldPanel setNewModel(final List list) { - setNewModel(new Model<>() { - - private static final long serialVersionUID = 527651414610325237L; - - @Override - public Boolean getObject() { - Boolean value = null; - - if (list != null && !list.isEmpty()) { - value = Boolean.TRUE.toString().equalsIgnoreCase(list.getFirst().toString()); - } - - return value; - } - - @Override - public void setObject(final Boolean object) { - list.clear(); - if (object != null) { - list.add(object.toString()); - } - } - }); - - return this; - } - - @SuppressWarnings("rawtypes") - @Override - public FieldPanel setNewModel(final ListItem item) { - IModel model = new Model<>() { - - private static final long serialVersionUID = 6799404673615637845L; - - @Override - public Boolean getObject() { - Boolean bool = null; - - final Object obj = item.getModelObject(); - - if (obj != null && !obj.toString().isEmpty()) { - if (obj instanceof String) { - bool = Boolean.TRUE.toString().equalsIgnoreCase(obj.toString()); - } else if (obj instanceof final Boolean b) { - // Don't parse anything - bool = b; - } - } - - return bool; - } - - @Override - @SuppressWarnings("unchecked") - public void setObject(final Boolean object) { - item.setModelObject(Optional.ofNullable(object) - .map(Object::toString).orElseGet(Boolean.FALSE::toString)); - } - }; - - field.setModel(model); - return this; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public FieldPanel setNewModel(final AttributableTO attributable, final String schema) { - field.setModel(new Model() { - - private static final long serialVersionUID = -4214654722524358000L; - - @Override - public Serializable getObject() { - return attributable.getPlainAttr(schema).map(Attr::getValues).filter(Predicate.not(List::isEmpty)). - map(values -> Boolean.TRUE.toString().equalsIgnoreCase(values.getFirst())). - orElse(null); - } - - @Override - public void setObject(final Serializable object) { - attributable.getPlainAttr(schema).ifPresent(plainAttr -> { - plainAttr.getValues().clear(); - plainAttr.getValues().add(object == null ? Boolean.FALSE.toString() : object.toString()); - }); - } - }); - - return this; - } -} diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.java new file mode 100644 index 00000000000..4336004e10d --- /dev/null +++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.java @@ -0,0 +1,233 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.client.ui.commons.markup.html.form; + +import java.io.Serializable; +import java.util.List; +import java.util.Optional; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; +import org.apache.syncope.common.lib.Attr; +import org.apache.syncope.common.lib.to.AttributableTO; +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.form.Radio; +import org.apache.wicket.markup.html.form.RadioGroup; +import org.apache.wicket.markup.html.list.ListItem; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.Model; +import org.apache.wicket.model.ResourceModel; + +public class AjaxTripleStateButtonPanel extends FieldPanel { + + private static final long serialVersionUID = 5433965057104106773L; + + protected final WebMarkupContainer unsetContainer; + + protected final Radio unsetOption; + + private final boolean enableOnChange; + + private final boolean convertValuesToString; + + public AjaxTripleStateButtonPanel(final String id, final String name, final IModel model) { + this(id, name, model, true); + } + + public AjaxTripleStateButtonPanel( + final String id, + final String name, + final IModel model, + final boolean enableOnChange) { + + this(id, name, model, enableOnChange, true); + } + + private AjaxTripleStateButtonPanel( + final String id, + final String name, + final IModel model, + final boolean enableOnChange, + final boolean convertValuesToString) { + + super(id, name, model); + + this.enableOnChange = enableOnChange; + this.convertValuesToString = convertValuesToString; + + field = new RadioGroup<>("tripleStateField", model); + field.setRenderBodyOnly(false); + add(field.setLabel(new ResourceModel(name, name)).setOutputMarkupId(true)); + field.add(AttributeModifier.replace("aria-label", field.getLabel())); + field.add(AttributeModifier.replace("aria-required", (IModel) () -> Boolean.toString(isRequired()))); + + Radio trueOption = new Radio<>("trueOption", Model.of(Boolean.TRUE)); + Radio falseOption = new Radio<>("falseOption", Model.of(Boolean.FALSE)); + field.add(trueOption.setOutputMarkupId(true), falseOption.setOutputMarkupId(true)); + + WebMarkupContainer trueLabel = new WebMarkupContainer("trueLabel"); + trueLabel.add(AttributeModifier.replace("for", (IModel) trueOption::getMarkupId)); + trueLabel.add(AttributeModifier.replace("title", new ResourceModel("tristate.true"))); + field.add(trueLabel); + + WebMarkupContainer falseLabel = new WebMarkupContainer("falseLabel"); + falseLabel.add(AttributeModifier.replace("for", (IModel) falseOption::getMarkupId)); + falseLabel.add(AttributeModifier.replace("title", new ResourceModel("tristate.false"))); + field.add(falseLabel); + + unsetContainer = new WebMarkupContainer("unsetContainer"); + field.add(unsetContainer); + + unsetOption = new Radio<>("unsetOption", Model.of((Boolean) null)); + unsetContainer.add(unsetOption.setOutputMarkupId(true)); + + WebMarkupContainer unsetLabel = new WebMarkupContainer("unsetLabel"); + unsetLabel.add(AttributeModifier.replace("for", (IModel) unsetOption::getMarkupId)); + unsetLabel.add(AttributeModifier.replace("title", new ResourceModel("tristate.unset"))); + unsetContainer.add(unsetLabel); + + if (enableOnChange && !isReadOnly()) { + field.add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { + + private static final long serialVersionUID = -8888833255711609077L; + + @Override + protected void onUpdate(final AjaxRequestTarget target) { + doUpdate(target); + } + }); + } + } + + protected void doUpdate(final AjaxRequestTarget target) { + // nothing to do + } + + @Override + public FieldPanel setRequired(final boolean required) { + unsetContainer.setVisible(!required); + unsetOption.setEnabled(!required); + return super.setRequired(required); + } + + @Override + public FieldPanel setNewModel(final List values) { + return setNewModel(new Model<>() { + + private static final long serialVersionUID = -4214654722524358000L; + + @Override + public Boolean getObject() { + return values == null || values.isEmpty() || values.getFirst() == null + ? null : BooleanUtils.toBooleanObject(values.getFirst().toString()); + } + + @Override + public void setObject(final Boolean object) { + values.clear(); + if (object != null) { + values.add(convertValuesToString ? object.toString() : object); + } + } + }); + } + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public FieldPanel setNewModel(final ListItem item) { + return setNewModel(new Model<>() { + + private static final long serialVersionUID = 6799404673615637845L; + + @Override + public Boolean getObject() { + Object value = item.getModelObject(); + return value == null ? null : BooleanUtils.toBooleanObject(value.toString()); + } + + @Override + public void setObject(final Boolean object) { + item.setModelObject(Optional.ofNullable(object). + map(value -> convertValuesToString ? value.toString() : value).orElse(null)); + } + }); + } + + @Override + public FieldPanel setNewModel(final AttributableTO attributable, final String schema) { + return setNewModel(new Model<>() { + + private static final long serialVersionUID = -4214654722524358000L; + + @Override + public Boolean getObject() { + return attributable.getPlainAttr(schema).map(Attr::getValues).filter(values -> !values.isEmpty()). + map(values -> BooleanUtils.toBooleanObject(values.getFirst())).orElse(null); + } + + @Override + public void setObject(final Boolean object) { + attributable.getPlainAttr(schema).ifPresent(attr -> { + attr.getValues().clear(); + if (object != null) { + attr.getValues().add(object.toString()); + } + }); + } + }); + } + + @Override + public FieldPanel clone() { + AjaxTripleStateButtonPanel panel = new AjaxTripleStateButtonPanel( + getId(), name, new Model<>(), enableOnChange, convertValuesToString); + + panel.setRequired(isRequired()); + panel.setReadOnly(isReadOnly()); + panel.setTitle(title); + + if (isRequiredLabelAdded) { + panel.addRequiredLabel(); + } + + return panel; + } + + public static class Builder { + + private boolean enableOnChange = false; + + private boolean convertValuesToString = true; + + public Builder enableOnChange() { + enableOnChange = true; + return this; + } + + public Builder convertValuesToString(final boolean convertValuesToString) { + this.convertValuesToString = convertValuesToString; + return this; + } + + public AjaxTripleStateButtonPanel build(final String id, final String name, final IModel model) { + return new AjaxTripleStateButtonPanel(id, name, model, enableOnChange, convertValuesToString); + } + } +} diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/FieldPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/FieldPanel.java index efb81d172e4..be621a57c63 100644 --- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/FieldPanel.java +++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/FieldPanel.java @@ -77,7 +77,7 @@ public FieldPanel setTitle(final String title, final boolean html) { new PopoverConfig().withHtml(html).withHoverTrigger().withPlacement( index.getObject() != null && index.getObject() == 0 ? TooltipConfig.Placement.bottom - : this instanceof AjaxCheckBoxPanel + : this instanceof AjaxTripleStateButtonPanel ? TooltipConfig.Placement.right : TooltipConfig.Placement.top))); return this; diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java index 05159914158..eaf0f5b7539 100644 --- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java +++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/markup/html/form/MultiFieldPanel.java @@ -21,6 +21,7 @@ import java.io.Serializable; import java.util.List; import org.apache.syncope.client.ui.commons.Constants; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; import org.apache.wicket.Session; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -99,7 +100,16 @@ protected FieldPanel getItemPanel(final ListItem item fieldPanel.settingsDependingComponents(); fieldPanel.hideLabel(); - if (eventTemplate) { + if (eventTemplate && fieldPanel instanceof AjaxTripleStateButtonPanel) { + fieldPanel.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { + + private static final long serialVersionUID = -1107858522700306810L; + + @Override + protected void onUpdate(final AjaxRequestTarget target) { + } + }); + } else if (eventTemplate) { fieldPanel.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java index d827d28aa6c..0b873aaadbf 100644 --- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java +++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java @@ -31,7 +31,6 @@ import org.apache.commons.lang3.time.FastDateFormat; import org.apache.syncope.client.ui.commons.MapChoiceRenderer; import org.apache.syncope.client.ui.commons.markup.html.form.AbstractFieldPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; @@ -39,6 +38,7 @@ import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPasswordFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.BinaryFieldPanel; import org.apache.syncope.common.lib.form.FormProperty; import org.apache.syncope.common.lib.form.FormPropertyValue; @@ -79,13 +79,14 @@ protected void populateItem(final ListItem item) { AbstractFieldPanel field; switch (prop.getType()) { case Boolean: - field = new AjaxCheckBoxPanel("value", label, new PropertyModel(prop, "value") { + field = new AjaxTripleStateButtonPanel( + "value", label, new PropertyModel<>(prop, "value") { private static final long serialVersionUID = -3743432456095828573L; @Override public Boolean getObject() { - return BooleanUtils.toBoolean(prop.getValue()); + return BooleanUtils.toBooleanObject(prop.getValue()); } @Override diff --git a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/PasswordPanel.java b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/PasswordPanel.java index a252ed4807a..0c62f2fb876 100644 --- a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/PasswordPanel.java +++ b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/wizards/any/PasswordPanel.java @@ -19,9 +19,9 @@ package org.apache.syncope.client.ui.commons.wizards.any; import de.agilecoders.wicket.extensions.markup.html.bootstrap.form.password.strength.PasswordStrengthBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPasswordFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.SyncopePasswordStrengthConfig; import org.apache.syncope.client.ui.commons.rest.AnonymousRestClient; import org.apache.syncope.common.rest.api.beans.ComplianceQuery; @@ -108,8 +108,10 @@ public void validate(final Form form) { }); } - AjaxCheckBoxPanel storePasswordInSyncopePanel = new AjaxCheckBoxPanel("storePasswordInSyncope", + AjaxTripleStateButtonPanel storePasswordInSyncopePanel = new AjaxTripleStateButtonPanel( + "storePasswordInSyncope", "storePasswordInSyncope", new PropertyModel<>(wrapper, "storePasswordInSyncope")); + storePasswordInSyncopePanel.addRequiredLabel(); storePasswordInSyncopePanel.getField().setLabel(new ResourceModel("storePasswordInSyncope")); storePasswordInSyncopePanel.setOutputMarkupId(true); storePasswordInSyncopePanel.setOutputMarkupPlaceholderTag(true); diff --git a/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/_triplestate.scss b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/_triplestate.scss new file mode 100644 index 00000000000..31302d97d90 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/_triplestate.scss @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* TriStateButton +============================================================================= */ + +.tristate-field { + display: flex; + flex-direction: column; + align-items: flex-start; +} + +.tristate-field-label-row { + display: flex; + flex-direction: row; + align-items: baseline; + gap: 0.25rem; + width: 100%; +} + +.tristate-field-label-row > .tristate-external-action { + align-self: flex-start; + flex-shrink: 0; + margin-left: auto; +} + +.tristate-external-action .form-check { + margin: 0; + padding: 0; +} + +.tristate-field .btn-group > .btn { + flex: 1 1 0; + white-space: nowrap; +} + +.tristate-icon-group > .btn { + min-width: 45px; + min-height: calc(1.5em + 0.75rem + 2 * var(--bs-border-width)); + display: flex; + align-items: center; + justify-content: center; + padding: 0.375rem 0.75rem; +} + +.tristate-icon-group .btn i { + font-size: 1rem; +} + +.tristate-icon-group .btn-check:checked + .tristate-true { + background-color: var(--bs-success); + border-color: var(--bs-success); + color: white; +} + +.tristate-icon-group .btn-check:checked + .tristate-false { + background-color: var(--bs-danger); + border-color: var(--bs-danger); + color: white; +} + +.tristate-icon-group .btn-check:checked + .tristate-unset { + background-color: var(--bs-secondary); + border-color: var(--bs-secondary); + color: white; +} diff --git a/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss index fdf5ddaac4d..c66ee97407c 100644 --- a/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss +++ b/client/idrepo/common-ui/src/main/resources/META-INF/resources/ui-commons/css/syncopeUI.scss @@ -19,6 +19,7 @@ @import 'theme'; @import 'utils'; +@import 'triplestate'; [data-bs-theme=dark] .sidebar-wrapper { background-color: rgba(var(--bs-secondary-bg-rgb), var(--bs-bg-opacity)) !important; diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxCheckBoxPanel.html b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxCheckBoxPanel.html deleted file mode 100644 index 6d7e4dd7a14..00000000000 --- a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxCheckBoxPanel.html +++ /dev/null @@ -1,31 +0,0 @@ - - - -
- -
-
- diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.html b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.html new file mode 100644 index 00000000000..d989baf55f2 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.html @@ -0,0 +1,52 @@ + + + +
+
+ + [LABEL] + + +
+ +
+ + + + + + + + + + +
+
+
+ diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.properties new file mode 100644 index 00000000000..e5478a588e1 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=Not set +tristate.true=True +tristate.false=False diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_fr.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_fr.properties new file mode 100644 index 00000000000..57f0deed485 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_fr.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=Non d\u00E9fini +tristate.true=Vrai +tristate.false=Faux diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_fr_CA.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_fr_CA.properties new file mode 100644 index 00000000000..57f0deed485 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_fr_CA.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=Non d\u00E9fini +tristate.true=Vrai +tristate.false=Faux diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_it.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_it.properties new file mode 100644 index 00000000000..8a8419fff50 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_it.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=Non impostato +tristate.true=Vero +tristate.false=Falso diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_ja.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_ja.properties new file mode 100644 index 00000000000..aef9a0ae976 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_ja.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=\u672A\u8A2D\u5B9A +tristate.true=\u771F +tristate.false=\u507D diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_pt.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_pt.properties new file mode 100644 index 00000000000..9f0a2cefc95 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_pt.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=N\u00E3o definido +tristate.true=Verdadeiro +tristate.false=Falso diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_pt_BR.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_pt_BR.properties new file mode 100644 index 00000000000..9f0a2cefc95 --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_pt_BR.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=N\u00E3o definido +tristate.true=Verdadeiro +tristate.false=Falso diff --git a/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_ru.properties b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_ru.properties new file mode 100644 index 00000000000..82fd8ce71de --- /dev/null +++ b/client/idrepo/common-ui/src/main/resources/org/apache/syncope/client/ui/commons/markup/html/form/AjaxTripleStateButtonPanel_ru.properties @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +tristate.unset=\u041D\u0435 \u0437\u0430\u0434\u0430\u043D\u043E +tristate.true=\u0418\u0441\u0442\u0438\u043D\u0430 +tristate.false=\u041B\u043E\u0436\u044C diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java index 4bfa3d35778..c2fe50de49b 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java @@ -40,9 +40,9 @@ import org.apache.syncope.client.console.wicket.markup.html.form.MultiPanel; import org.apache.syncope.client.console.wizards.BaseAjaxWizardBuilder; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.MultiFieldPanel; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.AnyTypeTO; @@ -162,8 +162,9 @@ public Details(final NotificationWrapper modelObject) { traceLevel.addRequiredLabel(); add(traceLevel); - final AjaxCheckBoxPanel isActive = new AjaxCheckBoxPanel("isActive", + final AjaxTripleStateButtonPanel isActive = new AjaxTripleStateButtonPanel("isActive", getString("isActive"), new PropertyModel<>(notificationTO, "active")); + isActive.addRequiredLabel(); if (createFlag) { isActive.getField().setDefaultModelObject(Boolean.TRUE); } @@ -387,8 +388,9 @@ public Recipients(final NotificationWrapper modelObject) { recipientsProvider.setChoices(recipientProviders.getObject()); add(recipientsProvider); - AjaxCheckBoxPanel selfAsRecipient = new AjaxCheckBoxPanel("selfAsRecipient", + AjaxTripleStateButtonPanel selfAsRecipient = new AjaxTripleStateButtonPanel("selfAsRecipient", getString("selfAsRecipient"), new PropertyModel<>(notificationTO, "selfAsRecipient")); + selfAsRecipient.addRequiredLabel(); if (notificationTO.getKey() == null) { selfAsRecipient.getField().setDefaultModelObject(Boolean.FALSE); } diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java index 7da6cdee126..109240ae090 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/BeanPanel.java @@ -48,13 +48,13 @@ import org.apache.syncope.client.console.rest.SchemaRestClient; import org.apache.syncope.client.lib.SyncopeClient; import org.apache.syncope.client.ui.commons.DateOps; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxGridFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.MultiFieldPanel; import org.apache.syncope.common.lib.report.SearchCondition; @@ -291,7 +291,10 @@ private SinglePanel buildSinglePanel( FieldPanel panel; if (ClassUtils.isAssignable(Boolean.class, type)) { - panel = new AjaxCheckBoxPanel(id, fieldName, model); + panel = new AjaxTripleStateButtonPanel(id, fieldName, model); + if (Boolean.TYPE.equals(type)) { + panel.addRequiredLabel(); + } } else if (ClassUtils.isAssignable(Number.class, type)) { panel = new AjaxNumberFieldPanel.Builder<>().build( id, fieldName, AjaxNumberFieldPanel.cast(ClassUtils.resolvePrimitiveIfNecessary(type)), model); @@ -354,13 +357,13 @@ public void setObject(final String object) { panel = new AjaxTextFieldPanel(id, fieldName, model); } - boolean required = false; + boolean required = Boolean.TYPE.equals(type); Optional description = Optional.empty(); if (schema != null) { panel.setReadOnly(schema.accessMode() == Schema.AccessMode.READ_ONLY); - required = schema.requiredMode() == Schema.RequiredMode.REQUIRED; + required = required || schema.requiredMode() == Schema.RequiredMode.REQUIRED; panel.setRequired(required); Optional.ofNullable(schema.example()).ifPresent(panel::setPlaceholder); diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainWizardBuilder.java index ff03fdfb763..cff90be8ac7 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainWizardBuilder.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/DomainWizardBuilder.java @@ -26,11 +26,10 @@ import org.apache.syncope.client.console.wicket.markup.html.form.JsonEditorPanel; import org.apache.syncope.client.console.wicket.markup.html.form.XMLEditorPanel; import org.apache.syncope.client.console.wizards.BaseAjaxWizardBuilder; -import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.EncryptedFieldPanel; import org.apache.syncope.common.keymaster.client.api.DomainOps; import org.apache.syncope.common.keymaster.client.api.model.Domain; @@ -39,7 +38,7 @@ import org.apache.syncope.common.lib.types.CipherAlgorithm; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; +import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior; import org.apache.wicket.extensions.wizard.WizardModel; import org.apache.wicket.extensions.wizard.WizardStep; import org.apache.wicket.model.IModel; @@ -229,9 +228,10 @@ public Content(final Domain domain) { content.setVisible(false); add(content); - AjaxCheckBoxPanel defaultContent = new AjaxCheckBoxPanel( - "defaultContent", "defaultContent", Model.of(true), true); - defaultContent.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + AjaxTripleStateButtonPanel defaultContent = new AjaxTripleStateButtonPanel( + "defaultContent", "defaultContent", Model.of(true), false); + defaultContent.addRequiredLabel(); + defaultContent.getField().add(new AjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; @@ -256,9 +256,10 @@ public KeymasterConfParams(final Domain domain, final PageReference pageRef) { keymasterConfParams.setVisible(false); add(keymasterConfParams); - AjaxCheckBoxPanel defaultKeymasterConfParams = new AjaxCheckBoxPanel( - "defaultKeymasterConfParams", "defaultKeymasterConfParams", Model.of(true), true); - defaultKeymasterConfParams.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + AjaxTripleStateButtonPanel defaultKeymasterConfParams = new AjaxTripleStateButtonPanel( + "defaultKeymasterConfParams", "defaultKeymasterConfParams", Model.of(true), false); + defaultKeymasterConfParams.addRequiredLabel(); + defaultKeymasterConfParams.getField().add(new AjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -6139318907146065915L; diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardAttrStep.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardAttrStep.java index 8bf69dee54d..63eaa748084 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardAttrStep.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardAttrStep.java @@ -19,12 +19,11 @@ package org.apache.syncope.client.console.panels; import java.util.List; -import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.BinaryFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.MultiFieldPanel; @@ -32,11 +31,9 @@ import org.apache.syncope.common.lib.to.PlainSchemaTO; import org.apache.wicket.extensions.wizard.WizardStep; import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.IChoiceRenderer; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.IModel; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.model.Model; import org.apache.wicket.model.PropertyModel; @@ -98,33 +95,9 @@ private Panel getFieldPanel(final String id, final ConfParam param, final PlainS break; case Boolean: - panel = new AjaxDropDownChoicePanel(id, valueHeaderName, new Model<>(), false); - ((AjaxDropDownChoicePanel) panel).setChoices(List.of(true, false)); - - if (!param.getValues().isEmpty()) { - ((AjaxDropDownChoicePanel) panel).setChoiceRenderer(new IChoiceRenderer() { - - private static final long serialVersionUID = -8223314361351275865L; - - @Override - public Object getDisplayValue(final Boolean object) { - return BooleanUtils.toStringTrueFalse(object); - } - - @Override - public String getIdValue(final Boolean object, final int index) { - return BooleanUtils.toStringTrueFalse(object); - } - - @Override - public Boolean getObject( - final String id, final IModel> choices) { - - return BooleanUtils.toBoolean(id); - } - }); - } - ((AjaxDropDownChoicePanel) panel).setNullValid(false); + panel = new AjaxTripleStateButtonPanel.Builder(). + convertValuesToString(false). + build(id, valueHeaderName, new Model<>()); break; case Long: diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardSchemaStep.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardSchemaStep.java index cbdddc38bfc..cd4f675185b 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardSchemaStep.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/ParametersWizardSchemaStep.java @@ -19,8 +19,8 @@ package org.apache.syncope.client.console.panels; import java.util.List; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.wizards.AjaxWizard; import org.apache.syncope.common.lib.types.AttrSchemaType; import org.apache.wicket.extensions.wizard.WizardStep; @@ -52,7 +52,7 @@ public ParametersWizardSchemaStep( AttrSchemaType.Binary)); content.add(type); - content.add(new AjaxCheckBoxPanel("multivalue", getString("multivalue"), - new PropertyModel<>(modelObject.getSchema(), "multivalue"))); + content.add(new AjaxTripleStateButtonPanel("multivalue", getString("multivalue"), + new PropertyModel<>(modelObject.getSchema(), "multivalue")).addRequiredLabel()); } } diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java index a81a9227403..ad183485606 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java @@ -29,10 +29,10 @@ import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.MIMETypesLoader; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxGridFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.to.ImplementationTO; import org.apache.syncope.common.lib.to.PlainSchemaTO; @@ -104,7 +104,7 @@ protected List load() { protected final AjaxDropDownChoicePanel cipherAlgorithm; - protected final AjaxCheckBoxPanel transparentEncryption; + protected final AjaxTripleStateButtonPanel transparentEncryption; protected final WebMarkupContainer encryptedParams; @@ -169,7 +169,7 @@ public PlainSchemaDetails(final String id, final PlainSchemaTO schemaTO) { new PropertyModel<>(schemaTO, "cipherAlgorithm")); cipherAlgorithm.setChoices(List.of(CipherAlgorithm.values())); - transparentEncryption = new AjaxCheckBoxPanel( + transparentEncryption = new AjaxTripleStateButtonPanel( "transparentEncryption", "transparentEncryption", new Model() { private static final long serialVersionUID = 5636572627689425575L; @@ -186,6 +186,7 @@ public void setObject(final Boolean object) { : null); } }, true); + transparentEncryption.setRequired(true); encryptedParams = new WebMarkupContainer("encryptedParams"); encryptedParams.setOutputMarkupPlaceholderTag(true); @@ -261,14 +262,14 @@ protected void onUpdate(final AjaxRequestTarget target) { add(Constants.getJEXLPopover(this, TooltipConfig.Placement.right)); - add(new AjaxCheckBoxPanel( - "multivalue", getString("multivalue"), new PropertyModel<>(schemaTO, "multivalue"))); + add(new AjaxTripleStateButtonPanel( + "multivalue", getString("multivalue"), new PropertyModel<>(schemaTO, "multivalue")).addRequiredLabel()); - add(new AjaxCheckBoxPanel( - "readonly", getString("readonly"), new PropertyModel<>(schemaTO, "readonly"))); + add(new AjaxTripleStateButtonPanel( + "readonly", getString("readonly"), new PropertyModel<>(schemaTO, "readonly")).addRequiredLabel()); - add(new AjaxCheckBoxPanel("uniqueConstraint", - getString("uniqueConstraint"), new PropertyModel<>(schemaTO, "uniqueConstraint")). + add(new AjaxTripleStateButtonPanel("uniqueConstraint", + getString("uniqueConstraint"), new PropertyModel<>(schemaTO, "uniqueConstraint")).addRequiredLabel(). setEnabled(isCreate)); } diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/StartAtTogglePanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/StartAtTogglePanel.java index 16a0dda9700..9e885b2c7cd 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/StartAtTogglePanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/StartAtTogglePanel.java @@ -25,9 +25,9 @@ import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.rest.ExecutionRestClient; import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.wicket.PageReference; @@ -58,9 +58,10 @@ public StartAtTogglePanel(final WebMarkupContainer container, final PageReferenc FastDateFormat.getInstance(SyncopeConstants.DATE_PATTERNS[3])); form.add(startAtDate.setReadOnly(true).hideLabel()); - AjaxCheckBoxPanel startAtCheck = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel startAtCheck = new AjaxTripleStateButtonPanel( "startAtCheck", "startAtCheck", new Model<>(false), false); - startAtCheck.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + startAtCheck.addRequiredLabel(); + startAtCheck.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java index 708cdc2e0ed..71511f3df3a 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/policies/PolicyModalPanelBuilder.java @@ -29,10 +29,10 @@ import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal; import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.pages.BaseWebPage; import org.apache.syncope.client.ui.commons.panels.WizardModalPanel; import org.apache.syncope.client.ui.commons.wizards.AbstractModalPanelBuilder; @@ -153,11 +153,11 @@ protected List load() { Integer.class, new PropertyModel<>(policyTO, "maxAuthenticationAttempts")).setRequired(true)); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "propagateSuspension", new PropertyModel<>(policyTO, "propagateSuspension"), - false)); + false).addRequiredLabel()); break; case PASSWORD: @@ -167,25 +167,25 @@ protected List load() { Integer.class, new PropertyModel<>(policyTO, "historyLength")).setRequired(true)); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "allowNullPassword", new PropertyModel<>(policyTO, "allowNullPassword"), - false)); + false).addRequiredLabel()); break; case PROPAGATION: - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "fetchAroundProvisioning", new PropertyModel<>(policyTO, "fetchAroundProvisioning"), - false)); + false).addRequiredLabel()); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "updateDelta", new PropertyModel<>(policyTO, "updateDelta"), - false)); + false).addRequiredLabel()); fields.add(new AjaxNumberFieldPanel.Builder().min(1).build( "field", @@ -296,11 +296,11 @@ public void setObject(final Serializable object) { "order", Integer.class, new PropertyModel<>(policyTO, "order"))); - fields.add(new AjaxCheckBoxPanel( + fields.add(new AjaxTripleStateButtonPanel( "field", "status", new PropertyModel<>(policyTO, "status"), - false)); + false).addRequiredLabel()); break; case AUTH: diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java index 053aedaf9dd..2ce47b82841 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/reports/ReportWizardBuilder.java @@ -32,9 +32,9 @@ import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.MIMETypesLoader; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.report.ReportConf; import org.apache.syncope.common.lib.to.ImplementationTO; import org.apache.syncope.common.lib.to.ReportTO; @@ -151,8 +151,9 @@ public Profile(final ReportTO modelObject, final Configuration configuration) { new PropertyModel<>(modelObject, Constants.NAME_FIELD_NAME), false); add(name.addRequiredLabel().setEnabled(true)); - AjaxCheckBoxPanel active = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel active = new AjaxTripleStateButtonPanel( "active", "active", new PropertyModel<>(modelObject, "active"), false); + active.addRequiredLabel(); add(active); AjaxTextFieldPanel mimeType = new AjaxTextFieldPanel( diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/FormPropertyDefsPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/FormPropertyDefsPanel.java index 6a902b94455..ba470993402 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/FormPropertyDefsPanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/FormPropertyDefsPanel.java @@ -35,10 +35,10 @@ import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.MIMETypesLoader; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxGridFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.pages.BaseWebPage; import org.apache.syncope.common.lib.form.FormPropertyType; import org.apache.syncope.common.lib.to.FormPropertyDefTO; @@ -108,25 +108,28 @@ protected void populateItem(final ListItem item) { false); item.add(labels.hideLabel()); - AjaxCheckBoxPanel readable = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel readable = new AjaxTripleStateButtonPanel( "readable", "readable", new PropertyModel<>(fpd, "readable"), true); + readable.addRequiredLabel(); item.add(readable.hideLabel()); - AjaxCheckBoxPanel writable = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel writable = new AjaxTripleStateButtonPanel( "writable", "writable", new PropertyModel<>(fpd, "writable"), true); + writable.addRequiredLabel(); item.add(writable.hideLabel()); - AjaxCheckBoxPanel required = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel required = new AjaxTripleStateButtonPanel( "required", "required", new PropertyModel<>(fpd, "required"), true); + required.addRequiredLabel(); item.add(required.hideLabel()); AjaxDropDownChoicePanel type = new AjaxDropDownChoicePanel<>( @@ -198,17 +201,19 @@ public void validate(final IValidatable validatable) { WebMarkupContainer dropdownConf = new WebMarkupContainer("dropdownConf"); dropdownConf.setVisible(fpd.getType() == FormPropertyType.Dropdown); item.add(dropdownConf.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true)); - AjaxCheckBoxPanel dropdownSingleSelection = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel dropdownSingleSelection = new AjaxTripleStateButtonPanel( "dropdownSingleSelection", "dropdownSingleSelection", new PropertyModel<>(fpd, "dropdownSingleSelection"), true); + dropdownSingleSelection.addRequiredLabel(); dropdownConf.add(dropdownSingleSelection.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true)); - AjaxCheckBoxPanel dropdownFreeForm = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel dropdownFreeForm = new AjaxTripleStateButtonPanel( "dropdownFreeForm", "dropdownFreeForm", new PropertyModel<>(fpd, "dropdownFreeForm"), true); + dropdownFreeForm.addRequiredLabel(); dropdownConf.add(dropdownFreeForm.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true)); type.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/MacroTaskExecWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/MacroTaskExecWizardBuilder.java index 47c980b65d4..391d28a8aaa 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/MacroTaskExecWizardBuilder.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/MacroTaskExecWizardBuilder.java @@ -23,10 +23,9 @@ import org.apache.commons.lang3.time.FastDateFormat; import org.apache.syncope.client.console.rest.TaskRestClient; import org.apache.syncope.client.console.wizards.BaseAjaxWizardBuilder; -import org.apache.syncope.client.ui.commons.Constants; -import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.panels.SyncopeFormPanel; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.form.SyncopeForm; @@ -104,9 +103,10 @@ protected StartAt() { FastDateFormat.getInstance(SyncopeConstants.DATE_PATTERNS[3])); add(startAtDate.setReadOnly(true).hideLabel()); - AjaxCheckBoxPanel startAtCheck = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel startAtCheck = new AjaxTripleStateButtonPanel( "startAtCheck", "startAtCheck", new Model<>(false), false); - startAtCheck.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + startAtCheck.addRequiredLabel(); + startAtCheck.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; @@ -117,7 +117,7 @@ protected void onUpdate(final AjaxRequestTarget target) { }); add(startAtCheck); - add(new AjaxCheckBoxPanel("dryRun", "dryRun", dryRunModel, false)); + add(new AjaxTripleStateButtonPanel("dryRun", "dryRun", dryRunModel, false).addRequiredLabel()); } } } diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java index 259f40aba62..c9eace214ef 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/tasks/SchedTaskWizardBuilder.java @@ -31,12 +31,13 @@ import org.apache.syncope.client.console.wicket.markup.html.form.AjaxSearchFieldPanel; import org.apache.syncope.client.console.wizards.BaseAjaxWizardBuilder; import org.apache.syncope.client.ui.commons.Constants; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.to.InboundTaskTO; @@ -165,8 +166,9 @@ protected Profile(final SchedTaskTO taskTO) { description.setEnabled(true); add(description); - AjaxCheckBoxPanel active = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel active = new AjaxTripleStateButtonPanel( "active", "active", new PropertyModel<>(taskTO, "active"), false); + active.addRequiredLabel(); add(active); AjaxDropDownChoicePanel jobDelegate = new AjaxDropDownChoicePanel<>( @@ -211,12 +213,14 @@ protected Iterator getChoices(final String input) { "macroActions", "macroActions", new PropertyModel<>(taskTO, "macroActions"), false). setChoices(macroActions)); - AjaxCheckBoxPanel continueOnError = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel continueOnError = new AjaxTripleStateButtonPanel( "continueOnError", "continueOnError", new PropertyModel<>(taskTO, "continueOnError"), false); + continueOnError.addRequiredLabel(); macroTaskSpecifics.add(continueOnError); - AjaxCheckBoxPanel saveExecs = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel saveExecs = new AjaxTripleStateButtonPanel( "saveExecs", "saveExecs", new PropertyModel<>(taskTO, "saveExecs"), false); + saveExecs.addRequiredLabel(); macroTaskSpecifics.add(saveExecs); // ------------------------------ @@ -360,27 +364,31 @@ protected Iterator getChoices(final String input) { unmatchingRule.setChoices(List.of(UnmatchingRule.values())); provisioningTaskSpecifics.add(unmatchingRule); - AjaxCheckBoxPanel performCreate = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel performCreate = new AjaxTripleStateButtonPanel( "performCreate", "performCreate", new PropertyModel<>(taskTO, "performCreate"), false); + performCreate.addRequiredLabel(); provisioningTaskSpecifics.add(performCreate); - AjaxCheckBoxPanel performUpdate = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel performUpdate = new AjaxTripleStateButtonPanel( "performUpdate", "performUpdate", new PropertyModel<>(taskTO, "performUpdate"), false); + performUpdate.addRequiredLabel(); provisioningTaskSpecifics.add(performUpdate); - AjaxCheckBoxPanel performDelete = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel performDelete = new AjaxTripleStateButtonPanel( "performDelete", "performDelete", new PropertyModel<>(taskTO, "performDelete"), false); + performDelete.addRequiredLabel(); provisioningTaskSpecifics.add(performDelete); - AjaxCheckBoxPanel syncStatus = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel syncStatus = new AjaxTripleStateButtonPanel( "syncStatus", "syncStatus", new PropertyModel<>(taskTO, "syncStatus"), false); + syncStatus.addRequiredLabel(); provisioningTaskSpecifics.add(syncStatus); // Concurrent settings PropertyModel concurrentSettingsModel = new PropertyModel<>(taskTO, "concurrentSettings"); - AjaxCheckBoxPanel enableConcurrentSettings = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel enableConcurrentSettings = new AjaxTripleStateButtonPanel( "enableConcurrentSettings", "enableConcurrentSettings", new IModel() { private static final long serialVersionUID = -7126718045816207110L; @@ -394,7 +402,8 @@ public Boolean getObject() { public void setObject(final Boolean object) { // nothing to do } - }); + }, false); + enableConcurrentSettings.addRequiredLabel(); provisioningTaskSpecifics.add(enableConcurrentSettings. setVisible(taskTO instanceof ProvisioningTaskTO).setOutputMarkupId(true)); @@ -410,7 +419,7 @@ public void setObject(final Boolean object) { provisioningTaskSpecifics.add(poolSize); enableConcurrentSettings.getField().add( - new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; @@ -461,8 +470,11 @@ protected Iterator getChoices(final String input) { return destinationRealm; } - private AjaxCheckBoxPanel remediation(final String id, final SchedTaskTO taskTO) { - return new AjaxCheckBoxPanel(id, "remediation", new PropertyModel<>(taskTO, "remediation"), false); + private FieldPanel remediation(final String id, final SchedTaskTO taskTO) { + AjaxTripleStateButtonPanel remediation = new AjaxTripleStateButtonPanel( + id, "remediation", new PropertyModel<>(taskTO, "remediation"), false); + remediation.addRequiredLabel(); + return remediation; } } diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrsWizardStep.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrsWizardStep.java index 1f6bd71bbb8..bdca5069bba 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrsWizardStep.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/AbstractAttrsWizardStep.java @@ -37,13 +37,13 @@ import org.apache.syncope.client.console.rest.SchemaRestClient; import org.apache.syncope.client.ui.commons.ajax.markup.html.LabelInfo; import org.apache.syncope.client.ui.commons.markup.html.form.AbstractFieldPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoicePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxNumberFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxPalettePanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.markup.html.form.BinaryFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.EncryptedFieldPanel; import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel; @@ -205,12 +205,12 @@ protected AbstractFieldPanel getFieldPanel(final PlainSchemaTO plainSchema, f AbstractFieldPanel panel; switch (type) { case Boolean: - panel = new AjaxCheckBoxPanel( + panel = new AjaxTripleStateButtonPanel( "panel", plainSchema.getLabel(SyncopeConsoleSession.get().getLocale()), new Model<>(), true); - panel.setRequired(required); + break; case Date: @@ -232,10 +232,6 @@ protected AbstractFieldPanel getFieldPanel(final PlainSchemaTO plainSchema, f FastDateFormat.getInstance(datePattern)); } - if (required) { - panel.addRequiredLabel(); - } - break; case Enum: @@ -268,9 +264,6 @@ public String getObject( }); } - if (required) { - panel.addRequiredLabel(); - } break; case Dropdown: @@ -291,9 +284,6 @@ public String getObject( ((AjaxDropDownChoicePanel) panel).setChoices(dropdownValues); } - if (required) { - panel.addRequiredLabel(); - } break; case Long: @@ -303,9 +293,6 @@ public String getObject( Long.class, new Model<>()); - if (required) { - panel.addRequiredLabel(); - } break; case Double: @@ -315,9 +302,6 @@ public String getObject( Double.class, new Model<>()); - if (required) { - panel.addRequiredLabel(); - } break; case Binary: @@ -336,9 +320,7 @@ protected PageReference getPageReference() { return pageRef; } }; - if (required) { - panel.addRequiredLabel(); - } + break; case Encrypted: @@ -348,9 +330,6 @@ protected PageReference getPageReference() { : new EncryptedFieldPanel("panel", plainSchema.getLabel(SyncopeConsoleSession.get().getLocale()), new Model<>(), true); - if (required) { - panel.addRequiredLabel(); - } break; default: @@ -360,12 +339,11 @@ protected PageReference getPageReference() { if (jexlHelp) { AjaxTextFieldPanel.class.cast(panel).enableJexlHelp(); } - - if (required) { - panel.addRequiredLabel(); - } } + if (required) { + panel.addRequiredLabel(); + } panel.setReadOnly(readOnly); return panel; @@ -380,7 +358,7 @@ protected FormComponent checkboxToggle( return null; } - private class AttrComparator implements Comparator, Serializable { + private final class AttrComparator implements Comparator, Serializable { private static final long serialVersionUID = -5105030477767941060L; diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java index 3492d5ff6d7..fd44d67c910 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/UserDetails.java @@ -22,8 +22,8 @@ import org.apache.commons.lang3.Strings; import org.apache.syncope.client.ui.commons.Constants; import org.apache.syncope.client.ui.commons.ajax.markup.html.LabelInfo; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.client.ui.commons.rest.AnonymousRestClient; import org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion; import org.apache.syncope.client.ui.commons.wizards.any.PasswordPanel; @@ -115,8 +115,9 @@ public void validate(final Form form) { // ------------------------ // mustChangePassword // ------------------------ - AjaxCheckBoxPanel mustChangePassword = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel mustChangePassword = new AjaxTripleStateButtonPanel( "mustChangePassword", "mustChangePassword", new PropertyModel<>(userTO, "mustChangePassword")); + mustChangePassword.addRequiredLabel(); add(mustChangePassword.setOutputMarkupPlaceholderTag(true).setVisible(templateMode)); // ------------------------ diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/mapping/AbstractMappingPanel.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/mapping/AbstractMappingPanel.java index 1b1bc84840f..02ea985ea14 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/mapping/AbstractMappingPanel.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/mapping/AbstractMappingPanel.java @@ -31,9 +31,10 @@ import org.apache.syncope.client.console.widgets.JEXLTransformerWidget; import org.apache.syncope.client.ui.commons.ConnIdSpecialName; import org.apache.syncope.client.ui.commons.Constants; +import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormChoiceComponentUpdatingBehavior; import org.apache.syncope.client.ui.commons.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; -import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel; import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel; +import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTripleStateButtonPanel; import org.apache.syncope.common.lib.to.Item; import org.apache.syncope.common.lib.types.MappingPurpose; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -250,10 +251,11 @@ protected void populateItem(final ListItem item) { //-------------------------------- // Connector object key // ------------------------------- - AjaxCheckBoxPanel connObjectKey = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel connObjectKey = new AjaxTripleStateButtonPanel( "connObjectKey", "connObjectKey", new PropertyModel<>(itemTO, "connObjectKey"), false); + connObjectKey.setRequired(true); connObjectKey.hideLabel(); item.add(connObjectKey); // ------------------------------- @@ -261,10 +263,11 @@ protected void populateItem(final ListItem item) { //-------------------------------- // Password // ------------------------------- - AjaxCheckBoxPanel password = new AjaxCheckBoxPanel( + AjaxTripleStateButtonPanel password = new AjaxTripleStateButtonPanel( "password", "password", new PropertyModel<>(itemTO, "password"), false); + password.setRequired(true); item.add(password.hideLabel()); // ------------------------------- @@ -307,7 +310,7 @@ protected void onUpdate(final AjaxRequestTarget target) { } }); - connObjectKey.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + connObjectKey.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; @@ -326,7 +329,7 @@ protected void onUpdate(final AjaxRequestTarget target) { } }); - password.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { + password.getField().add(new IndicatorAjaxFormChoiceComponentUpdatingBehavior() { private static final long serialVersionUID = -1107858522700306810L; @@ -425,7 +428,8 @@ protected boolean hideConnObjectKey() { * @param connObjectKey connObjectKey checkbox. * @param password password checkbox. */ - protected void setConnObjectKey(final AjaxCheckBoxPanel connObjectKey, final AjaxCheckBoxPanel password) { + protected void setConnObjectKey( + final AjaxTripleStateButtonPanel connObjectKey, final AjaxTripleStateButtonPanel password) { if (password.getModelObject()) { connObjectKey.setReadOnly(true); connObjectKey.setModelObject(false); diff --git a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/TogglePanel.html b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/TogglePanel.html index 045e483949c..c88d05fa738 100644 --- a/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/TogglePanel.html +++ b/client/idrepo/console/src/main/resources/org/apache/syncope/client/console/panels/TogglePanel.html @@ -120,9 +120,8 @@