public PagerItem[] getItems(int startIdx, int numItems) throws Exception {
   //     System.err.println( "getItems(): startIdx = " + startIdx +
   // 			", numItems = " + numItems );
   int pis = startIdx + numItems;
   _sc.setStartAt(new Integer(startIdx + 1));
   _sc.setMaxRecordset(new Integer(numItems));
   SearchResult sr = _cache.get(_sc);
   if (sr == null) {
     sr = _sc.search();
     _cache.put(_sc, sr);
   }
   _objects = Arrays.asList(sr.getResultSet());
   // System.err.println( "_objects.size() = " + _objects.size() );
   pis = Math.min(_objects.size(), numItems);
   if (pis < 0) {
     pis = 0;
   }
   // System.err.println( "pis = " + pis );
   PagerItem[] items = new PagerItem[pis];
   SearchableObject so = _sod.getSearchableObject(_sc.getBeanName());
   for (int i = 0; i < items.length; i++) {
     // Object obj = _objects.get( startIdx + i );
     Object obj = _objects.get(i);
     Object idObj = CaBIOUtils.getProperty(obj, "id");
     String id = (idObj != null ? idObj.toString() : "");
     // System.err.println( "creating pi for " + obj.getClass().getName() + ":" + id );
     List labelProps = so.getLabelProperties();
     List assocs = getNavigableAssociations(so);
     List vals = new ArrayList();
     for (ListIterator j = labelProps.listIterator(); j.hasNext(); ) {
       Object val = CaBIOUtils.getProperty(obj, ((String) j.next()).trim());
       if (val != null) {
         vals.add(val.toString());
       } else {
         vals.add("");
       }
     }
     if (_eventHandler != null) {
       for (ListIterator j = assocs.listIterator(); j.hasNext(); ) {
         Association assoc = (Association) j.next();
         vals.add(
             "<a href=\"javascript:"
                 + _eventHandler
                 + "('"
                 + obj.getClass().getName()
                 + "', '"
                 + id
                 + "', '"
                 + assoc.getRole()
                 + "')\">"
                 + assoc.getLabel()
                 + getCountString(obj, assoc.getRole())
                 + "</a>");
       }
     }
     items[i] = new PagerItemImpl(id, (String[]) vals.toArray(new String[vals.size()]));
   }
   return items;
 }
 protected void initHeaders() {
   List h = new ArrayList();
   if (_sod == null) {
     throw new RuntimeException("sod is null");
   }
   if (_sc == null) {
     throw new RuntimeException("search criteria is null");
   }
   String beanName = _sc.getBeanName();
   if (beanName.endsWith("Impl")) {
     beanName = beanName.substring(0, beanName.indexOf("Impl"));
   }
   SearchableObject so = _sod.getSearchableObject(beanName);
   if (so == null) {
     throw new RuntimeException("Couldn't find so for " + beanName);
   }
   List labelProps = so.getLabelProperties();
   for (Iterator it = labelProps.iterator(); it.hasNext(); ) {
     String propName = (String) it.next();
     Attribute att = _sod.getAttribute(so, propName);
     if (att == null) {
       throw new RuntimeException(
           "CaBIOPagerDataSource.init(): couldn't find attribute "
               + propName
               + " on "
               + so.getClassname());
     }
     h.add(att.getLabel());
   }
   if (_eventHandler != null) {
     List assocs = getNavigableAssociations(so);
     for (Iterator it = assocs.iterator(); it.hasNext(); ) {
       Association assoc = (Association) it.next();
       h.add(assoc.getLabel());
     }
   }
   _headers = (String[]) h.toArray(new String[h.size()]);
 }