}
public void renderPager(FacesContext context, UIComponent component, UIData data)
throws IOException {
ResponseWriter out = context.getResponseWriter();
UIDatascroller scroller = (UIDatascroller) component;
int currentPage = scroller.getPageIndex(data);
int maxPages = scroller.getMaxPages();
if (maxPages <= 1) {
maxPages = 1;
}
int pageCount = scroller.getPageCount(data);
if (pageCount <= 1) {
return;
}
int delta = maxPages / 2;
int pages;
int start;
if (pageCount > maxPages && currentPage > delta) {
pages = maxPages;
start = currentPage - pages / 2 - 1;
if (start + pages > pageCount) {
start = pageCount - pages;
}
} else {
pages = pageCount < maxPages ? pageCount : maxPages;
start = 0;
}
for (int i = start, size = start + pages; i < size; i++) {
boolean isCurrentPage = (i + 1 == currentPage);
String styleClass;
String style;
if (isCurrentPage) {
styleClass = scroller.getSelectedStyleClass();
style = scroller.getSelectedStyle();
} else {
styleClass = scroller.getInactiveStyleClass();
style = scroller.getInactiveStyle();
}
if (styleClass==null){
styleClass="";
}