From ac625e27f9b0e4d09732564cf698c07953ac1ef4 Mon Sep 17 00:00:00 2001 From: Erik Suta Date: Thu, 16 Oct 2014 15:15:20 +0200 Subject: [PATCH] Resource Wizard update - removing creating obsolete attribute and association container in resource wizard that were causing problems. Improved work with Attribute and association references - added new QNameEditor component for editing custom, non-schema reference. Fixed few small (mostly visual) issues on the way --- .../web/component/input/QNameEditorPanel.html | 42 ++++++++ .../web/component/input/QNameEditorPanel.java | 99 +++++++++++++++++++ .../input/QNameEditorPanel.properties | 18 ++++ .../component/wizard/WizardStep.properties | 3 + .../wizard/resource/SchemaHandlingStep.java | 68 +++++++++++-- .../ResourceAssociationEditor.html | 5 +- .../ResourceAssociationEditor.java | 43 +++++--- .../ResourceAttributeEditor.html | 5 +- .../ResourceAttributeEditor.java | 52 ++++++---- .../xml/ns/public/common/common-3.xsd | 2 +- 10 files changed, 289 insertions(+), 48 deletions(-) create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.html create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java create mode 100644 gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.properties diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.html new file mode 100644 index 00000000000..d9e98ae3a96 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.html @@ -0,0 +1,42 @@ + + + + + + +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+ \ No newline at end of file diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java new file mode 100644 index 00000000000..14dcb411c09 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2010-2014 Evolveum + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.evolveum.midpoint.web.component.input; + +import com.evolveum.midpoint.web.component.util.SimplePanel; +import com.evolveum.midpoint.web.util.InfoTooltipBehavior; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.DropDownChoice; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.PropertyModel; + +import javax.xml.namespace.QName; +import java.util.ArrayList; +import java.util.List; + +/** + * @author shood + * */ +public class QNameEditorPanel extends SimplePanel{ + + private static final String ID_ATTRIBUTE = "attribute"; + private static final String ID_NAMESPACE = "namespace"; + private static final String ID_T_ATTRIBUTE = "attributeTooltip"; + private static final String ID_T_NAMESPACE = "namespaceTooltip"; + + public QNameEditorPanel(String id, IModel model){ + super(id, model); + } + + @Override + public IModel getModel() { + IModel model = super.getModel(); + QName modelObject = model.getObject(); + + if(modelObject == null){ + model.setObject(new QName("")); + } + + return model; + } + + @Override + protected void initLayout(){ + + TextField attribute = new TextField<>(ID_ATTRIBUTE, new PropertyModel(getModel(), "localPart")); + attribute.setOutputMarkupId(true); + attribute.setOutputMarkupPlaceholderTag(true); + attribute.setRequired(true); + add(attribute); + + DropDownChoice namespace = new DropDownChoice<>(ID_NAMESPACE, new PropertyModel(getModel(), "namespaceURI"), + prepareNamespaceList()); + namespace.setOutputMarkupId(true); + namespace.setOutputMarkupPlaceholderTag(true); + namespace.setNullValid(false); + namespace.setRequired(true); + add(namespace); + + Label attrTooltip = new Label(ID_T_ATTRIBUTE); + attrTooltip.add(new InfoTooltipBehavior()); + attrTooltip.setOutputMarkupPlaceholderTag(true); + add(attrTooltip); + + Label namespaceTooltip = new Label(ID_T_NAMESPACE); + namespaceTooltip.add(new InfoTooltipBehavior()); + namespaceTooltip.setOutputMarkupPlaceholderTag(true); + add(namespaceTooltip); + } + + protected List prepareNamespaceList(){ + List list = new ArrayList<>(); + + //icfs + list.add("http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"); + //ri + list.add("http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"); + + return list; + } + +// public boolean isRequired(){ +// return false; +// } +} diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.properties new file mode 100644 index 00000000000..e1bd5038b71 --- /dev/null +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/input/QNameEditorPanel.properties @@ -0,0 +1,18 @@ +# +# Copyright (c) 2010-2013 Evolveum +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +QNameEditor.label.attribute=Ref. attribute +QNameEditor.label.namespace=Ref. namespace diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.properties b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.properties index 9e0f2351ea1..3ea4d3ad9a4 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.properties +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/WizardStep.properties @@ -153,3 +153,6 @@ CapabilityStep.credentials.tooltip.enabled=Tooltip CapabilityStep.credentials.tooltip.passEnabled=Tooltip CapabilityStep.credentials.tooltip.passReturned=Tooltip +QNameEditor.tooltip.attribute=Tooltip +QNameEditor.tooltip.namespace=Tooltip + diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java index fcf32ed8582..2574f2cc726 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/SchemaHandlingStep.java @@ -598,7 +598,7 @@ private void dependencyEditPerformed(AjaxRequestTarget target){ new PropertyModel>(model, SchemaHandlingDto.F_SELECTED + ".dependency")); getThirdRowContainer().replaceWith(newContainer); - target.add(getThirdRowContainer(), getPageBase().getFeedbackPanel()); + target.add(getThirdRowContainer(), get(ID_OBJECT_TYPE_EDITOR), getPageBase().getFeedbackPanel()); } private void iterationEditPerformed(AjaxRequestTarget target){ @@ -606,7 +606,7 @@ private void iterationEditPerformed(AjaxRequestTarget target){ new PropertyModel(model, SchemaHandlingDto.F_SELECTED + ".iteration")); getThirdRowContainer().replaceWith(newContainer); - target.add(getThirdRowContainer(), getPageBase().getFeedbackPanel()); + target.add(getThirdRowContainer(), get(ID_OBJECT_TYPE_EDITOR), getPageBase().getFeedbackPanel()); } private void protectedEditPerformed(AjaxRequestTarget target){ @@ -614,7 +614,7 @@ private void protectedEditPerformed(AjaxRequestTarget target){ new PropertyModel>(model, SchemaHandlingDto.F_SELECTED + "._protected")); getThirdRowContainer().replaceWith(newContainer); - target.add(getThirdRowContainer(), getPageBase().getFeedbackPanel()); + target.add(getThirdRowContainer(), get(ID_OBJECT_TYPE_EDITOR), getPageBase().getFeedbackPanel()); } private void activationEditPerformed(AjaxRequestTarget target){ @@ -622,7 +622,7 @@ private void activationEditPerformed(AjaxRequestTarget target){ new PropertyModel(model, SchemaHandlingDto.F_SELECTED + ".activation")); getThirdRowContainer().replaceWith(newContainer); - target.add(getThirdRowContainer(), getPageBase().getFeedbackPanel()); + target.add(getThirdRowContainer(), get(ID_OBJECT_TYPE_EDITOR), getPageBase().getFeedbackPanel()); } private void credentialsEditPerformed(AjaxRequestTarget target){ @@ -630,20 +630,20 @@ private void credentialsEditPerformed(AjaxRequestTarget target){ new PropertyModel(model, SchemaHandlingDto.F_SELECTED + ".credentials")); getThirdRowContainer().replaceWith(newContainer); - target.add(getThirdRowContainer(), getPageBase().getFeedbackPanel()); + target.add(getThirdRowContainer(), get(ID_OBJECT_TYPE_EDITOR), getPageBase().getFeedbackPanel()); } - private void editAttributePerformed(AjaxRequestTarget target, ResourceAttributeDefinitionType object){ + private void editAttributePerformed(AjaxRequestTarget target, final ResourceAttributeDefinitionType object){ if(model.getObject().getSelected() != null && model.getObject().getSelected().getObjectClass() != null){ WebMarkupContainer newContainer = new ResourceAttributeEditor(ID_THIRD_ROW_CONTAINER, new Model<>(object), model.getObject().getSelected(), resourceModel.getObject()); getThirdRowContainer().replaceWith(newContainer); - target.add(getThirdRowContainer()); + target.add(getThirdRowContainer(), get(ID_OBJECT_TYPE_EDITOR)); } else { warn(getString("SchemaHandlingStep.message.selectObjectClassAttr")); getThirdRowContainer().replaceWith(new WebMarkupContainer(ID_THIRD_ROW_CONTAINER)); - target.add(getPageBase().getFeedbackPanel(), getThirdRowContainer()); + target.add(getPageBase().getFeedbackPanel(), get(ID_OBJECT_TYPE_EDITOR), getThirdRowContainer()); } } @@ -653,11 +653,11 @@ private void editAssociationPerformed(AjaxRequestTarget target, ResourceObjectAs model.getObject().getSelected(), resourceModel.getObject()); getThirdRowContainer().replaceWith(newContainer); - target.add(getThirdRowContainer(), getPageBase().getFeedbackPanel()); + target.add(getThirdRowContainer(), get(ID_OBJECT_TYPE_EDITOR), getPageBase().getFeedbackPanel()); } else { warn(getString("SchemaHandlingStep.message.selectObjectClassAss")); getThirdRowContainer().replaceWith(new WebMarkupContainer(ID_THIRD_ROW_CONTAINER)); - target.add(getPageBase().getFeedbackPanel(), getThirdRowContainer()); + target.add(getPageBase().getFeedbackPanel(), get(ID_OBJECT_TYPE_EDITOR), getThirdRowContainer()); } } @@ -673,6 +673,8 @@ private void savePerformed(){ ModelService modelService = getPageBase().getModelService(); ObjectDelta delta; + removeEmptyContainers(newResource); + try{ oldResource = WebModelUtils.loadObject(ResourceType.class, newResource.getOid(), result, getPageBase()); if(oldResource != null){ @@ -701,6 +703,15 @@ private void savePerformed(){ private void editObjectTypePerformed(AjaxRequestTarget target, ResourceObjectTypeDefinitionTypeDto objectType){ resetSelected(); objectType.setSelected(true); + + if(objectType.getObjectType().getAssociation().isEmpty()){ + objectType.getObjectType().getAssociation().add(new ResourceObjectAssociationType()); + } + + if(objectType.getObjectType().getAttribute().isEmpty()){ + objectType.getObjectType().getAttribute().add(new ResourceAttributeDefinitionType()); + } + model.getObject().setSelected(objectType.getObjectType()); insertEmptyThirdRow(); @@ -743,4 +754,41 @@ private void addObjectTypePerformed(AjaxRequestTarget target){ insertEmptyThirdRow(); target.add(getObjectListTable(), getNavigator(), getObjectTypeEditor(), getThirdRowContainer()); } + + private void removeEmptyContainers(PrismObject resourcePrism){ + if(resourcePrism == null){ + return; + } + + ResourceType resource = resourcePrism.asObjectable(); + + if(resource != null && resource.getSchemaHandling() != null){ + SchemaHandlingType schemaHandling = resource.getSchemaHandling(); + + for(ResourceObjectTypeDefinitionType objectType: schemaHandling.getObjectType()){ + + //Clear obsolete containers from attributes + List newAttributeList = new ArrayList<>(); + newAttributeList.addAll(objectType.getAttribute()); + for(ResourceAttributeDefinitionType attribute: objectType.getAttribute()){ + if(attribute.getRef() == null){ + newAttributeList.remove(attribute); + } + } + objectType.getAttribute().clear(); + objectType.getAttribute().addAll(newAttributeList); + + //Clear obsolete containers from associations + List newAssociationList = new ArrayList<>(); + newAssociationList.addAll(objectType.getAssociation()); + for(ResourceObjectAssociationType association: objectType.getAssociation()){ + if(association.getKind() == null){ + newAssociationList.remove(association); + } + } + objectType.getAssociation().clear(); + objectType.getAssociation().addAll(newAssociationList); + } + } + } } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html index e5ef60546b2..d65a160bf3b 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.html @@ -115,17 +115,18 @@

-
+
-
+
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java index bad45d9d9bf..6f98175d5eb 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAssociationEditor.java @@ -27,6 +27,7 @@ import com.evolveum.midpoint.web.component.AjaxSubmitButton; import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel; import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel; +import com.evolveum.midpoint.web.component.input.QNameEditorPanel; import com.evolveum.midpoint.web.component.util.SimplePanel; import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.LimitationsEditorDialog; @@ -41,6 +42,7 @@ import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; +import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.*; import org.apache.wicket.model.AbstractReadOnlyModel; @@ -69,7 +71,8 @@ public class ResourceAssociationEditor extends SimplePanel(getModel(), "kind"), WebMiscUtil.createReadonlyModelFromEnum(ShadowKindType.class), new EnumChoiceRenderer(this)); - kind.setNullValid(true); + kind.setNullValid(false); add(kind); MultiValueTextPanel intent = new MultiValueTextPanel<>(ID_INTENT, @@ -202,18 +205,36 @@ public String getIdValue(QName object, int index) { new PropertyModel(getModel(), "explicitReferentialIntegrity")); add(explicitRefIntegrity); - TextField refField = new TextField<>(ID_REFERENCE_FIELD, new PropertyModel(getModel(), "ref.localPart")); - refField.setOutputMarkupId(true); - refField.setOutputMarkupPlaceholderTag(true); - refField.add(new VisibleEnableBehaviour(){ + QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_NON_SCHEMA_REF_PANEL, new PropertyModel(getModel(), "ref")); + + 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; + } }); - add(refField); + 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<>(ID_REFERENCE_SELECT, new PropertyModel(getModel(), "ref"), new AbstractReadOnlyModel>() { @@ -244,14 +265,14 @@ public boolean isVisible() { } }); - add(refSelect); + schemaRefPanel.add(refSelect); CheckBox allowNonSchema = new CheckBox(ID_REFERENCE_ALLOW, new PropertyModel(this, "nonSchemaRefValueAllowed")); allowNonSchema.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { - target.add(get(ID_REFERENCE_FIELD), get(ID_REFERENCE_SELECT)); + target.add(get(ID_SCHEMA_REF_PANEL), get(ID_NON_SCHEMA_REF_PANEL)); } }); add(allowNonSchema); @@ -396,10 +417,6 @@ protected void editPerformed(AjaxRequestTarget target, MappingType object){ integrityTooltip.add(new InfoTooltipBehavior()); add(integrityTooltip); - Label refTooltip = new Label(ID_T_REF); - refTooltip.add(new InfoTooltipBehavior()); - add(refTooltip); - Label allowTooltip = new Label(ID_T_ALLOW); allowTooltip.add(new InfoTooltipBehavior()); add(allowTooltip); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html index 992a537fee7..ba9ac4f914c 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.html @@ -21,17 +21,18 @@

-
+
-
+
+
diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java index c9daf072516..5499742634f 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/wizard/resource/component/schemahandling/ResourceAttributeEditor.java @@ -25,6 +25,7 @@ import com.evolveum.midpoint.util.logging.TraceManager; import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextEditPanel; import com.evolveum.midpoint.web.component.form.multivalue.MultiValueTextPanel; +import com.evolveum.midpoint.web.component.input.QNameEditorPanel; import com.evolveum.midpoint.web.component.util.SimplePanel; import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour; import com.evolveum.midpoint.web.component.wizard.resource.component.schemahandling.modal.LimitationsEditorDialog; @@ -40,6 +41,7 @@ import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; +import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.*; import org.apache.wicket.model.AbstractReadOnlyModel; @@ -61,7 +63,8 @@ public class ResourceAttributeEditor extends SimplePanel(ID_REFERENCE_FIELD, new PropertyModel(getModel(), "ref.localPart")); - refField.setOutputMarkupId(true); - refField.setOutputMarkupPlaceholderTag(true); - refField.add(new VisibleEnableBehaviour(){ + QNameEditorPanel nonSchemaRefPanel = new QNameEditorPanel(ID_NON_SCHEMA_REF_PANEL, new PropertyModel(getModel(), "ref")); + + 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; + } }); - add(refField); + 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<>(ID_REFERENCE_SELECT, new PropertyModel(getModel(), "ref"), new AbstractReadOnlyModel>() { @@ -151,24 +173,18 @@ public String getIdValue(QName object, int index) { return Integer.toString(index); } }); + refSelect.setNullValid(false); + refSelect.setOutputMarkupId(true); refSelect.setOutputMarkupPlaceholderTag(true); - refSelect.add(new VisibleEnableBehaviour(){ - - @Override - public boolean isVisible() { - return !nonSchemaRefValueAllowed; - } - - }); - add(refSelect); + schemaRefPanel.add(refSelect); CheckBox allowNonSchema = new CheckBox(ID_REFERENCE_ALLOW, new PropertyModel(this, "nonSchemaRefValueAllowed")); allowNonSchema.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { - target.add(get(ID_REFERENCE_FIELD), get(ID_REFERENCE_SELECT)); + target.add(get(ID_NON_SCHEMA_REF_PANEL), get(ID_SCHEMA_REF_PANEL)); } }); add(allowNonSchema); @@ -289,10 +305,6 @@ protected void editPerformed(AjaxRequestTarget target, MappingType object){ inbound.setOutputMarkupId(true); add(inbound); - Label refTooltip = new Label(ID_T_REF); - refTooltip.add(new InfoTooltipBehavior()); - add(refTooltip); - Label allowTooltip = new Label(ID_T_ALLOW); allowTooltip.add(new InfoTooltipBehavior()); add(allowTooltip); diff --git a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd index ebba96fe8f1..fee4bb141ef 100644 --- a/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd +++ b/infra/schema/src/main/resources/xml/ns/public/common/common-3.xsd @@ -3528,7 +3528,7 @@ - Name of the attribute (XSD element) or assciation that this + Name of the attribute (XSD element) or association that this definition describes. It must point to the attribute in the resource schema that belongs to an object class that is being described here.