Skip to content

Commit

Permalink
reference autocomplete fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jun 25, 2020
1 parent 023def3 commit ebf990b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Expand Up @@ -11,7 +11,7 @@
<div>
<div class="col-md-10" wicket:id="referenceValueTextField"/>
<div class="col-sm-1">
<a wicket:id="editButton" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<a wicket:id="editReferenceButton" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-edit fa-lg"/>
</a>
</div>
Expand Down
Expand Up @@ -33,7 +33,7 @@ public class ReferenceValueSearchPanel extends BasePanel<ObjectReferenceType> {
private static final long serialVersionUID = 1L;

private static final String ID_REFERENCE_VALUE_TEXT_FIELD = "referenceValueTextField";
private static final String ID_EDIT_BUTTON = "editButton";
private static final String ID_EDIT_BUTTON = "editReferenceButton";
private static final String ID_REF_POPOVER_PANEL = "refPopoverPanel";
private static final String ID_REF_POPOVER_BODY = "refPopoverBody";
private static final String ID_REF_POPOVER = "refPopover";
Expand All @@ -55,6 +55,7 @@ private void initLayout(){

TextPanel<String> referenceTextValueField = new TextPanel<String>(ID_REFERENCE_VALUE_TEXT_FIELD, Model.of(getReferenceTextModel()));
referenceTextValueField.setOutputMarkupId(true);
referenceTextValueField.setEnabled(false);
add(referenceTextValueField);

AjaxButton editButton = new AjaxButton(ID_EDIT_BUTTON) {
Expand Down
Expand Up @@ -13,6 +13,7 @@
import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.component.autocomplete.AutoCompleteReferenceRenderer;

import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

import org.apache.commons.collections.CollectionUtils;
Expand Down Expand Up @@ -54,9 +55,9 @@ protected void onInitialize() {
}

private void initLayout() {
setOutputMarkupId(true);

TextField<String> oidField = new TextField<String>(ID_OID, new PropertyModel<>(getModel(), "oid"));

oidField.add(new AjaxFormComponentUpdatingBehavior("blur") {

private static final long serialVersionUID = 1L;
Expand All @@ -67,6 +68,7 @@ protected void onUpdate(AjaxRequestTarget target) {
}
});
oidField.setOutputMarkupId(true);
oidField.add(new VisibleBehaviour(() -> true));
oidField.add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
add(oidField);

Expand All @@ -87,15 +89,17 @@ protected Class<O> getReferenceTargetObjectType(){

};

// nameField.add(new AjaxFormComponentUpdatingBehavior("blur") {
//
// private static final long serialVersionUID = 1L;
//
// @Override
// protected void onUpdate(AjaxRequestTarget target) {
//
// }
// });
nameField.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("blur") {

private static final long serialVersionUID = 1L;

@Override
protected void onUpdate(AjaxRequestTarget target) {
ObjectReferenceType ort = nameField.getBaseFormComponent().getModelObject();
ReferenceValueSearchPopupPanel.this.getModel().setObject(ort);
target.add(ReferenceValueSearchPopupPanel.this.get(ID_OID));
}
});
nameField.setOutputMarkupId(true);
nameField.getBaseFormComponent().add(new EmptyOnBlurAjaxFormUpdatingBehaviour());
add(nameField);
Expand Down

0 comments on commit ebf990b

Please sign in to comment.