int count=0;
int start = ac - _pagesSize/2;
start = (start+_pagesSize)>pc?pc-_pagesSize:start;
start = start<0?0:start;
Div box;
if(ac>_pagesSize/2){
//rewind
link =new Label("...");
box = new Div();
box.setAttribute("goto",new Integer(ac-_pagesSize<0?0:ac-_pagesSize));
box.addEventListener("onClick",pagesLinkListener);
box.setSclass("mypaging2_page");
box.setParent(_pagesBox);
box.setTooltiptext("fast rewind");
link.setParent(box);
}else{
box = new Div();
box.setSclass("mypaging2_pagenon");
box.setParent(_pagesBox);
}
for(;count<_pagesSize;count++){
if(start+count==ac){
Label lab = new Label(Integer.toString(ac+1));
box = new Div();
box.setSclass("mypaging2_pagesel");
box.setParent(_pagesBox);
lab.setParent(box);
continue;
}
if(start+count<pc){
link =new Label(Integer.toString(start+count+1));
box = new Div();
box.setAttribute("goto",new Integer(start+count));
box.addEventListener("onClick",pagesLinkListener);
box.setSclass("mypaging2_page");
box.setParent(_pagesBox);
link.setParent(box);
}else{
box = new Div();
box.setSclass("mypaging2_pagenon");
box.setParent(_pagesBox);
}
}
if(ac+(_pagesSize/2)<pc){
//forward
link =new Label("...");
box = new Div();
box.setAttribute("goto",new Integer(ac+_pagesSize>pc?pc:ac+_pagesSize));
box.addEventListener("onClick",pagesLinkListener);
box.setSclass("mypaging2_page");
box.setParent(_pagesBox);
box.setTooltiptext("fast forward");
link.setParent(box);
}else{
box = new Div();
box.setSclass("mypaging2_pagenon");
box.setParent(_pagesBox);
}
_pagesBox.invalidate();
}