mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-02 19:27:57 +08:00
New presentation data layer (sorting - fix tests) #474
This commit is contained in:
parent
db9752b100
commit
6cca4ae462
@ -48,8 +48,8 @@ public class CollectionContainerImpl<E extends Entity>
|
||||
@Override
|
||||
public void setItem(@Nullable E item) {
|
||||
if (item != null) {
|
||||
Integer idx = idMap.get(item.getId());
|
||||
if (idx == -1) {
|
||||
Integer idx = getItemIndex(item.getId());
|
||||
if (idx < -1) {
|
||||
throw new IllegalArgumentException("CollectionContainer does not contain " + item);
|
||||
}
|
||||
E existingItem = collection.get(idx);
|
||||
@ -89,8 +89,8 @@ public class CollectionContainerImpl<E extends Entity>
|
||||
@Nullable
|
||||
@Override
|
||||
public E getItemOrNull(Object entityId) {
|
||||
Integer idx = idMap.get(entityId);
|
||||
return idx != null ? collection.get(idx) : null;
|
||||
Integer idx = getItemIndex(entityId);
|
||||
return idx != -1 ? collection.get(idx) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -149,7 +149,7 @@ public class CollectionContainerImpl<E extends Entity>
|
||||
}
|
||||
|
||||
protected void clearItemIfNotExists() {
|
||||
if (item != null && idMap.get(item.getId()) == -1) {
|
||||
if (item != null && getItemIndex(item.getId()) == -1) {
|
||||
setItem(null);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user