PDA

View Full Version : [FIXED] [2.0 M3] PagingModelMemoryProxy does not use DataReader



mistigi
21 Jun 2009, 5:59 PM
It seems that PagingModelMemoryProxy does not use DataReader in its load method. Thus is not possible to use BeanModelMarker in the model.
Here is source fragment of PagingModelMemoryProxy load method

public void load(DataReader<PagingLoadResult<? extends ModelData>> reader,
Object loadConfig, AsyncCallback<PagingLoadResult<? extends ModelData>> callback) {

PagingLoadConfig config = (PagingLoadConfig) loadConfig;

if (config.getSortInfo().getSortField() != null) {
final String sortField = config.getSortInfo().getSortField();
if (sortField != null) {
Collections.sort(data, config.getSortInfo().getSortDir().comparator(
new Comparator<ModelData>() {

public int compare(ModelData o1, ModelData o2) {
Object v1 = (Object) o1.get(sortField);
Object v2 = (Object) o2.get(sortField);

if (comparator != null) {
return comparator.compare(v1, v2);
} else {
return DefaultComparator.INSTANCE.compare(v1, v2);
}

}
}));
}

}
ArrayList<ModelData> sublist = new ArrayList<ModelData>();
int start = config.getOffset();
int limit = data.size();
if (config.getLimit() > 0) {
limit = Math.min(start + config.getLimit(), limit);
}
for (int i = config.getOffset(); i < limit; i++) {
sublist.add(data.get(i));
}
callback.onSuccess(new BasePagingLoadResult<ModelData>(sublist, config.getOffset(),
data.size()));
}

darrellmeyer
24 Jun 2009, 5:40 AM
Fixed in SVN.