1 5 package org.exoplatform.faces.core.component.model; 6 7 import java.util.List ; 8 import org.exoplatform.commons.utils.PageList; 9 14 public class PageListDataHandler extends ListDataHandler { 15 private PageList pageList_ = PageList.EMPTY_LIST ; 16 17 public void setPageList(PageList pageList) throws Exception { 18 pageList_ = pageList ; 19 setDatas(pageList_.currentPage()) ; 20 } 21 22 public int getAvailablePage() { return pageList_.getAvailablePage() ; } 23 24 public int getCurrentPage() { return pageList_.getCurrentPage() ; } 25 26 public int getAvailable() { return pageList_.getAvailable() ; } 27 28 public int getFrom() { return pageList_.getFrom() ; } 29 30 public int getTo() { return pageList_ .getTo() ; } 31 32 public int getCurrentObjectIdndex() { return getFrom() + getCurrentRow() ; } 33 34 public Object getObjectInPage(int index) throws Exception { 35 return pageList_.currentPage().get(index) ; 36 } 37 38 public void selectPage(int page) throws Exception { 39 setDatas(pageList_.getPage(page)) ; 40 } 41 42 public List getObjectInCurrentPage() { return getDatas() ; } 43 44 public String getData(String fieldName) { 45 throw new RuntimeException ("You need to override this method") ; 46 } 47 48 public void setCurrentObject(Object o) { 49 50 } 51 } 52 | Popular Tags |