Skip to content

Commit

Permalink
relation drop down default value for members panel fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jan 22, 2020
1 parent a08e27e commit 4ac86b9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
Expand Up @@ -71,7 +71,14 @@ protected void onInitialize(){
}
DropDownFormGroup<QName> input = new DropDownFormGroup<QName>(ID_INPUT, Model.of(defaultRelation), new ListModel<>(supportedRelations), getRenderer(),
getRelationLabelModel(), "relationDropDownChoicePanel.tooltip.relation", true, "col-md-4",
getRelationLabelModel() == null || StringUtils.isEmpty(getRelationLabelModel().getObject()) ? "" : "col-md-8", !allowNull);
getRelationLabelModel() == null || StringUtils.isEmpty(getRelationLabelModel().getObject()) ? "" : "col-md-8", !allowNull){
private static final long serialVersionUID = 1L;

@Override
protected String getNullValidDisplayValue(){
return RelationDropDownChoicePanel.this.getNullValidDisplayValue();
}
};
input.getInput().add(new EnableBehaviour(() -> isRelationDropDownEnabled()));
input.getInput().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
input.getInput().add(new OnChangeAjaxBehavior() {
Expand Down Expand Up @@ -142,4 +149,8 @@ public QName getRelationValue() {
return relationValue;
}
}

protected String getNullValidDisplayValue(){
return getString("DropDownChoicePanel.empty");
}
}
Expand Up @@ -821,6 +821,11 @@ public QName getObject(String id, IModel<? extends List<? extends QName>> choice
protected void onValueChanged(AjaxRequestTarget target){
refreshAll(target);
}

@Override
protected String getNullValidDisplayValue(){
return getString("RelationTypes.ANY");
}
};
form.add(relationSelector);

Expand Down
Expand Up @@ -11,6 +11,7 @@

import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.PrismConstants;
import com.evolveum.midpoint.web.session.MemberPanelStorage;
import com.evolveum.midpoint.web.session.PageStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
Expand All @@ -19,7 +20,6 @@
import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.util.logging.Trace;
Expand Down Expand Up @@ -126,7 +126,10 @@ protected <O extends ObjectType> Class<O> getDefaultObjectType() {

@Override
protected AvailableRelationDto getSupportedRelations() {
return new AvailableRelationDto(WebComponentUtil.getCategoryRelationChoices(AreaCategoryType.ORGANIZATION, getPageBase()));
AvailableRelationDto availableRelationDto =
new AvailableRelationDto(WebComponentUtil.getCategoryRelationChoices(AreaCategoryType.ORGANIZATION, getPageBase()));
availableRelationDto.setDefaultRelation(PrismConstants.Q_ANY);
return availableRelationDto;
}

@Override
Expand Down
Expand Up @@ -7,6 +7,7 @@
package com.evolveum.midpoint.web.session;


import com.evolveum.midpoint.prism.PrismConstants;
import com.evolveum.midpoint.prism.query.ObjectPaging;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.util.DebugUtil;
Expand All @@ -25,7 +26,7 @@ public class MemberPanelStorage implements PageStorage{
private Search search;
private SearchBoxScopeType orgSearchScope;
private Boolean isIndirect = false;
private QName relation = null;
private QName relation = PrismConstants.Q_ANY;
private ObjectTypes type = null;

public SearchBoxScopeType getOrgSearchScope() {
Expand Down

0 comments on commit 4ac86b9

Please sign in to comment.