Search in sources :

Example 6 with PolicyConstraintsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.PolicyConstraintsType in project midpoint by Evolveum.

the class BaseAbstractRolePanel method initLayout.

@Override
protected void initLayout() {
    minAssignmentModel = new LoadableModel<List<MultiplicityPolicyConstraintType>>(false) {

        @Override
        protected List<MultiplicityPolicyConstraintType> load() {
            if (abstractRole.getPolicyConstraints() == null) {
                abstractRole.setPolicyConstraints(new PolicyConstraintsType());
            }
            return abstractRole.getPolicyConstraints().getMinAssignees();
        }
    };
    maxAssignmentsModel = new LoadableModel<List<MultiplicityPolicyConstraintType>>(false) {

        @Override
        protected List<MultiplicityPolicyConstraintType> load() {
            if (abstractRole.getPolicyConstraints() == null) {
                abstractRole.setPolicyConstraints(new PolicyConstraintsType());
            }
            return abstractRole.getPolicyConstraints().getMaxAssignees();
        }
    };
    GenericMultiValueLabelEditPanel minAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MIN_ASSIGNMENTS, minAssignmentModel, createStringResource("PageRoleEditor.label.minAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true) {

        @Override
        protected IModel<String> createTextModel(IModel<MultiplicityPolicyConstraintType> model) {
            return createMultiplicityPolicyLabel(model);
        }

        @Override
        protected void editValuePerformed(AjaxRequestTarget target, IModel<MultiplicityPolicyConstraintType> rowModel) {
            MultiplicityPolicyPanel window = new MultiplicityPolicyPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject()) {

                @Override
                protected void savePerformed(AjaxRequestTarget target) {
                    closeModalWindow(target);
                    target.add(getMinAssignmentsContainer());
                }
            };
            showDialog(window, target);
        }

        @Override
        protected MultiplicityPolicyConstraintType createNewEmptyItem() {
            return new MultiplicityPolicyConstraintType();
        }
    };
    minAssignments.setOutputMarkupId(true);
    add(minAssignments);
    GenericMultiValueLabelEditPanel maxAssignments = new GenericMultiValueLabelEditPanel<MultiplicityPolicyConstraintType>(ID_MAX_ASSIGNMENTS, maxAssignmentsModel, createStringResource("PageRoleEditor.label.maxAssignments"), ID_LABEL_SIZE, ID_INPUT_SIZE, true) {

        @Override
        protected IModel<String> createTextModel(IModel<MultiplicityPolicyConstraintType> model) {
            return createMultiplicityPolicyLabel(model);
        }

        @Override
        protected void editValuePerformed(AjaxRequestTarget target, IModel<MultiplicityPolicyConstraintType> rowModel) {
            MultiplicityPolicyPanel window = new MultiplicityPolicyPanel(getPageBase().getMainPopupBodyId(), rowModel.getObject()) {

                @Override
                protected void savePerformed(AjaxRequestTarget target) {
                    closeModalWindow(target);
                    target.add(getMaxAssignmentsContainer());
                }
            };
            showDialog(window, target);
        }

        @Override
        protected MultiplicityPolicyConstraintType createNewEmptyItem() {
            return new MultiplicityPolicyConstraintType();
        }
    };
    maxAssignments.setOutputMarkupId(true);
    add(maxAssignments);
}
Also used : PolicyConstraintsType(com.evolveum.midpoint.xml.ns._public.common.common_3.PolicyConstraintsType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) MultiplicityPolicyPanel(com.evolveum.midpoint.web.page.admin.roles.component.MultiplicityPolicyPanel) IModel(org.apache.wicket.model.IModel) GenericMultiValueLabelEditPanel(com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel) MultiplicityPolicyConstraintType(com.evolveum.midpoint.xml.ns._public.common.common_3.MultiplicityPolicyConstraintType) List(java.util.List)

Aggregations

PolicyConstraintsType (com.evolveum.midpoint.xml.ns._public.common.common_3.PolicyConstraintsType)6 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)4 ContainerDelta (com.evolveum.midpoint.prism.delta.ContainerDelta)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 GenericMultiValueLabelEditPanel (com.evolveum.midpoint.web.component.form.multivalue.GenericMultiValueLabelEditPanel)2 MultiplicityPolicyPanel (com.evolveum.midpoint.web.page.admin.roles.component.MultiplicityPolicyPanel)2 MultiplicityPolicyConstraintType (com.evolveum.midpoint.xml.ns._public.common.common_3.MultiplicityPolicyConstraintType)2 List (java.util.List)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 IModel (org.apache.wicket.model.IModel)2 EvaluatedPolicyRuleTrigger (com.evolveum.midpoint.model.api.context.EvaluatedPolicyRuleTrigger)1 ModificationPolicyConstraintType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModificationPolicyConstraintType)1