groupNav.add(nav);
}
}
//
UIVirtualList virtualList = getChild(UIVirtualList.class);
final int pageSize = 4;
Iterator<List<?>> source = new Iterator<List<?>>() {
int currentIndex = 0;
@Override
public boolean hasNext() {
return currentIndex < groupNav.size();
}
@Override
public List<UserNavigation> next() {
if (hasNext()) {
List<UserNavigation> list = new ArrayList<UserNavigation>(pageSize);
for (int i = currentIndex; i < currentIndex + pageSize; i++) {
if (i < groupNav.size()) {
UserNavigation u = groupNav.get(i);
list.add(u);
} else {
break;
}
}
//
currentIndex += pageSize;
return list;
} else {
throw new NoSuchElementException();
}
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
virtualList.dataBind(source);
virtualList.setAutoAdjustHeight(true);
}