private void updateCurrentItem() {
   int count = getFacade().count();
   if (selectedItemIndex >= count) {
     // selected index cannot be bigger than number of items:
     selectedItemIndex = count - 1;
     // go to previous page if last page disappeared:
     if (pagination.getPageFirstItem() >= count) {
       pagination.previousPage();
     }
   }
   if (selectedItemIndex >= 0) {
     current = getFacade().getAllInRange(selectedItemIndex, selectedItemIndex + 1).get(0);
   }
 }
 public PageNavigation destroy() {
   current = (Group) getItems().getRowData();
   selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
   performDestroy();
   recreateModel();
   return PageNavigation.LIST;
 }
 public PageNavigation prepareView() {
   current = (Group) getItems().getRowData();
   selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
   return PageNavigation.VIEW;
 }