Search in sources :

Example 1 with PolicyConstraintEnforcementType

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

the class MultiplicityPolicyPanel method initLayout.

private void initLayout() {
    Form form = new Form(ID_MAIN_FORM);
    form.setOutputMarkupId(true);
    add(form);
    TextAreaFormGroup description = new TextAreaFormGroup(ID_DESCRIPTION, new PropertyModel<String>(model, MultiplicityPolicyConstraintType.F_DESCRIPTION.getLocalPart()), createStringResource("multiplicityContainer.label.description"), ID_LABEL_SIZE, ID_INPUT_SIZE);
    form.add(description);
    DropDownFormGroup enforcement = new DropDownFormGroup<>(ID_ENFORCEMENT, new PropertyModel<PolicyConstraintEnforcementType>(model, MultiplicityPolicyConstraintType.F_ENFORCEMENT.getLocalPart()), WebComponentUtil.createReadonlyModelFromEnum(PolicyConstraintEnforcementType.class), new EnumChoiceRenderer<PolicyConstraintEnforcementType>(), createStringResource("multiplicityContainer.label.enforcement"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
    form.add(enforcement);
    WebMarkupContainer multiplicityContainer = new WebMarkupContainer(ID_MULTIPLICITY_CONTAINER);
    multiplicityContainer.setOutputMarkupId(true);
    form.add(multiplicityContainer);
    TextField multiplicity = new TextField<>(ID_MULTIPLICITY, new PropertyModel<String>(model, MultiplicityPolicyConstraintType.F_MULTIPLICITY.getLocalPart()));
    multiplicity.add(prepareMultiplicityValidator());
    multiplicity.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isEnabled() {
            return !unbounded;
        }
    });
    multiplicityContainer.add(multiplicity);
    CheckBox multiplicityUnbounded = new CheckBox(ID_MULTIPLICITY_UNBOUND, new PropertyModel<Boolean>(this, MULTIPLICITY_UNBOUNDED));
    multiplicityUnbounded.add(new OnChangeAjaxBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            model.getObject().setMultiplicity(MULTIPLICITY_UNBOUNDED);
            target.add(getMultiplicityContainer());
        }
    });
    multiplicityContainer.add(multiplicityUnbounded);
    initButtons(form);
}
Also used : DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup) Form(org.apache.wicket.markup.html.form.Form) PolicyConstraintEnforcementType(com.evolveum.midpoint.xml.ns._public.common.common_3.PolicyConstraintEnforcementType) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) OnChangeAjaxBehavior(org.apache.wicket.ajax.form.OnChangeAjaxBehavior) TextAreaFormGroup(com.evolveum.midpoint.web.component.form.TextAreaFormGroup) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) CheckBox(org.apache.wicket.markup.html.form.CheckBox) TextField(org.apache.wicket.markup.html.form.TextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

DropDownFormGroup (com.evolveum.midpoint.web.component.form.DropDownFormGroup)1 TextAreaFormGroup (com.evolveum.midpoint.web.component.form.TextAreaFormGroup)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 PolicyConstraintEnforcementType (com.evolveum.midpoint.xml.ns._public.common.common_3.PolicyConstraintEnforcementType)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 OnChangeAjaxBehavior (org.apache.wicket.ajax.form.OnChangeAjaxBehavior)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 CheckBox (org.apache.wicket.markup.html.form.CheckBox)1 Form (org.apache.wicket.markup.html.form.Form)1 TextField (org.apache.wicket.markup.html.form.TextField)1