Revision 42991
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/paging/impl/FeaturePagingHelperImpl.java | ||
---|---|---|
219 | 219 |
} |
220 | 220 |
} |
221 | 221 |
|
222 |
public Feature getFeatureAt(long index) throws BaseException { |
|
222 |
public synchronized Feature getFeatureAt(long index) throws BaseException {
|
|
223 | 223 |
// Check if we have currently loaded the viewed page data, |
224 | 224 |
// or we need to load a new one |
225 |
long pageForIndex = (long) Math.floor(index / getMaxPageSize()); |
|
225 |
int maxPageSize = getMaxPageSize(); |
|
226 |
long currentPage = getCurrentPage(); |
|
227 |
long currentPage2 = currentPage; |
|
228 |
|
|
229 |
|
|
230 |
long pageForIndex = (long) Math.floor(index / maxPageSize); |
|
226 | 231 |
|
227 |
if (pageForIndex != getCurrentPage()) {
|
|
232 |
if (pageForIndex != currentPage) {
|
|
228 | 233 |
setCurrentPage(pageForIndex); |
234 |
currentPage2 = getCurrentPage(); |
|
229 | 235 |
} |
230 | 236 |
|
231 |
long positionForIndex = index - (getCurrentPage() * getMaxPageSize());
|
|
237 |
long positionForIndex = index - (currentPage2 * maxPageSize);
|
|
232 | 238 |
|
233 | 239 |
if (positionForIndex >= getCurrentPageFeatures().length) { |
234 | 240 |
throw new FeatureIndexException( |
... | ... | |
339 | 345 |
/** |
340 | 346 |
* Loads all the Features of the current page. |
341 | 347 |
*/ |
342 |
protected void loadCurrentPageData() throws BaseException { |
|
348 |
protected synchronized void loadCurrentPageData() throws BaseException {
|
|
343 | 349 |
if( !initialization_completed ) { |
344 | 350 |
return; |
345 | 351 |
} |
Also available in: Unified diff