Search in sources :

Example 1 with PrismPropertyPanel

use of com.evolveum.midpoint.web.component.prism.PrismPropertyPanel 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)

Aggregations

PrismPropertyPanel (com.evolveum.midpoint.web.component.prism.PrismPropertyPanel)1 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)1 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)1 AccessCertificationCaseOutcomeStrategyType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCaseOutcomeStrategyType)1 AccessCertificationResponseType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationResponseType)1 List (java.util.List)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxCheckBox (org.apache.wicket.ajax.markup.html.form.AjaxCheckBox)1 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)1 Label (org.apache.wicket.markup.html.basic.Label)1 PropertyModel (org.apache.wicket.model.PropertyModel)1