Search in sources :

Example 6 with MultiValueTextEditPanel

use of com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel in project midpoint by Evolveum.

the class ResourceAttributeEditor method initLayout.

protected void initLayout(final NonEmptyModel<Boolean> readOnlyModel) {
    Label label = new Label(ID_LABEL, new ResourceModel("ResourceAttributeEditor.label.edit"));
    label.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(label);
    /*
		TEMPORARILY DISABLED

        QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_NON_SCHEMA_REF_PANEL, new PropertyModel<ItemPathType>(getModel(), "ref"),
                "SchemaHandlingStep.attribute.label.attributeName", "SchemaHandlingStep.attribute.tooltip.attributeLocalPart",
                "SchemaHandlingStep.attribute.label.attributeNamespace", "SchemaHandlingStep.attribute.tooltip.attributeNamespace", true, true) {
			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				target.add(parentStep.getAttributeList());
			}
		};

        nonSchemaRefPanel.setOutputMarkupId(true);
        nonSchemaRefPanel.setOutputMarkupPlaceholderTag(true);
        nonSchemaRefPanel.add(new VisibleEnableBehaviour(){

            @Override
            public boolean isVisible() {
                return nonSchemaRefValueAllowed;
            }
        });
        add(nonSchemaRefPanel);
*/
    WebMarkupContainer schemaRefPanel = new WebMarkupContainer(ID_SCHEMA_REF_PANEL);
    schemaRefPanel.setOutputMarkupId(true);
    schemaRefPanel.setOutputMarkupPlaceholderTag(true);
    schemaRefPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return !nonSchemaRefValueAllowed;
        }

        @Override
        public boolean isEnabled() {
            return !readOnlyModel.getObject();
        }
    });
    add(schemaRefPanel);
    Label refTooltip = new Label(ID_T_REF);
    refTooltip.add(new InfoTooltipBehavior());
    refTooltip.setOutputMarkupId(true);
    refTooltip.setOutputMarkupId(true);
    schemaRefPanel.add(refTooltip);
    DropDownChoice refSelect = new DropDownChoice<ItemPathType>(ID_REFERENCE_SELECT, new PropertyModel<ItemPathType>(getModel(), "ref"), new AbstractReadOnlyModel<List<ItemPathType>>() {

        @Override
        public List<ItemPathType> getObject() {
            return loadObjectReferences();
        }
    }, new IChoiceRenderer<ItemPathType>() {

        @Override
        public ItemPathType getObject(String id, IModel<? extends List<? extends ItemPathType>> choices) {
            return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null;
        }

        @Override
        public Object getDisplayValue(ItemPathType object) {
            return prepareReferenceDisplayValue(object);
        }

        @Override
        public String getIdValue(ItemPathType object, int index) {
            return Integer.toString(index);
        }
    }) {

        @Override
        protected boolean isSelected(ItemPathType object, int index, String selected) {
            if (getModelObject() == null || getModelObject().equals(new ItemPathType())) {
                return false;
            }
            QName referenceQName = ItemPathUtil.getOnlySegmentQNameRobust(getModelObject());
            QName optionQName = ItemPathUtil.getOnlySegmentQNameRobust(object);
            return ObjectUtils.equals(referenceQName, optionQName);
        }
    };
    refSelect.setNullValid(false);
    refSelect.setOutputMarkupId(true);
    refSelect.setOutputMarkupPlaceholderTag(true);
    refSelect.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            target.add(parentStep.getAttributeList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }
    });
    refSelect.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    schemaRefPanel.add(refSelect);
    /*
		TEMPORARILY DISABLED

        CheckBox allowNonSchema = new CheckBox(ID_REFERENCE_ALLOW, new PropertyModel<Boolean>(this, "nonSchemaRefValueAllowed"));
        allowNonSchema.add(new AjaxFormComponentUpdatingBehavior("change") {

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                target.add(get(ID_NON_SCHEMA_REF_PANEL), get(ID_SCHEMA_REF_PANEL));
            }
        });
        add(allowNonSchema);
*/
    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.getAttributeList());
        }
    });
    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 limitations = new AjaxLink(ID_BUTTON_LIMITATIONS) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            limitationsEditPerformed(target);
        }
    };
    add(limitations);
    CheckBox exclusiveStrong = new CheckBox(ID_EXCLUSIVE_STRONG, new PropertyModel<Boolean>(getModel(), "exclusiveStrong"));
    exclusiveStrong.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(exclusiveStrong);
    CheckBox tolerant = new CheckBox(ID_TOLERANT, new PropertyModel<Boolean>(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<AttributeFetchStrategyType>(getModel(), "fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<AttributeFetchStrategyType>(this));
    fetchStrategy.setNullValid(true);
    fetchStrategy.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(fetchStrategy);
    AttributeEditorUtils.addMatchingRuleFields(this, readOnlyModel);
    TextField outboundLabel = new TextField<>(ID_OUTBOUND_LABEL, new AbstractReadOnlyModel<String>() {

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

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            outboundEditPerformed(target);
        }

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

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            deleteOutboundPerformed(target);
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            target.add(parentStep.getPageBase().getFeedbackPanel());
        }
    };
    deleteOutbound.setOutputMarkupId(true);
    deleteOutbound.add(WebComponentUtil.visibleIfFalse(readOnlyModel));
    add(deleteOutbound);
    MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(ID_INBOUND, new PropertyModel<List<MappingType>>(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.getAttributeList());
            target.add(parentStep.getAssociationList());
            ((PageResourceWizard) getPageBase()).refreshIssues(target);
        }

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

        @Override
        protected void editPerformed(AjaxRequestTarget target, MappingType object) {
            inboundEditPerformed(target, object);
        }
    };
    inbound.setOutputMarkupId(true);
    add(inbound);
    Label allowTooltip = new Label(ID_T_ALLOW);
    allowTooltip.add(new InfoTooltipBehavior());
    add(allowTooltip);
    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 : ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) Label(org.apache.wicket.markup.html.basic.Label) AjaxSubmitLink(org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) MultiValueTextEditPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel) EmptyOnChangeAjaxFormUpdatingBehavior(com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior) List(java.util.List) ArrayList(java.util.ArrayList) 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) QName(javax.xml.namespace.QName) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) NonEmptyModel(com.evolveum.midpoint.gui.api.model.NonEmptyModel) PageResourceWizard(com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard) PrismObject(com.evolveum.midpoint.prism.PrismObject) ListItem(org.apache.wicket.markup.html.list.ListItem)

Example 7 with MultiValueTextEditPanel

use of com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel in project midpoint by Evolveum.

the class ResourceActivationEditor method prepareActivationPanelBody.

private void prepareActivationPanelBody(String containerValue, String fetchStrategyId, String outboundId, String inboundId, NonEmptyModel<Boolean> readOnlyModel) {
    DropDownChoice fetchStrategy = new DropDownChoice<>(fetchStrategyId, new PropertyModel<AttributeFetchStrategyType>(getModel(), containerValue + ".fetchStrategy"), WebComponentUtil.createReadonlyModelFromEnum(AttributeFetchStrategyType.class), new EnumChoiceRenderer<AttributeFetchStrategyType>(this));
    fetchStrategy.setNullValid(true);
    fetchStrategy.add(WebComponentUtil.enabledIfFalse(readOnlyModel));
    add(fetchStrategy);
    MultiValueTextEditPanel outbound = new MultiValueTextEditPanel<MappingType>(outboundId, new PropertyModel<List<MappingType>>(getModel(), containerValue + ".outbound"), 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 editPerformed(AjaxRequestTarget target, MappingType object) {
            mappingEditPerformed(target, object, false);
        }
    };
    add(outbound);
    MultiValueTextEditPanel inbound = new MultiValueTextEditPanel<MappingType>(inboundId, new PropertyModel<List<MappingType>>(getModel(), containerValue + ".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 editPerformed(AjaxRequestTarget target, MappingType object) {
            mappingEditPerformed(target, object, true);
        }
    };
    inbound.setOutputMarkupId(true);
    add(inbound);
}
Also used : MultiValueTextEditPanel(com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IModel(org.apache.wicket.model.IModel) DropDownChoice(org.apache.wicket.markup.html.form.DropDownChoice) Model(org.apache.wicket.model.Model) PropertyModel(org.apache.wicket.model.PropertyModel) NonEmptyModel(com.evolveum.midpoint.gui.api.model.NonEmptyModel) IModel(org.apache.wicket.model.IModel) List(java.util.List)

Example 8 with MultiValueTextEditPanel

use of com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel in project midpoint by Evolveum.

the class SchemaHandlingStep method initObjectTypeEditor.

private void initObjectTypeEditor(WebMarkupContainer editor) {
    Label editorLabel = new Label(ID_EDITOR_NAME, new AbstractReadOnlyModel<Object>() {

        @Override
        public String getObject() {
            ResourceObjectTypeDefinitionTypeDto selected = schemaHandlingDtoModel.getObject().getSelectedObjectTypeDto();
            return selected != null ? selected.getObjectType().getDisplayName() : "";
        }
    });
    editorLabel.setOutputMarkupId(true);
    editor.add(editorLabel);
    DropDownChoice editorKind = new DropDownChoice<>(ID_EDITOR_KIND, new PropertyModel<ShadowKindType>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_KIND)), WebComponentUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer<ShadowKindType>(this));
    editorKind.add(new UpdateNamesBehaviour());
    parentPage.addEditingEnabledBehavior(editorKind);
    editor.add(editorKind);
    TextField editorIntent = new TextField<>(ID_EDITOR_INTENT, new PropertyModel<String>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_INTENT)));
    editorIntent.add(new UpdateNamesBehaviour());
    parentPage.addEditingEnabledBehavior(editorIntent);
    editor.add(editorIntent);
    TextField editorDisplayName = new TextField<>(ID_EDITOR_DISPLAY_NAME, new PropertyModel<String>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_DISPLAY_NAME)));
    editorDisplayName.add(new UpdateNamesBehaviour());
    parentPage.addEditingEnabledBehavior(editorDisplayName);
    editor.add(editorDisplayName);
    TextArea editorDescription = new TextArea<>(ID_EDITOR_DESCRIPTION, new PropertyModel<String>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_DESCRIPTION)));
    parentPage.addEditingEnabledBehavior(editorDescription);
    editor.add(editorDescription);
    final CheckBox editorDefault = new CheckBox(ID_EDITOR_DEFAULT, new PropertyModel<Boolean>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_DEFAULT)));
    editorDefault.add(new EmptyOnChangeAjaxFormUpdatingBehavior() {

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            Boolean newValue = editorDefault.getModelObject();
            if (Boolean.TRUE.equals(newValue)) {
                SchemaHandlingDto dto = schemaHandlingDtoModel.getObject();
                ResourceObjectTypeDefinitionTypeDto selected = dto.getSelectedObjectTypeDto();
                ShadowKindType selectedKind = fillDefault(selected.getObjectType().getKind());
                for (ResourceObjectTypeDefinitionTypeDto currentObjectTypeDto : dto.getObjectTypeDtoList()) {
                    ShadowKindType currentKind = fillDefault(currentObjectTypeDto.getObjectType().getKind());
                    if (currentObjectTypeDto != selected && currentKind == selectedKind && Boolean.TRUE.equals(currentObjectTypeDto.getObjectType().isDefault())) {
                        currentObjectTypeDto.getObjectType().setDefault(false);
                    }
                }
            }
            parentPage.refreshIssues(target);
        }
    });
    parentPage.addEditingEnabledBehavior(editorDefault);
    editor.add(editorDefault);
    AjaxSubmitLink editorDependency = new AjaxSubmitLink(ID_EDITOR_BUTTON_DEPENDENCY) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            dependencyEditPerformed(target);
        }
    };
    addDisabledClassModifier(editorDependency);
    editor.add(editorDependency);
    AutoCompleteSettings autoCompleteSettings = new AutoCompleteSettings();
    autoCompleteSettings.setShowListOnEmptyInput(true);
    autoCompleteSettings.setMaxHeightInPx(200);
    AutoCompleteTextField<String> editorObjectClass = new AutoCompleteTextField<String>(ID_EDITOR_OBJECT_CLASS, new PropertyModel<String>(schemaHandlingDtoModel, SchemaHandlingDto.F_OBJECT_CLASS_NAME), autoCompleteSettings) {

        @Override
        protected Iterator<String> getChoices(String input) {
            return getObjectClassChoices(input);
        }
    };
    editorObjectClass.add(new UpdateNamesBehaviour());
    editorObjectClass.add(createObjectClassValidator(new AbstractReadOnlyModel<List<QName>>() {

        @Override
        public List<QName> getObject() {
            return schemaHandlingDtoModel.getObject().getObjectClassList();
        }
    }));
    parentPage.addEditingEnabledBehavior(editorObjectClass);
    editorObjectClass.setConvertEmptyInputStringToNull(true);
    editor.add(editorObjectClass);
    MultiValueTextEditPanel editorAttributes = new MultiValueTextEditPanel<ResourceAttributeDefinitionType>(ID_EDITOR_ATTRIBUTES, new PropertyModel<List<ResourceAttributeDefinitionType>>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_ATTRIBUTE)), new PropertyModel<ResourceAttributeDefinitionType>(schemaHandlingDtoModel, SchemaHandlingDto.F_SELECTED_ATTRIBUTE), false, true, parentPage.getReadOnlyModel()) {

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

                @Override
                public String getObject() {
                    if (model == null || model.getObject() == null) {
                        return null;
                    }
                    ResourceAttributeDefinitionType attribute = model.getObject();
                    return formatItemInfo(attribute, attribute.getRef(), attribute.getDisplayName(), attribute.getInbound(), attribute.getOutbound());
                }
            };
        }

        @Override
        protected ResourceAttributeDefinitionType createNewEmptyItem() {
            return createEmptyAttributeObject();
        }

        @Override
        protected void performAddValueHook(AjaxRequestTarget target, ResourceAttributeDefinitionType added) {
            parentPage.refreshIssues(target);
        }

        @Override
        protected void editPerformed(AjaxRequestTarget target, ResourceAttributeDefinitionType object) {
            editAttributePerformed(target, object);
        }

        @Override
        protected boolean buttonsDisabled() {
            return !isAnySelected();
        }

        @Override
        protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<ResourceAttributeDefinitionType> item) {
            resetThirdRowContainer(target);
            parentPage.refreshIssues(target);
        }
    };
    editorAttributes.setOutputMarkupId(true);
    editor.add(editorAttributes);
    MultiValueTextEditPanel editorAssociations = new MultiValueTextEditPanel<ResourceObjectAssociationType>(ID_EDITOR_ASSOCIATIONS, new PropertyModel<List<ResourceObjectAssociationType>>(schemaHandlingDtoModel, getExpression(ResourceObjectTypeDefinitionType.F_ASSOCIATION)), new PropertyModel<ResourceObjectAssociationType>(schemaHandlingDtoModel, SchemaHandlingDto.F_SELECTED_ASSOCIATION), false, true, parentPage.getReadOnlyModel()) {

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

                @Override
                public String getObject() {
                    ResourceObjectAssociationType association = model.getObject();
                    if (association == null) {
                        return null;
                    }
                    return formatItemInfo(association, association.getRef(), association.getDisplayName(), association.getInbound(), association.getOutbound());
                }
            };
        }

        @Override
        protected ResourceObjectAssociationType createNewEmptyItem() {
            return createEmptyAssociationObject();
        }

        @Override
        protected void performAddValueHook(AjaxRequestTarget target, ResourceObjectAssociationType added) {
            parentPage.refreshIssues(target);
        }

        @Override
        protected void editPerformed(AjaxRequestTarget target, ResourceObjectAssociationType object) {
            editAssociationPerformed(target, object);
        }

        @Override
        protected boolean buttonsDisabled() {
            return !isAnySelected();
        }

        @Override
        protected void performRemoveValueHook(AjaxRequestTarget target, ListItem<ResourceObjectAssociationType> item) {
            resetThirdRowContainer(target);
            parentPage.refreshIssues(target);
        }
    };
    editorAssociations.setOutputMarkupId(true);
    editor.add(editorAssociations);
    //        DropDownChoice editorAssignmentPolicyRef = new DropDownChoice<>(ID_EDITOR_ASSIGNMENT_POLICY,
    //                new PropertyModel<AssignmentPolicyEnforcementType>(schemaHandlingDtoModel,
    //						getExpression(ResourceObjectTypeDefinitionType.F_ASSIGNMENT_POLICY_ENFORCEMENT)),
    //                WebComponentUtil.createReadonlyModelFromEnum(AssignmentPolicyEnforcementType.class),
    //                new EnumChoiceRenderer<AssignmentPolicyEnforcementType>(this));
    //		parentPage.addEditingEnabledBehavior(editorAssignmentPolicyRef);
    //        editor.add(editorAssignmentPolicyRef);
    AjaxSubmitLink editorIteration = new AjaxSubmitLink(ID_EDITOR_BUTTON_ITERATION) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            iterationEditPerformed(target);
        }
    };
    addDisabledClassModifier(editorIteration);
    editor.add(editorIteration);
    AjaxSubmitLink editorProtected = new AjaxSubmitLink(ID_EDITOR_BUTTON_PROTECTED) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            protectedEditPerformed(target);
        }
    };
    addDisabledClassModifier(editorProtected);
    editor.add(editorProtected);
    AjaxSubmitLink editorActivation = new AjaxSubmitLink(ID_EDITOR_BUTTON_ACTIVATION) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            activationEditPerformed(target);
        }
    };
    addDisabledClassModifier(editorActivation);
    editor.add(editorActivation);
    AjaxSubmitLink editorCredentials = new AjaxSubmitLink(ID_EDITOR_BUTTON_CREDENTIALS) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            credentialsEditPerformed(target);
        }
    };
    addDisabledClassModifier(editorCredentials);
    editor.add(editorCredentials);
    Label kindTooltip = new Label(ID_T_KIND);
    kindTooltip.add(new InfoTooltipBehavior());
    editor.add(kindTooltip);
    Label intentTooltip = new Label(ID_T_INTENT);
    intentTooltip.add(new InfoTooltipBehavior());
    editor.add(intentTooltip);
    Label defaultTooltip = new Label(ID_T_DEFAULT);
    defaultTooltip.add(new InfoTooltipBehavior());
    editor.add(defaultTooltip);
    Label dependencyTooltip = new Label(ID_T_DEPENDENCY);
    dependencyTooltip.add(new InfoTooltipBehavior());
    editor.add(dependencyTooltip);
    Label objectClassTooltip = new Label(ID_T_OBJECT_CLASS);
    objectClassTooltip.add(new InfoTooltipBehavior());
    editor.add(objectClassTooltip);
    Label attributesTooltip = new Label(ID_T_ATTRIBUTES);
    attributesTooltip.add(new InfoTooltipBehavior());
    editor.add(attributesTooltip);
    Label associationsTooltip = new Label(ID_T_ASSOCIATIONS);
    associationsTooltip.add(new InfoTooltipBehavior());
    editor.add(associationsTooltip);
    Label assignmentPolicyRefTooltip = new Label(ID_T_ASSIGNMENT_POLICY_REF);
    assignmentPolicyRefTooltip.add(new InfoTooltipBehavior());
    editor.add(assignmentPolicyRefTooltip);
    Label iterationTooltip = new Label(ID_T_ITERATION);
    iterationTooltip.add(new InfoTooltipBehavior());
    editor.add(iterationTooltip);
    Label protectedTooltip = new Label(ID_T_PROTECTED);
    protectedTooltip.add(new InfoTooltipBehavior());
    editor.add(protectedTooltip);
    Label activationTooltip = new Label(ID_T_ACTIVATION);
    activationTooltip.add(new InfoTooltipBehavior());
    editor.add(activationTooltip);
    Label credentialsTooltip = new Label(ID_T_CREDENTIALS);
    credentialsTooltip.add(new InfoTooltipBehavior());
    editor.add(credentialsTooltip);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) 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) AutoCompleteTextField(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField) ResourceObjectTypeDefinitionTypeDto(com.evolveum.midpoint.web.component.wizard.resource.dto.ResourceObjectTypeDefinitionTypeDto) AutoCompleteTextField(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField) List(java.util.List) ArrayList(java.util.ArrayList) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InfoTooltipBehavior(com.evolveum.midpoint.web.util.InfoTooltipBehavior) SchemaHandlingDto(com.evolveum.midpoint.web.component.wizard.resource.dto.SchemaHandlingDto) AutoCompleteSettings(org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) NonEmptyLoadableModel(com.evolveum.midpoint.gui.api.model.NonEmptyLoadableModel) PropertyModel(org.apache.wicket.model.PropertyModel) PrismObject(com.evolveum.midpoint.prism.PrismObject) ListItem(org.apache.wicket.markup.html.list.ListItem)

Aggregations

MultiValueTextEditPanel (com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel)8 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)8 List (java.util.List)7 InfoTooltipBehavior (com.evolveum.midpoint.web.util.InfoTooltipBehavior)6 Label (org.apache.wicket.markup.html.basic.Label)6 ArrayList (java.util.ArrayList)5 AjaxSubmitLink (org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink)5 ListItem (org.apache.wicket.markup.html.list.ListItem)5 IModel (org.apache.wicket.model.IModel)5 Model (org.apache.wicket.model.Model)5 PropertyModel (org.apache.wicket.model.PropertyModel)5 NonEmptyModel (com.evolveum.midpoint.gui.api.model.NonEmptyModel)4 EmptyOnChangeAjaxFormUpdatingBehavior (com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior)4 QName (javax.xml.namespace.QName)4 ObjectReferenceChoiceRenderer (com.evolveum.midpoint.web.component.input.ObjectReferenceChoiceRenderer)3 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)3 PageResourceWizard (com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard)3 DropDownChoice (org.apache.wicket.markup.html.form.DropDownChoice)3 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)3 NonEmptyLoadableModel (com.evolveum.midpoint.gui.api.model.NonEmptyLoadableModel)2