Public paste
Innereien
By: _eMaX_ | Date: Dec 10 2009 16:36 | Format: None | Expires: never | Size: 884 B | Hits: 834

  1. dataModel = new ExtendedTableDataModel<Capital>(new DataProvider<Capital>() {
  2.           private static final long serialVersionUID = 5054087821033164847L;
  3.  
  4.           public Capital getItemByKey(Object key) {
  5.             for (Capital c : capitals) {
  6.               if (key.equals(getKey(c))) {
  7.                 System.out.println("getItemByKey: " + key + "=" + c);
  8.                 return c;
  9.               }
  10.             }
  11.  
  12.             return null;
  13.           }
  14.  
  15.  
  16.           public List<Capital> getItemsByRange(int firstRow, int endRow) {
  17.             return capitals.subList(firstRow, endRow);
  18.           }
  19.  
  20.  
  21.           public Object getKey(Capital item) {
  22.             System.out.println("getKey: " + item.getName());
  23.             return item.getName();
  24.           }
  25.  
  26.  
  27.           public int getRowCount() {
  28.             return capitals.size();
  29.           }
  30.         });