コード例 #1
0
 /**
  * Search article by id
  *
  * @param id
  * @return
  */
 public Article getArticle(int id) {
   for (Article a : articles) {
     if (a.getId() == id) {
       return a;
     }
   }
   return null;
 }
コード例 #2
0
 @Override
 public Object getValueAt(int rowIndex, int colIndex) {
   Article a = articles.get(rowIndex);
   switch (colIndex) {
     case 0:
       return a.getId();
     case 1:
       return a.getName();
     case 2:
       return a.getPrice();
     case 3:
       return a.isAvailable();
   }
   return null;
 }