Skip to content

Commit

Permalink
setSelectedObjects did not call setSelectionIndexes
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Feb 5, 2014
1 parent 3d99878 commit c068883
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import com.webobjects.foundation.NSMutableDictionary;
import com.webobjects.foundation.NSMutableSet;
import com.webobjects.foundation.NSSet;
import com.webobjects.foundation._NSArrayUtilities;

import er.extensions.batching.ERXBatchingDisplayGroup;
import er.extensions.eof.ERXEOAccessUtilities;
import er.extensions.eof.ERXS;

Expand Down Expand Up @@ -97,7 +99,7 @@ public void setQualifierForKey(EOQualifier qualifier, String key) {
}

/**
* Will return the qualifer set by "setQualifierForKey()" if it exists. Null returns otherwise.
* Will return the qualifier set by "setQualifierForKey()" if it exists. Null returns otherwise.
* @param key
* @return
*/
Expand Down Expand Up @@ -189,11 +191,20 @@ public NSArray<T> selectedObjects() {
}

@Override
public void setSelectedObjects(NSArray nsarray) {
public void setSelectedObjects(NSArray objects) {
if(log.isDebugEnabled()) {
log.debug("setSelectedObjects@" + hashCode() + ":" + (nsarray != null ? nsarray.count() : "0"));
log.debug("setSelectedObjects@" + hashCode() + ":" + (objects != null ? objects.count() : "0"));
}
if (this instanceof ERXBatchingDisplayGroup) {
// keep previous behavior
// CHECKME a batching display group has its own _displayedObjects variable so setSelectionIndexes won't work
super.setSelectedObjects(objects);
} else {
// jw: don't call super as it does not call setSelectionIndexes as advertised in its
// javadocs and thus doesn't invoke events on the delegate
NSArray<Integer> newSelection = _NSArrayUtilities.indexesForObjectsIndenticalTo(displayedObjects(), objects);
setSelectionIndexes(newSelection);
}
super.setSelectedObjects(nsarray);
}

@Override
Expand Down

0 comments on commit c068883

Please sign in to comment.