Search in sources :

Example 6 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox 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 7 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class FocusProjectionsTabPanel method initLayout.

private void initLayout(final PageBase page) {
    final WebMarkupContainer shadows = new WebMarkupContainer(ID_SHADOWS);
    shadows.setOutputMarkupId(true);
    add(shadows);
    InlineMenu accountMenu = new InlineMenu(ID_SHADOW_MENU, new Model((Serializable) createShadowMenu()));
    accountMenu.setVisible(!getObjectWrapper().isReadonly());
    shadows.add(accountMenu);
    final ListView<FocusSubwrapperDto<ShadowType>> projectionList = new ListView<FocusSubwrapperDto<ShadowType>>(ID_SHADOW_LIST, projectionModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(final ListItem<FocusSubwrapperDto<ShadowType>> item) {
            PackageResourceReference packageRef;
            final FocusSubwrapperDto<ShadowType> dto = item.getModelObject();
            final PropertyModel<ObjectWrapper<F>> objectWrapperModel = new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object");
            final Panel shadowPanel;
            if (dto.isLoadedOK()) {
                packageRef = new PackageResourceReference(ImgResources.class, ImgResources.HDD_PRISM);
                shadowPanel = new PrismObjectPanel<F>(ID_SHADOW, new PropertyModel<ObjectWrapper<F>>(item.getModel(), "object"), packageRef, getMainForm(), getPageBase());
            } else {
                shadowPanel = new SimpleErrorPanel<ShadowType>(ID_SHADOW, item.getModel()) {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onShowMorePerformed(AjaxRequestTarget target) {
                        OperationResult fetchResult = dto.getResult();
                        if (fetchResult != null) {
                            showResult(fetchResult);
                            target.add(page.getFeedbackPanel());
                        }
                    }
                };
            }
            shadowPanel.setOutputMarkupId(true);
            shadowPanel.add(new VisibleEnableBehaviour() {

                private static final long serialVersionUID = 1L;

                @Override
                public boolean isVisible() {
                    FocusSubwrapperDto<ShadowType> shadowWrapperDto = item.getModelObject();
                    ObjectWrapper<ShadowType> shadowWrapper = shadowWrapperDto.getObject();
                    return !shadowWrapper.isMinimalized();
                }
            });
            item.add(shadowPanel);
            CheckTableHeader<F> shadowHeader = new CheckTableHeader<F>(ID_SHADOW_HEADER, objectWrapperModel) {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onClickPerformed(AjaxRequestTarget target) {
                    super.onClickPerformed(target);
                    onExpandCollapse(target, item.getModel());
                    target.add(shadows);
                }
            };
            if (item.getModel().getObject().getStatus().equals(UserDtoStatus.DELETE)) {
                shadowHeader.add(new AttributeModifier("class", "box-header with-border delete"));
            }
            item.add(shadowHeader);
        }
    };
    AjaxCheckBox accountCheckAll = new AjaxCheckBox(ID_SHADOW_CHECK_ALL, new Model()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            for (FocusSubwrapperDto<ShadowType> dto : projectionList.getModelObject()) {
                if (dto.isLoadedOK()) {
                    ObjectWrapper<ShadowType> accModel = dto.getObject();
                    accModel.setSelected(getModelObject());
                }
            }
            target.add(shadows);
        }
    };
    shadows.add(accountCheckAll);
    shadows.add(projectionList);
}
Also used : Serializable(java.io.Serializable) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ImgResources(com.evolveum.midpoint.web.resource.img.ImgResources) ListView(org.apache.wicket.markup.html.list.ListView) FocusSubwrapperDto(com.evolveum.midpoint.web.page.admin.users.dto.FocusSubwrapperDto) PackageResourceReference(org.apache.wicket.request.resource.PackageResourceReference) InlineMenu(com.evolveum.midpoint.web.component.menu.cog.InlineMenu) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) AttributeModifier(org.apache.wicket.AttributeModifier) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfirmationPanel) Panel(org.apache.wicket.markup.html.panel.Panel) ObjectBrowserPanel(com.evolveum.midpoint.gui.api.component.ObjectBrowserPanel) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 8 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class PageDebugView method initLayout.

private void initLayout() {
    add(mainForm);
    mainForm.add(new AjaxCheckBox("encrypt", encrypt) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });
    mainForm.add(new AjaxCheckBox("saveAsRaw", saveAsRaw) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });
    mainForm.add(new AjaxCheckBox("reevaluateSearchFilters", reevaluateSearchFilters) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });
    mainForm.add(new AjaxCheckBox("validateSchema", validateSchema) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
        }
    });
    mainForm.add(new AjaxCheckBox("switchToPlainText", switchToPlainText) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (switchToPlainText.getObject()) {
                editor.setVisible(false);
                plainTextarea.setVisible(true);
            } else {
                editor.setVisible(true);
                plainTextarea.setVisible(false);
            }
            target.add(mainForm);
        }
    });
    plainTextarea = new TextArea<>(ID_PLAIN_TEXTAREA, new PropertyModel<String>(model, ObjectViewDto.F_XML));
    plainTextarea.setVisible(false);
    mainForm.add(plainTextarea);
    addOrReplaceEditor();
    initButtons(mainForm);
    initViewButton(mainForm);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) PropertyModel(org.apache.wicket.model.PropertyModel) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox)

Example 9 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class PageDebugList method hasToZip.

private boolean hasToZip() {
    BoxedTablePanel table = (BoxedTablePanel) getListTable();
    SearchFragment header = (SearchFragment) table.getHeader();
    AjaxCheckBox zipCheck = header.getZipCheck();
    return zipCheck.getModelObject();
}
Also used : AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel)

Example 10 with AjaxCheckBox

use of org.apache.wicket.ajax.markup.html.form.AjaxCheckBox in project midpoint by Evolveum.

the class PageTaskAdd method initScheduling.

private void initScheduling(final Form mainForm) {
    final WebMarkupContainer container = new WebMarkupContainer(ID_CONTAINER);
    container.setOutputMarkupId(true);
    mainForm.add(container);
    final IModel<Boolean> recurringCheck = new PropertyModel<>(model, TaskAddDto.F_RECURRING);
    final IModel<Boolean> boundCheck = new PropertyModel<>(model, TaskAddDto.F_BOUND);
    final WebMarkupContainer boundContainer = new WebMarkupContainer(ID_BOUND_CONTAINER);
    boundContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return recurringCheck.getObject();
        }
    });
    boundContainer.setOutputMarkupId(true);
    container.add(boundContainer);
    final WebMarkupContainer intervalContainer = new WebMarkupContainer(ID_INTERVAL_CONTAINER);
    intervalContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return recurringCheck.getObject();
        }
    });
    intervalContainer.setOutputMarkupId(true);
    container.add(intervalContainer);
    final WebMarkupContainer cronContainer = new WebMarkupContainer(ID_CRON_CONTAINER);
    cronContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return recurringCheck.getObject() && !boundCheck.getObject();
        }
    });
    cronContainer.setOutputMarkupId(true);
    container.add(cronContainer);
    AjaxCheckBox recurring = new AjaxCheckBox(ID_RECURRING, recurringCheck) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(container);
        }
    };
    mainForm.add(recurring);
    AjaxCheckBox bound = new AjaxCheckBox(ID_BOUND, boundCheck) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(container);
        }
    };
    boundContainer.add(bound);
    Label boundHelp = new Label(ID_BOUND_HELP);
    boundHelp.add(new InfoTooltipBehavior());
    boundContainer.add(boundHelp);
    TextField<Integer> interval = new TextField<>(ID_INTERVAL, new PropertyModel<Integer>(model, TaskAddDto.F_INTERVAL));
    interval.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    intervalContainer.add(interval);
    TextField<String> cron = new TextField<>(ID_CRON, new PropertyModel<String>(model, TaskAddDto.F_CRON));
    cron.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
    //		if (recurringCheck.getObject() && !boundCheck.getObject()) {
    //			cron.setRequired(true);
    //		}
    cronContainer.add(cron);
    Label cronHelp = new Label(ID_CRON_HELP);
    cronHelp.add(new InfoTooltipBehavior());
    cronContainer.add(cronHelp);
    final DateTimeField notStartBefore = new DateTimeField(ID_NO_START_BEFORE_FIELD, new PropertyModel<Date>(model, TaskAddDto.F_NOT_START_BEFORE)) {

        @Override
        protected DateTextField newDateTextField(String id, PropertyModel dateFieldModel) {
            // todo i18n
            return DateTextField.forDatePattern(id, dateFieldModel, "dd/MMM/yyyy");
        }
    };
    notStartBefore.setOutputMarkupId(true);
    mainForm.add(notStartBefore);
    final DateTimeField notStartAfter = new DateTimeField(ID_NO_START_AFTER_FIELD, new PropertyModel<Date>(model, TaskAddDto.F_NOT_START_AFTER)) {

        @Override
        protected DateTextField newDateTextField(String id, PropertyModel dateFieldModel) {
            // todo i18n
            return DateTextField.forDatePattern(id, dateFieldModel, "dd/MMM/yyyy");
        }
    };
    notStartAfter.setOutputMarkupId(true);
    mainForm.add(notStartAfter);
    mainForm.add(new StartEndDateValidator(notStartBefore, notStartAfter));
    mainForm.add(new ScheduleValidator(getTaskManager(), recurring, bound, interval, cron));
}
Also used : StartEndDateValidator(com.evolveum.midpoint.web.page.admin.server.dto.StartEndDateValidator) ScheduleValidator(com.evolveum.midpoint.web.page.admin.server.dto.ScheduleValidator) PropertyModel(org.apache.wicket.model.PropertyModel) Label(org.apache.wicket.markup.html.basic.Label) AjaxCheckBox(org.apache.wicket.ajax.markup.html.form.AjaxCheckBox) DateTimeField(org.apache.wicket.extensions.yui.calendar.DateTimeField) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Date(java.util.Date) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) TextField(org.apache.wicket.markup.html.form.TextField) AutoCompleteTextField(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField) DateTextField(org.apache.wicket.datetime.markup.html.form.DateTextField) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Aggregations

AjaxCheckBox (org.apache.wicket.ajax.markup.html.form.AjaxCheckBox)14 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)13 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)10 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)8 Label (org.apache.wicket.markup.html.basic.Label)8 PropertyModel (org.apache.wicket.model.PropertyModel)5 ToggleIconButton (com.evolveum.midpoint.gui.api.component.togglebutton.ToggleIconButton)3 List (java.util.List)3 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)3 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 DateInput (com.evolveum.midpoint.web.component.DateInput)2 InlineMenu (com.evolveum.midpoint.web.component.menu.cog.InlineMenu)2 EmptyOnBlurAjaxFormUpdatingBehaviour (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour)2 ScheduleValidator (com.evolveum.midpoint.web.page.admin.server.dto.ScheduleValidator)2 StartEndDateValidator (com.evolveum.midpoint.web.page.admin.server.dto.StartEndDateValidator)2 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)2 Serializable (java.io.Serializable)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2