Search in sources :

Example 1 with PageResourceWizard

use of com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard in project midpoint by Evolveum.

the class PageBase method createFocusPageNewEditMenu.

private void createFocusPageNewEditMenu(List<MenuItem> submenu, String newKey, String editKey, final Class<? extends PageAdmin> newPageClass, boolean checkAuthorization) {
    MenuItem edit = new MenuItem(createStringResource(editKey), newPageClass, null, new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isEnabled() {
            return false;
        }

        @Override
        public boolean isVisible() {
            if (!getPage().getClass().equals(newPageClass)) {
                return false;
            }
            if (getPage() instanceof PageAdminFocus) {
                PageAdminFocus page = (PageAdminFocus) getPage();
                return page.isEditingFocus();
            } else if (getPage() instanceof PageResourceWizard) {
                PageResourceWizard page = (PageResourceWizard) getPage();
                return !page.isNewResource();
            } else {
                return false;
            }
        }
    });
    submenu.add(edit);
    MenuItem newMenu = new MenuItem(createStringResource(newKey), newPageClass, null, new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !checkAuthorization || isMenuItemAuthorized(newPageClass);
        }
    }) {

        private static final long serialVersionUID = 1L;

        @Override
        protected boolean isMenuActive() {
            if (!PageBase.this.getPage().getClass().equals(newPageClass)) {
                return false;
            }
            if (PageBase.this.getPage() instanceof PageAdminFocus) {
                PageAdminFocus page = (PageAdminFocus) PageBase.this.getPage();
                return !page.isEditingFocus();
            } else if (PageBase.this.getPage() instanceof PageResourceWizard) {
                PageResourceWizard page = (PageResourceWizard) PageBase.this.getPage();
                return page.isNewResource();
            } else {
                return false;
            }
        }
    };
    submenu.add(newMenu);
}
Also used : PageAdminFocus(com.evolveum.midpoint.web.page.admin.PageAdminFocus) PageResourceWizard(com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 2 with PageResourceWizard

use of com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard in project midpoint by Evolveum.

the class ResourceOperationalButtonsPanel method startWizard.

private void startWizard(boolean configOnly, boolean readOnly) {
    PageParameters parameters = new PageParameters();
    // compatibility with PageAdminResources
    parameters.add(OnePageParameterEncoder.PARAMETER, getPrismObject().getOid());
    parameters.add(PageResourceWizard.PARAM_CONFIG_ONLY, configOnly);
    parameters.add(PageResourceWizard.PARAM_READ_ONLY, readOnly);
    getPageBase().navigateToNext(new PageResourceWizard(parameters));
}
Also used : PageResourceWizard(com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters)

Example 3 with PageResourceWizard

use of com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard in project midpoint by Evolveum.

the class ExpressionEditorPanel method initLayout.

protected void initLayout(PageBase parentPage) {
    setOutputMarkupId(true);
    loadDtoModel();
    Label descriptionLabel = new Label(ID_LABEL_DESCRIPTION, createStringResource(getDescriptionLabelKey()));
    add(descriptionLabel);
    TextArea<?> description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(dtoModel, ExpressionTypeDto.F_DESCRIPTION));
    description.setOutputMarkupId(true);
    // parentPage.addEditingEnabledBehavior(description);
    add(description);
    Label typeLabel = new Label(ID_LABEL_TYPE, createStringResource(getTypeLabelKey()));
    add(typeLabel);
    DropDownChoice<?> type = new DropDownChoice<>(ID_TYPE, new PropertyModel<>(dtoModel, ExpressionTypeDto.F_TYPE), WebComponentUtil.createReadonlyModelFromEnum(ExpressionUtil.ExpressionEvaluatorType.class), new EnumChoiceRenderer<>(this));
    // parentPage.addEditingEnabledBehavior(type);
    type.add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            dtoModel.getObject().updateExpressionType();
            // target.add(get(ID_LANGUAGE_CONTAINER), get(ID_POLICY_CONTAINER), get(ID_EXPRESSION));
            // because of ACE editor
            target.add(ExpressionEditorPanel.this);
        }
    });
    type.setOutputMarkupId(true);
    type.setOutputMarkupPlaceholderTag(true);
    type.setNullValid(true);
    add(type);
    WebMarkupContainer languageContainer = new WebMarkupContainer(ID_LANGUAGE_CONTAINER);
    languageContainer.setOutputMarkupId(true);
    languageContainer.setOutputMarkupPlaceholderTag(true);
    languageContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return ExpressionUtil.ExpressionEvaluatorType.SCRIPT.equals(dtoModel.getObject().getType());
        }
    });
    // parentPage.addEditingEnabledBehavior(languageContainer);
    add(languageContainer);
    DropDownChoice<?> language = new DropDownChoice<>(ID_LANGUAGE, new PropertyModel<>(dtoModel, ExpressionTypeDto.F_LANGUAGE), WebComponentUtil.createReadonlyModelFromEnum(ExpressionUtil.Language.class), new EnumChoiceRenderer<>(this));
    // parentPage.addEditingEnabledBehavior(language);
    language.add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            dtoModel.getObject().updateExpressionLanguage();
            // target.add(get(ID_LANGUAGE_CONTAINER), get(ID_POLICY_CONTAINER), get(ID_EXPRESSION));
            // because of ACE editor
            target.add(ExpressionEditorPanel.this);
        }
    });
    language.setNullValid(false);
    languageContainer.add(language);
    WebMarkupContainer policyContainer = new WebMarkupContainer(ID_POLICY_CONTAINER);
    policyContainer.setOutputMarkupId(true);
    policyContainer.setOutputMarkupPlaceholderTag(true);
    policyContainer.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return ExpressionUtil.ExpressionEvaluatorType.GENERATE.equals(dtoModel.getObject().getType());
        }
    });
    add(policyContainer);
    DropDownChoice<?> policyRef = new DropDownChoice<>(ID_POLICY_REF, new PropertyModel<>(dtoModel, ExpressionTypeDto.F_POLICY_REF), (IModel<List<ObjectReferenceType>>) () -> WebModelServiceUtils.createObjectReferenceList(ValuePolicyType.class, getPageBase(), policyMap), new ObjectReferenceChoiceRenderer(policyMap));
    policyRef.add(new AjaxFormComponentUpdatingBehavior("change") {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            dtoModel.getObject().updateExpressionValuePolicyRef();
            target.add(get(ID_LANGUAGE_CONTAINER), get(ID_POLICY_CONTAINER), get(ID_EXPRESSION));
        }
    });
    policyRef.setNullValid(true);
    policyContainer.add(policyRef);
    Label expressionLabel = new Label(ID_LABEL_EXPRESSION, createStringResource(getExpressionLabelKey()));
    add(expressionLabel);
    AceEditor expression = new AceEditor(ID_EXPRESSION, new PropertyModel<>(dtoModel, ExpressionTypeDto.F_EXPRESSION));
    expression.setOutputMarkupId(true);
    // parentPage.addEditingEnabledBehavior(expression);
    add(expression);
    AjaxSubmitLink update = new AjaxSubmitLink(ID_BUTTON_UPDATE) {

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            updateExpressionPerformed(target);
        }
    };
    Label updateLabel = new Label(ID_LABEL_UPDATE, createStringResource(getUpdateLabelKey()));
    updateLabel.setRenderBodyOnly(true);
    update.add(updateLabel);
    if (parentPage instanceof PageResourceWizard) {
        ((PageResourceWizard) parentPage).addEditingEnabledBehavior(this);
        ((PageResourceWizard) parentPage).addEditingVisibleBehavior(update);
    }
    add(update);
    add(WebComponentUtil.createHelp(ID_T_TYPE));
    languageContainer.add(WebComponentUtil.createHelp(ID_T_LANGUAGE));
    policyContainer.add(WebComponentUtil.createHelp(ID_T_POLICY));
    add(WebComponentUtil.createHelp(ID_T_EXPRESSION));
}
Also used : AjaxFormComponentUpdatingBehavior(org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior) TextArea(org.apache.wicket.markup.html.form.TextArea) Label(org.apache.wicket.markup.html.basic.Label) AceEditor(com.evolveum.midpoint.web.component.AceEditor) AjaxSubmitLink(org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) PageResourceWizard(com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 4 with PageResourceWizard

use of com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard in project midpoint by Evolveum.

the class SynchronizationReactionEditor method initLayout.

protected void initLayout(PageResourceWizard parentPage) {
    Label label = new Label(ID_LABEL, new ResourceModel("SynchronizationReactionEditor.label.edit"));
    add(label);
    TextField name = new TextField<>(ID_NAME, new PropertyModel<String>(getModel(), "name"));
    name.add(new ReactionListUpdateBehavior());
    parentPage.addEditingEnabledBehavior(name);
    add(name);
    TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description"));
    parentPage.addEditingEnabledBehavior(description);
    add(description);
    DropDownChoice situation = new DropDownChoice<>(ID_SITUATION, new PropertyModel<>(getModel(), "situation"), WebComponentUtil.createReadonlyModelFromEnum(SynchronizationSituationType.class), new EnumChoiceRenderer<>(this));
    situation.setNullValid(true);
    situation.add(new ReactionListUpdateBehavior());
    parentPage.addEditingEnabledBehavior(situation);
    situation.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }
    });
    add(situation);
    MultiValueDropDownPanel channel = new MultiValueDropDownPanel<String>(ID_CHANNEL, new PropertyModel<>(getModel(), "channel"), true, parentPage.getReadOnlyModel()) {

        @Override
        protected String createNewEmptyItem() {
            return "";
        }

        @Override
        protected IModel<List<String>> createChoiceList() {
            return new IModel<List<String>>() {

                @Override
                public List<String> getObject() {
                    return WebComponentUtil.getChannelList();
                }
            };
        }

        @Override
        protected IChoiceRenderer<String> createRenderer() {
            return CHANNEL_RENDERER;
        }
    };
    add(channel);
    TriStateComboPanel synchronize = new TriStateComboPanel(ID_SYNCHRONIZE, new PropertyModel<>(getModel(), "synchronize"));
    synchronize.getBaseFormComponent().add(new ReactionListUpdateBehavior());
    parentPage.addEditingEnabledBehavior(synchronize);
    add(synchronize);
    CheckBox reconcile = new CheckBox(ID_RECONCILE, new PropertyModel<>(getModel(), "reconcile"));
    parentPage.addEditingEnabledBehavior(reconcile);
    add(reconcile);
    DropDownChoice objectTemplateRef = new DropDownChoice<>(ID_OBJECT_TEMPLATE_REF, new PropertyModel<>(getModel(), "objectTemplateRef"), new IModel<List<ObjectReferenceType>>() {

        @Override
        public List<ObjectReferenceType> getObject() {
            return WebModelServiceUtils.createObjectReferenceList(ObjectTemplateType.class, getPageBase(), objectTemplateMap);
        }
    }, new ObjectReferenceChoiceRenderer(objectTemplateMap));
    objectTemplateRef.setNullValid(true);
    parentPage.addEditingEnabledBehavior(objectTemplateRef);
    add(objectTemplateRef);
    MultiValueTextEditPanel action = new MultiValueTextEditPanel<SynchronizationActionType>(ID_ACTION, new PropertyModel<>(getModel(), "action"), null, false, true, parentPage.getReadOnlyModel()) {

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

                @Override
                public String getObject() {
                    SynchronizationActionType action = model.getObject();
                    if (action == null) {
                        return null;
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.append(action.getName() != null ? action.getName() : "-");
                    if (action.getHandlerUri() != null) {
                        sb.append(" (").append(StringUtils.substringAfter(action.getHandlerUri(), "#")).append(")");
                    }
                    return sb.toString();
                }
            };
        }

        @Override
        protected void performAddValueHook(AjaxRequestTarget target, SynchronizationActionType added) {
            target.add(parentStep.getReactionList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }

        @Override
        protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<SynchronizationActionType> item) {
            target.add(parentStep.getReactionList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }

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

        @Override
        protected void editPerformed(AjaxRequestTarget target, SynchronizationActionType object) {
            actionEditPerformed(target, object);
        }
    };
    action.setOutputMarkupId(true);
    add(action);
    Label situationTooltip = new Label(ID_T_SITUATION);
    situationTooltip.add(new InfoTooltipBehavior());
    add(situationTooltip);
    Label channelTooltip = new Label(ID_T_CHANNEL);
    channelTooltip.add(new InfoTooltipBehavior());
    add(channelTooltip);
    Label synchronizeTooltip = new Label(ID_T_SYNCHRONIZE);
    synchronizeTooltip.add(new InfoTooltipBehavior());
    add(synchronizeTooltip);
    Label reconcileTooltip = new Label(ID_T_RECONCILE);
    reconcileTooltip.add(new InfoTooltipBehavior());
    add(reconcileTooltip);
    Label objTemplateTooltip = new Label(ID_T_OBJ_TEMPLATE);
    objTemplateTooltip.add(new InfoTooltipBehavior());
    add(objTemplateTooltip);
    Label actionTooltip = new Label(ID_T_ACTION);
    actionTooltip.add(new InfoTooltipBehavior());
    add(actionTooltip);
    initModals();
}
Also used : ObjectReferenceChoiceRenderer(com.evolveum.midpoint.web.component.input.ObjectReferenceChoiceRenderer) TriStateComboPanel(com.evolveum.midpoint.web.component.input.TriStateComboPanel) Label(org.apache.wicket.markup.html.basic.Label) MultiValueTextEditPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) MultiValueDropDownPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueDropDownPanel) ArrayList(java.util.ArrayList) List(java.util.List) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) PageResourceWizard(com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 5 with PageResourceWizard

use of com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard in project midpoint by Evolveum.

the class ResourceAssociationEditor method initLayout.

protected void initLayout(NonEmptyModel<Boolean> readOnlyModel) {
    Label label = new Label(ID_LABEL, new ResourceModel("ResourceAssociationEditor.label.edit"));
    label.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(label);
    DropDownChoice kind = new DropDownChoice<>(ID_KIND, new PropertyModel<>(getModel(), "kind"), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<>(this));
    kind.setNullValid(false);
    kind.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(kind);
    MultiValueTextPanel intent = new MultiValueTextPanel<>(ID_INTENT, new PropertyModel<List<String>>(getModel(), "intent"), readOnlyModel, true);
    intent.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(intent);
    DropDownChoice direction = new DropDownChoice<>(ID_DIRECTION, new PropertyModel<>(getModel(), "direction"), WebComponentUtil.createReadonlyModelFromEnum(ResourceObjectAssociationDirectionType.class), new EnumChoiceRenderer<>(this));
    direction.setNullValid(true);
    direction.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(direction);
    DropDownChoice associationAttribute = new DropDownChoice<>(ID_ASSOCIATION_ATTRIBUTE, new PropertyModel<>(getModel(), "associationAttribute"), new IModel<List<QName>>() {

        @Override
        public List<QName> getObject() {
            return loadObjectReferences(false);
        }
    }, new QNameChoiceRenderer(true));
    associationAttribute.setNullValid(true);
    associationAttribute.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(associationAttribute);
    DropDownChoice valueAttribute = new DropDownChoice<>(ID_VALUE_ATTRIBUTE, new PropertyModel<>(getModel(), "valueAttribute"), new IModel<List<QName>>() {

        @Override
        public List<QName> getObject() {
            return loadObjectReferences(false);
        }
    }, new QNameChoiceRenderer(true));
    valueAttribute.setNullValid(true);
    valueAttribute.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(valueAttribute);
    CheckBox explicitRefIntegrity = new CheckBox(ID_EXPLICIT_REF_INTEGRITY, new PropertyModel<>(getModel(), "explicitReferentialIntegrity"));
    explicitRefIntegrity.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(explicitRefIntegrity);
    QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_ASSOCIATION_ATTRIBUTE_PANEL, new PropertyModel<>(getModel(), "ref"), "SchemaHandlingStep.association.tooltip.associationLocalPart", "SchemaHandlingStep.association.tooltip.associationNamespace", true, true) {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(parentStep.getAssociationList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }
    };
    nonSchemaRefPanel.setOutputMarkupId(true);
    nonSchemaRefPanel.setOutputMarkupPlaceholderTag(true);
    nonSchemaRefPanel.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(nonSchemaRefPanel);
    TextField displayName = new TextField<>(ID_DISPLAY_NAME, new PropertyModel<String>(getModel(), "displayName"));
    displayName.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(parentStep.getAssociationList());
        }
    });
    displayName.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(displayName);
    TextArea description = new TextArea<>(ID_DESCRIPTION, new PropertyModel<String>(getModel(), "description"));
    description.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(description);
    AjaxLink<Void> limitations = new AjaxLink<Void>(ID_BUTTON_LIMITATIONS) {

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            limitationsEditPerformed(target);
        }
    };
    add(limitations);
    CheckBox exclusiveStrong = new CheckBox(ID_EXCLUSIVE_STRONG, new PropertyModel<>(getModel(), "exclusiveStrong"));
    exclusiveStrong.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(exclusiveStrong);
    CheckBox tolerant = new CheckBox(ID_TOLERANT, new PropertyModel<>(getModel(), "tolerant"));
    tolerant.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(tolerant);
    MultiValueTextPanel tolerantVP = new MultiValueTextPanel<>(ID_TOLERANT_VP, new PropertyModel<List<String>>(getModel(), "tolerantValuePattern"), readOnlyModel, true);
    tolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(tolerantVP);
    MultiValueTextPanel intolerantVP = new MultiValueTextPanel<>(ID_INTOLERANT_VP, new PropertyModel<List<String>>(getModel(), "intolerantValuePattern"), readOnlyModel, true);
    intolerantVP.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(intolerantVP);
    DropDownChoice fetchStrategy = new DropDownChoice<>(ID_FETCH_STRATEGY, new PropertyModel<>(getModel(), "fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<>(this));
    fetchStrategy.setNullValid(true);
    fetchStrategy.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(fetchStrategy);
    AttributeEditorUtils.addMatchingRuleFields(this, readOnlyModel);
    VisibleEnableBehaviour showIfEditingOrOutboundExists = AttributeEditorUtils.createShowIfEditingOrOutboundExists(getModel(), readOnlyModel);
    TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, new IModel<String>() {

        @Override
        public String getObject() {
            ResourceObjectAssociationType association = getModel().getObject();
            if (association == null) {
                return null;
            }
            return MappingTypeDto.createMappingLabel(association.getOutbound(), LOGGER, getPageBase().getPrismContext(), getString("MappingType.label.placeholder"), getString("MultiValueField.nameNotSpecified"));
        }
    });
    outboundLabel.setOutputMarkupId(true);
    outboundLabel.setEnabled(false);
    outboundLabel.add(showIfEditingOrOutboundExists);
    add(outboundLabel);
    AjaxSubmitButton outbound = new AjaxSubmitButton(ID_BUTTON_OUTBOUND) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            outboundEditPerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(parentStep.getPageBase().getFeedbackPanel());
        }
    };
    outbound.setOutputMarkupId(true);
    outbound.add(showIfEditingOrOutboundExists);
    add(outbound);
    AjaxSubmitLink deleteOutbound = new AjaxSubmitLink(ID_DELETE_OUTBOUND) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target) {
            deleteOutboundPerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target) {
            target.add(parentStep.getPageBase().getFeedbackPanel());
        }
    };
    deleteOutbound.setOutputMarkupId(true);
    deleteOutbound.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
    add(deleteOutbound);
    MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<>(getModel(), "inbound"), null, false, true, readOnlyModel) {

        @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 performAddValueHook(AjaxRequestTarget target, MappingType added) {
            target.add(parentStep.getAssociationList());
            // because of marking duplicates
            target.add(parentStep.getAttributeList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }

        @Override
        protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<MappingType> item) {
            target.add(parentStep.getAssociationList());
            // because of marking duplicates
            target.add(parentStep.getAttributeList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }

        @Override
        protected void editPerformed(AjaxRequestTarget target, MappingType object) {
            inboundEditPerformed(target, object);
        }
    };
    inbound.setOutputMarkupId(true);
    add(inbound);
    Label kindTooltip = new Label(ID_T_KIND);
    kindTooltip.add(new InfoTooltipBehavior());
    add(kindTooltip);
    Label intentTooltip = new Label(ID_T_INTENT);
    intentTooltip.add(new InfoTooltipBehavior());
    add(intentTooltip);
    Label directionTooltip = new Label(ID_T_DIRECTION);
    directionTooltip.add(new InfoTooltipBehavior());
    add(directionTooltip);
    Label assAttributeTooltip = new Label(ID_T_ASSOCIATION_ATTRIBUTE);
    assAttributeTooltip.add(new InfoTooltipBehavior());
    add(assAttributeTooltip);
    Label valueAttributeTooltip = new Label(ID_T_VALUE_ATTRIBUTE);
    valueAttributeTooltip.add(new InfoTooltipBehavior());
    add(valueAttributeTooltip);
    Label integrityTooltip = new Label(ID_T_EXPLICIT_REF_INTEGRITY);
    integrityTooltip.add(new InfoTooltipBehavior());
    add(integrityTooltip);
    Label limitationsTooltip = new Label(ID_T_LIMITATIONS);
    limitationsTooltip.add(new InfoTooltipBehavior());
    add(limitationsTooltip);
    Label exclusiveStrongTooltip = new Label(ID_T_EXCLUSIVE_STRONG);
    exclusiveStrongTooltip.add(new InfoTooltipBehavior());
    add(exclusiveStrongTooltip);
    Label tolerantTooltip = new Label(ID_T_TOLERANT);
    tolerantTooltip.add(new InfoTooltipBehavior());
    add(tolerantTooltip);
    Label tolerantVPTooltip = new Label(ID_T_TOLERANT_VP);
    tolerantVPTooltip.add(new InfoTooltipBehavior());
    add(tolerantVPTooltip);
    Label intolerantVPTooltip = new Label(ID_T_INTOLERANT_VP);
    intolerantVPTooltip.add(new InfoTooltipBehavior());
    add(intolerantVPTooltip);
    Label fetchTooltip = new Label(ID_T_FETCH);
    fetchTooltip.add(new InfoTooltipBehavior());
    add(fetchTooltip);
    Label matchingRuleTooltip = new Label(ID_T_MATCHING_RULE);
    matchingRuleTooltip.add(new InfoTooltipBehavior());
    add(matchingRuleTooltip);
    Label outboundTooltip = new Label(ID_T_OUTBOUND);
    outboundTooltip.add(new InfoTooltipBehavior());
    add(outboundTooltip);
    Label inboundTooltip = new Label(ID_T_INBOUND);
    inboundTooltip.add(new InfoTooltipBehavior());
    add(inboundTooltip);
    initModals(readOnlyModel);
}
Also used : 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) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) ArrayList(java.util.ArrayList) List(java.util.List) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) AjaxLink(org.apache.wicket.ajax.markup.html.AjaxLink) MultiValueTextPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel) QNameChoiceRenderer(com.evolveum.midpoint.web.component.input.QNameChoiceRenderer) AjaxSubmitButton(com.evolveum.midpoint.web.component.AjaxSubmitButton) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) QNameEditorPanel(com.evolveum.midpoint.web.component.input.QNameEditorPanel) NonEmptyModel(com.evolveum.midpoint.gui.api.model.NonEmptyModel) PageResourceWizard(com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard) ListItem(org.apache.wicket.markup.html.list.ListItem)

Aggregations

PageResourceWizard (com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard)8 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)6 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)6 List (java.util.List)5 Label (org.apache.wicket.markup.html.basic.Label)5 ArrayList (java.util.ArrayList)4 AjaxSubmitLink (org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink)4 ListItem (org.apache.wicket.markup.html.list.ListItem)4 MultiValueTextEditPanel (com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel)3 EmptyOnChangeAjaxFormUpdatingBehavior (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior)3 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)3 AjaxLink (org.apache.wicket.ajax.markup.html.AjaxLink)3 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)3 NonEmptyModel (com.evolveum.midpoint.gui.api.model.NonEmptyModel)2 MultiValueTextPanel (com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel)2 IModel (org.apache.wicket.model.IModel)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 AceEditor (com.evolveum.midpoint.web.component.AceEditor)1 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1