Skip to content

Commit

Permalink
create new member button fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Sep 29, 2021
1 parent a43da64 commit 0faa4a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import java.util.*;

import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.gui.impl.util.ObjectCollectionViewUtil;
import com.evolveum.midpoint.model.api.ModelExecuteOptions;
import com.evolveum.midpoint.model.common.util.DefaultColumnUtils;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ChangeType;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand Down Expand Up @@ -204,7 +202,7 @@ public void onClick(AjaxRequestTarget target) {
}
}

if (getNewObjectInfluencesList().size() <= 1) {
if (!showNewObjectCreationPopup()) {
newObjectPerformed(target, null, getObjectCollectionView());
return;
}
Expand All @@ -228,6 +226,10 @@ protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRe
return createNewObjectButton;
}

protected boolean showNewObjectCreationPopup() {
return getNewObjectInfluencesList() != null && getNewObjectInfluencesList().size() > 1;
}

protected boolean isViewForObjectCollectionType(CompiledObjectCollectionView collectionView, String oid, QName type) {
if (collectionView == null) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ && getSearchModel().getObject().isTypeChanged()) {
super.refreshTable(target);
}

@Override
protected boolean showNewObjectCreationPopup() {
return CollectionUtils.isNotEmpty(getNewObjectReferencesList(getObjectCollectionView(), null));
}

@Override
protected List<ObjectReferenceType> getNewObjectReferencesList(CompiledObjectCollectionView collectionView, AssignmentObjectRelation relation) {
List<ObjectReferenceType> refList = super.getNewObjectReferencesList(collectionView, relation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ protected boolean isObjectDetailsEnabled(IModel<SelectableBean<AH>> rowModel) {
return WebComponentUtil.hasDetailsPage(objectClass);
}

@Override
protected boolean showNewObjectCreationPopup() {
return CollectionUtils.isNotEmpty(getNewObjectReferencesList(getObjectCollectionView(), null));
}

@Override
protected List<Component> createToolbarButtonsList(String buttonId) {
List<Component> buttonsList = super.createToolbarButtonsList(buttonId);
Expand Down

0 comments on commit 0faa4a2

Please sign in to comment.