Search in sources :

Example 21 with PropertyModel

use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.

the class ResourceCredentialsEditor method initLayout.

protected void initLayout(final PageResourceWizard parentPage) {
    DropDownChoice fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<AttributeFetchStrategyType>(getModel(), "password.fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<AttributeFetchStrategyType>(this));
    parentPage.addEditingEnabledBehavior(fetchStrategy);
    add(fetchStrategy);
    VisibleEnableBehaviour showIfEditingOrOutboundExists = new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            ResourceCredentialsDefinitionType credentials = getModel().getObject();
            if (credentials == null || credentials.getPassword() == null) {
                return !parentPage.isReadOnly();
            }
            return !parentPage.isReadOnly() || credentials.getPassword().getOutbound() != null;
        }
    };
    TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            ResourceCredentialsDefinitionType credentials = getModel().getObject();
            if (credentials == null || credentials.getPassword() == null) {
                return null;
            }
            // TODO: support multiple password mappings
            MappingType outbound = null;
            List<MappingType> outbounds = credentials.getPassword().getOutbound();
            if (!outbounds.isEmpty()) {
                outbound = outbounds.get(0);
            }
            return MappingTypeDto.createMappingLabel(outbound, LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
        }
    });
    outboundLabel.setEnabled(false);
    outboundLabel.setOutputMarkupId(true);
    outboundLabel.add(showIfEditingOrOutboundExists);
    add(outboundLabel);
    AjaxSubmitLink outbound = new AjaxSubmitLink(ID_OUTBOUND_BUTTON) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            outboundEditPerformed(target);
        }
    };
    outbound.setOutputMarkupId(true);
    outbound.add(showIfEditingOrOutboundExists);
    add(outbound);
    MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<List<MappingType>>(getModel(), "password.inbound"), null, false, true, parentPage.getReadOnlyModel()) {

        @Override
        protected IModel<String> createTextModel(final IModel<MappingType> model) {
            return new Model<String>() {

                @Override
                public String getObject() {
                    return MappingTypeDto.createMappingLabel(model.getObject(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
                }
            };
        }

        @Override
        protected MappingType createNewEmptyItem() {
            return WizardUtil.createEmptyMapping();
        }

        @Override
        protected void editPerformed(AjaxRequestTarget target, MappingType object) {
            inboundEditPerformed(target, object);
        }
    };
    inbound.setOutputMarkupId(true);
    add(inbound);
    DropDownChoice passwordPolicy = new DropDownChoice<>(ID_PASS_POLICY, new PropertyModel<ObjectReferenceType>(getModel(), "password.passwordPolicyRef"), new AbstractReadOnlyModel<List<ObjectReferenceType>>() {

        @Override
        public List<ObjectReferenceType> getObject() {
            return WebModelServiceUtils.createObjectReferenceList(ValuePolicyType.class, getPageBase(), passPolicyMap);
        }
    }, new ObjectReferenceChoiceRenderer(passPolicyMap));
    parentPage.addEditingEnabledBehavior(passwordPolicy);
    add(passwordPolicy);
    Label fetchTooltip = new Label(ID_T_FETCH);
    fetchTooltip.add(new InfoTooltipBehavior());
    add(fetchTooltip);
    Label outTooltip = new Label(ID_T_OUT);
    outTooltip.add(new InfoTooltipBehavior());
    add(outTooltip);
    Label inTooltip = new Label(ID_T_IN);
    inTooltip.add(new InfoTooltipBehavior());
    add(inTooltip);
    Label passPolicyTooltip = new Label(ID_T_PASS_POLICY);
    passPolicyTooltip.add(new InfoTooltipBehavior());
    add(passPolicyTooltip);
    initModals(parentPage.getReadOnlyModel());
}
Also used : ObjectReferenceChoiceRenderer(com.evolveum.midpoint.web.component.input.ObjectReferenceChoiceRenderer) Form(org.apache.wicket.markup.html.form.Form) Label(org.apache.wicket.markup.html.basic.Label) AjaxSubmitLink(org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink) MultiValueTextEditPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel) TextField(org.apache.wicket.markup.html.form.TextField) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) IModel(org.apache.wicket.model.IModel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) NonEmptyModel(com.evolveum.midpoint.gui.api.model.NonEmptyModel) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel)

Example 22 with PropertyModel

use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.

the class ResourceIterationEditor method prepareIterationSubsectionBody.

private void prepareIterationSubsectionBody(String containerValue, String descriptionId, String variableId, String returnMultiplicityId, String expressionType, final String expression, final String languageId, final String policyId, final String prefix, final String languageContainerId, final String policyContainerId, PageResourceWizard parentPage) {
    TextArea description = new TextArea<>(descriptionId, new PropertyModel<String>(model, IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".description"));
    parentPage.addEditingEnabledBehavior(description);
    add(description);
    MultiValueTextEditPanel variableList = new MultiValueTextEditPanel<ExpressionVariableDefinitionType>(variableId, new PropertyModel<List<ExpressionVariableDefinitionType>>(model, IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".variable"), null, false, true, parentPage.getReadOnlyModel()) {

        @Override
        protected IModel<String> createTextModel(final IModel<ExpressionVariableDefinitionType> model) {
            return new Model<String>() {

                @Override
                public String getObject() {
                    ExpressionVariableDefinitionType variable = model.getObject();
                    if (variable != null && variable.getName() != null) {
                        return variable.getName().getLocalPart();
                    } else {
                        return null;
                    }
                }
            };
        }

        @Override
        protected ExpressionVariableDefinitionType createNewEmptyItem() {
            return new ExpressionVariableDefinitionType();
        }

        @Override
        protected void editPerformed(AjaxRequestTarget target, ExpressionVariableDefinitionType object) {
            expressionVariableEditPerformed(target, object);
        }
    };
    add(variableList);
    DropDownChoice returnMultiplicity = new DropDownChoice<>(returnMultiplicityId, new PropertyModel<ExpressionReturnMultiplicityType>(model, IterationSpecificationTypeDto.F_ITERATION + "." + containerValue + ".returnMultiplicity"), WebComponentUtil.createReadonlyModelFromEnum(ExpressionReturnMultiplicityType.class), new EnumChoiceRenderer<ExpressionReturnMultiplicityType>(this));
    parentPage.addEditingEnabledBehavior(returnMultiplicity);
    add(returnMultiplicity);
}
Also used : IModel(org.apache.wicket.model.IModel) TextArea(org.apache.wicket.markup.html.form.TextArea) MultiValueTextEditPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) IModel(org.apache.wicket.model.IModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) List(java.util.List)

Example 23 with PropertyModel

use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.

the class DefinitionBasicPanel method initBasicInfoLayout.

private void initBasicInfoLayout() {
    final TextField nameField = new TextField(ID_NAME, new PropertyModel<>(getModel(), CertDefinitionDto.F_NAME));
    nameField.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return true;
        }
    });
    add(nameField);
    final TextArea descriptionField = new TextArea(ID_DESCRIPTION, new PropertyModel<>(getModel(), CertDefinitionDto.F_DESCRIPTION));
    descriptionField.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return true;
        }
    });
    add(descriptionField);
    final WebMarkupContainer ownerRefChooser = createOwnerRefChooser(ID_OWNER_REF_CHOOSER);
    ownerRefChooser.setOutputMarkupId(true);
    add(ownerRefChooser);
    DropDownChoice remediation = new DropDownChoice<>(ID_REMEDIATION, new Model<AccessCertificationRemediationStyleType>() {

        @Override
        public AccessCertificationRemediationStyleType getObject() {
            return getModel().getObject().getRemediationStyle();
        }

        @Override
        public void setObject(AccessCertificationRemediationStyleType object) {
            getModel().getObject().setRemediationStyle(object);
        }
    }, WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationRemediationStyleType.class), new EnumChoiceRenderer<>(this));
    add(remediation);
    DropDownChoice outcomeStrategy = new DropDownChoice<>(ID_OUTCOME_STRATEGY, new PropertyModel<>(getModel(), CertDefinitionDto.F_OUTCOME_STRATEGY), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationCaseOutcomeStrategyType.class), new EnumChoiceRenderer<>(this));
    add(outcomeStrategy);
    add(WebComponentUtil.createHelp(ID_OUTCOME_STRATEGY_HELP));
    Label stopReviewOn = new Label(ID_STOP_REVIEW_ON, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            List<AccessCertificationResponseType> stopOn = getModel().getObject().getStopReviewOn();
            return CertMiscUtil.getStopReviewOnText(stopOn, getPageBase());
        }
    });
    add(stopReviewOn);
    //        add(new Label(ID_REVIEW_STAGE_CAMPAIGNS, new PropertyModel<>(getModel(), CertDefinitionDto.F_NUMBER_OF_STAGES)));
    //        add(new Label(ID_CAMPAIGNS_TOTAL, new PropertyModel<>(getModel(), CertDefinitionDto.F_NUMBER_OF_STAGES)));
    add(new Label(ID_LAST_STARTED, new PropertyModel<>(getModel(), CertDefinitionDto.F_LAST_STARTED)));
    add(new Label(ID_LAST_CLOSED, new PropertyModel<>(getModel(), CertDefinitionDto.F_LAST_CLOSED)));
    add(WebComponentUtil.createHelp(ID_LAST_STARTED_HELP));
    add(WebComponentUtil.createHelp(ID_LAST_CLOSED_HELP));
}
Also used : TextArea(org.apache.wicket.markup.html.form.TextArea) Label(org.apache.wicket.markup.html.basic.Label) PropertyModel(org.apache.wicket.model.PropertyModel) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) AccessCertificationRemediationStyleType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationRemediationStyleType) AccessCertificationCaseOutcomeStrategyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType) TextField(org.apache.wicket.markup.html.form.TextField) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 24 with PropertyModel

use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.

the class DefinitionStagePanel method initLayout.

protected void initLayout(PageBase pageBase) {
    TextField nameField = new TextField<>(ID_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_NAME));
    add(nameField);
    TextArea descriptionField = new TextArea<>(ID_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DESCRIPTION));
    add(descriptionField);
    TextField durationField = new TextField<>(ID_DURATION, new PropertyModel<>(getModel(), StageDefinitionDto.F_DURATION));
    add(durationField);
    add(WebComponentUtil.createHelp(ID_STAGE_DURATION_HELP));
    TextField notifyBeforeDeadlineField = new TextField<>(ID_NOTIFY_BEFORE_DEADLINE, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_BEFORE_DEADLINE));
    add(notifyBeforeDeadlineField);
    add(WebComponentUtil.createHelp(ID_NOTIFY_BEFORE_DEADLINE_HELP));
    add(new CheckBox(ID_NOTIFY_ONLY_WHEN_NO_DECISION, new PropertyModel<>(getModel(), StageDefinitionDto.F_NOTIFY_ONLY_WHEN_NO_DECISION)));
    add(WebComponentUtil.createHelp(ID_NOTIFY_WHEN_NO_DECISION_HELP));
    TextField reviewerNameField = new TextField<>(ID_REVIEWER_NAME, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_NAME));
    add(reviewerNameField);
    TextArea reviewerDescriptionField = new TextArea<>(ID_REVIEWER_DESCRIPTION, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DESCRIPTION));
    add(reviewerDescriptionField);
    add(new CheckBox(ID_USE_TARGET_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_OWNER)));
    add(new CheckBox(ID_USE_TARGET_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_TARGET_APPROVER)));
    add(WebComponentUtil.createHelp(ID_TARGET_HELP));
    add(new CheckBox(ID_USE_OBJECT_OWNER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_OWNER)));
    add(new CheckBox(ID_USE_OBJECT_APPROVER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_APPROVER)));
    add(WebComponentUtil.createHelp(ID_OBJECT_HELP));
    AjaxCheckBox useObjectManagerCheckbox = new AjaxCheckBox(ID_USE_OBJECT_MANAGER, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER_PRESENT)) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(DefinitionStagePanel.this.get(ID_USE_OBJECT_MANAGER_DETAILS));
        }
    };
    add(useObjectManagerCheckbox);
    WebMarkupContainer useObjectManagerDetails = new WebMarkupContainer(ID_USE_OBJECT_MANAGER_DETAILS);
    useObjectManagerDetails.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return useObjectManagerCheckbox.getModelObject();
        }
    });
    useObjectManagerDetails.setOutputMarkupId(true);
    add(useObjectManagerDetails);
    add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_HELP));
    TextField orgTypeField = new TextField<>(ID_USE_OBJECT_MANAGER_ORG_TYPE, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ORG_TYPE));
    orgTypeField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    useObjectManagerDetails.add(orgTypeField);
    useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ORG_TYPE_HELP));
    CheckBox allowSelf = new CheckBox(ID_USE_OBJECT_MANAGER_ALLOW_SELF, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_USE_OBJECT_MANAGER + "." + ManagerSearchDto.F_ALLOW_SELF));
    allowSelf.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    useObjectManagerDetails.add(allowSelf);
    useObjectManagerDetails.add(WebComponentUtil.createHelp(ID_USE_OBJECT_MANAGER_ALLOW_SELF_HELP));
    PrismPropertyPanel defaultOwnerRefPanel = new NoOffsetPrismReferencePanel(ID_DEFAULT_REVIEWER_REF, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_DEFAULT_REVIEWERS), null, pageBase);
    defaultOwnerRefPanel.setLabelContainerVisible(false);
    add(defaultOwnerRefPanel);
    add(WebComponentUtil.createHelp(ID_DEFAULT_REVIEWER_REF_HELP));
    PrismPropertyPanel additionalOwnerRefPanel = new NoOffsetPrismReferencePanel(ID_ADDITIONAL_REVIEWER_REF, new PropertyModel<>(getModel(), StageDefinitionDto.F_REVIEWER_DTO + "." + AccessCertificationReviewerDto.F_ADDITIONAL_REVIEWERS), null, pageBase);
    additionalOwnerRefPanel.setLabelContainerVisible(false);
    add(additionalOwnerRefPanel);
    add(WebComponentUtil.createHelp(ID_ADDITIONAL_REVIEWER_REF_HELP));
    DropDownChoice outcomeStrategy1 = new DropDownChoice<>(ID_OUTCOME_STRATEGY, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_STRATEGY), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationCaseOutcomeStrategyType.class), new EnumChoiceRenderer<>(this));
    add(outcomeStrategy1);
    add(WebComponentUtil.createHelp(ID_OUTCOME_STRATEGY_HELP));
    DropDownChoice<AccessCertificationResponseType> outcomeIfNoReviewers = new DropDownChoice<>(ID_OUTCOME_IF_NO_REVIEWERS, new PropertyModel<>(getModel(), StageDefinitionDto.F_OUTCOME_IF_NO_REVIEWERS), WebComponentUtil.createReadonlyModelFromEnum(AccessCertificationResponseType.class), new EnumChoiceRenderer<>(this));
    add(outcomeIfNoReviewers);
    add(WebComponentUtil.createHelp(ID_OUTCOME_IF_NO_REVIEWERS_HELP));
    Label stopReviewOn = new Label(ID_STOP_REVIEW_ON, new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            List<AccessCertificationResponseType> stopOn = getModelObject().getStopReviewOn();
            return CertMiscUtil.getStopReviewOnText(stopOn, getPageBase());
        }
    });
    add(stopReviewOn);
    add(WebComponentUtil.createHelp(ID_STOP_REVIEW_ON_HELP));
}
Also used : PrismPropertyPanel(com.evolveum.midpoint.web.component.prism.PrismPropertyPanel) PropertyModel(org.apache.wicket.model.PropertyModel) EmptyOnBlurAjaxFormUpdatingBehaviour(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour) Label(org.apache.wicket.markup.html.basic.Label) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AccessCertificationResponseType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AccessCertificationCaseOutcomeStrategyType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 25 with PropertyModel

use of org.apache.wicket.model.PropertyModel in project midpoint by Evolveum.

the class CapabilityActivationPanel method initLayout.

protected void initLayout(PageResourceWizard parentPage) {
    parentPage.addEditingEnabledBehavior(this);
    CheckBox validFromEnabled = new CheckBox(ID_CHECK_VALID_FROM_ENABLED, new PropertyModel<Boolean>(getModel(), "capability.validFrom.enabled"));
    add(validFromEnabled);
    CheckBox validFromReturned = new CheckBox(ID_CHECK_VALID_FROM_RETURNED, new PropertyModel<Boolean>(getModel(), "capability.validFrom.returnedByDefault"));
    add(validFromReturned);
    CheckBox validToEnabled = new CheckBox(ID_CHECK_VALID_TO_ENABLED, new PropertyModel<Boolean>(getModel(), "capability.validTo.enabled"));
    add(validToEnabled);
    CheckBox validToReturned = new CheckBox(ID_CHECK_VALID_TO_RETURNED, new PropertyModel<Boolean>(getModel(), "capability.validTo.returnedByDefault"));
    add(validToReturned);
    add(new CheckBox(ID_CHECK_STATUS_ENABLED, new PropertyModel<Boolean>(getModel(), "capability.status.enabled")));
    add(new CheckBox(ID_CHECK_STATUS_RETURNED, new PropertyModel<Boolean>(getModel(), "capability.status.returnedByDefault")));
    add(new CheckBox(ID_CHECK_STATUS_IGNORE, new PropertyModel<Boolean>(getModel(), "capability.status.ignoreAttribute")));
    MultiValueTextPanel statusEnableList = new MultiValueTextPanel<String>(ID_STATUS_ENABLE_LIST, new PropertyModel<List<String>>(getModel(), "capability.status.enableValue"), parentPage.getReadOnlyModel(), false) {

        @Override
        protected StringResourceModel createEmptyItemPlaceholder() {
            return createStringResource("capabilityActivationPanel.list.placeholder");
        }
    };
    add(statusEnableList);
    MultiValueTextPanel statusDisableList = new MultiValueTextPanel<String>(ID_STATUS_DISABLE_LIST, new PropertyModel<List<String>>(getModel(), "capability.status.disableValue"), parentPage.getReadOnlyModel(), false) {

        @Override
        protected StringResourceModel createEmptyItemPlaceholder() {
            return createStringResource("capabilityActivationPanel.list.placeholder");
        }
    };
    add(statusDisableList);
    IChoiceRenderer<QName> renderer = new QNameChoiceRenderer(true);
    DropDownChoice statusChoice = new DropDownChoice<>(ID_SELECT_STATUS, new PropertyModel<QName>(getModel(), "capability.status.attribute"), createAttributeChoiceModel(renderer), renderer);
    add(statusChoice);
    add(new CheckBox(ID_CHECK_LOCKOUT_ENABLED, new PropertyModel<Boolean>(getModel(), "capability.lockoutStatus.enabled")));
    add(new CheckBox(ID_CHECK_LOCKOUT_RETURNED, new PropertyModel<Boolean>(getModel(), "capability.lockoutStatus.returnedByDefault")));
    add(new CheckBox(ID_CHECK_LOCKOUT_IGNORE, new PropertyModel<Boolean>(getModel(), "capability.lockoutStatus.ignoreAttribute")));
    MultiValueTextPanel lockoutNormalList = new MultiValueTextPanel<String>(ID_LOCKOUT_NORMAL_LIST, new PropertyModel<List<String>>(getModel(), "capability.lockoutStatus.normalValue"), parentPage.getReadOnlyModel(), false) {

        @Override
        protected StringResourceModel createEmptyItemPlaceholder() {
            return createStringResource("capabilityActivationPanel.list.placeholder");
        }
    };
    add(lockoutNormalList);
    MultiValueTextPanel lockoutLockedList = new MultiValueTextPanel<String>(ID_LOCKOUT_LOCKED_LIST, new PropertyModel<List<String>>(getModel(), "capability.lockoutStatus.lockedValue"), parentPage.getReadOnlyModel(), false) {

        @Override
        protected StringResourceModel createEmptyItemPlaceholder() {
            return createStringResource("capabilityActivationPanel.list.placeholder");
        }
    };
    add(lockoutLockedList);
    IChoiceRenderer<QName> lockoutRenderer = new QNameChoiceRenderer(true);
    DropDownChoice lockoutChoice = new DropDownChoice<>(ID_SELECT_LOCKOUT, new PropertyModel<QName>(getModel(), "capability.lockoutStatus.attribute"), createAttributeChoiceModel(lockoutRenderer), lockoutRenderer);
    add(lockoutChoice);
    add(WebComponentUtil.createHelp(ID_T_L_ENABLED));
    add(WebComponentUtil.createHelp(ID_T_L_RETURNED_BY_DEFAULT));
    add(WebComponentUtil.createHelp(ID_T_L_IGNORE_ATTR));
    add(WebComponentUtil.createHelp(ID_T_L_ATTR_NAME));
    add(WebComponentUtil.createHelp(ID_T_L_NORMAL_LIST));
    add(WebComponentUtil.createHelp(ID_T_L_LOCKED_LIST));
    Label enabledTooltip = new Label(ID_T_ENABLED);
    enabledTooltip.add(new InfoTooltipBehavior());
    add(enabledTooltip);
    Label returnTooltip = new Label(ID_T_RETURNED_BY_DEFAULT);
    returnTooltip.add(new InfoTooltipBehavior());
    add(returnTooltip);
    Label ignoreTooltip = new Label(ID_T_IGNORE_ATTR);
    ignoreTooltip.add(new InfoTooltipBehavior());
    add(ignoreTooltip);
    Label attributeNameTooltip = new Label(ID_T_ATTR_NAME);
    attributeNameTooltip.add(new InfoTooltipBehavior());
    add(attributeNameTooltip);
    Label enableListTooltip = new Label(ID_T_ENABLE_LIST);
    enableListTooltip.add(new InfoTooltipBehavior());
    add(enableListTooltip);
    Label disableListTooltip = new Label(ID_T_DISABLE_LIST);
    disableListTooltip.add(new InfoTooltipBehavior());
    add(disableListTooltip);
    Label vFromEnabledTooltip = new Label(ID_T_V_FROM_ENABLED);
    vFromEnabledTooltip.add(new InfoTooltipBehavior());
    add(vFromEnabledTooltip);
    Label vFromReturnTooltip = new Label(ID_T_V_FROM_RETURN);
    vFromReturnTooltip.add(new InfoTooltipBehavior());
    add(vFromReturnTooltip);
    Label vToEnabledTooltip = new Label(ID_T_V_TO_ENABLED);
    vToEnabledTooltip.add(new InfoTooltipBehavior());
    add(vToEnabledTooltip);
    Label vToReturnTooltip = new Label(ID_T_V_TO_RETURN);
    vToReturnTooltip.add(new InfoTooltipBehavior());
    add(vToReturnTooltip);
}
Also used : QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) QName(javax.xml.namespace.QName) PropertyModel(org.apache.wicket.model.PropertyModel) Label(org.apache.wicket.markup.html.basic.Label) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) CheckBox(org.apache.wicket.markup.html.form.CheckBox) List(java.util.List) MultiValueTextPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel)

Aggregations

PropertyModel (org.apache.wicket.model.PropertyModel)70 Label (org.apache.wicket.markup.html.basic.Label)38 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)37 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)32 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)29 ArrayList (java.util.ArrayList)22 List (java.util.List)21 IModel (org.apache.wicket.model.IModel)21 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)20 ListItem (org.apache.wicket.markup.html.list.ListItem)17 ListView (org.apache.wicket.markup.html.list.ListView)15 Model (org.apache.wicket.model.Model)13 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)10 TextField (org.apache.wicket.markup.html.form.TextField)10 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)9 QName (javax.xml.namespace.QName)8 Form (org.apache.wicket.markup.html.form.Form)8 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)6 AttributeAppender (org.apache.wicket.behavior.AttributeAppender)6 MultiValueTextEditPanel (com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel)5