Created
November 30, 2010 13:22
-
-
Save HRE/721663 to your computer and use it in GitHub Desktop.
vaadin-lazyquerycontainer issue 5 patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133c133,134 | |
< return definition.getBatchSize(); | |
--- | |
> // the batch size must not exceed maxCacheSize | |
> return Math.min(maxCacheSize, definition.getBatchSize()); | |
143c144,146 | |
< if(!itemCache.containsKey(index - addedItemCount)) { | |
--- | |
> int cacheIndex = index - addedItemCount; | |
> Integer cacheIndexObject = Integer.valueOf(cacheIndex); | |
> if(!itemCache.containsKey(cacheIndex)) { | |
145c148 | |
< queryItem(index - addedItemCount); | |
--- | |
> queryItem(cacheIndex); | |
149,150c152,153 | |
< itemCacheAccessLog.remove(new Integer(index)); | |
< itemCacheAccessLog.addLast(new Integer(index)); | |
--- | |
> itemCacheAccessLog.remove(cacheIndexObject); | |
> itemCacheAccessLog.addLast(cacheIndexObject); | |
153c156 | |
< return itemCache.get(index - addedItemCount); | |
--- | |
> return itemCache.get(cacheIndexObject); | |
168a172,173 | |
> | |
> Integer itemIndexObject = Integer.valueOf(itemIndex); | |
170,171c175,189 | |
< itemCache.put(itemIndex,item); | |
< itemCacheAccessLog.addLast(itemIndex); | |
--- | |
> Item oldItem = itemCache.put(itemIndexObject,item); | |
> if(oldItem != null){ | |
> | |
> itemCacheAccessLog.remove(itemIndexObject); | |
> | |
> for(Object propertyId : oldItem.getItemPropertyIds()) { | |
> Property property=oldItem.getItemProperty(propertyId); | |
> if(property instanceof ValueChangeNotifier) { | |
> ValueChangeNotifier notifier=(ValueChangeNotifier) property; | |
> notifier.removeListener(this); | |
> propertyItemMapCache.remove(property); | |
> } | |
> } | |
> } | |
> itemCacheAccessLog.addLast(itemIndexObject); | |
207,208c225,231 | |
< int firstIndex=itemCacheAccessLog.getFirst(); | |
< Item firstItem=itemCache.get(firstIndex); | |
--- | |
> Integer firstIndex=itemCacheAccessLog.getFirst(); | |
> Integer firstIndexObject = new Integer(firstIndex); | |
> Item firstItem=itemCache.get(firstIndexObject); | |
> | |
> if(firstItem==null){ | |
> System.err.println("Could not find item for id " + firstIndex); | |
> } | |
211,213c234,236 | |
< if(!modifiedItems.contains(firstItem)&&!removedItems.contains(firstItem)) { | |
< itemCacheAccessLog.remove(new Integer(firstIndex)); | |
< itemCache.remove(firstIndex); | |
--- | |
> if(!modifiedItems.contains(firstItem)&&!removedItems.contains(firstItem)) { | |
> itemCacheAccessLog.remove(0); | |
> itemCache.remove(firstIndexObject); | |
225,226c248,249 | |
< itemCacheAccessLog.remove(firstIndex); | |
< itemCacheAccessLog.addLast(firstIndex); | |
--- | |
> itemCacheAccessLog.remove(0); | |
> itemCacheAccessLog.addLast(firstIndexObject); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment