예제 #1
0
 public final Object getValueAt(final int row, final int col) {
   long id = shopTable.getOffers().get(row).itemId;
   Item item = ItemStore.itemForId(id);
   long stock = shopTable.getOffers().get(row).amountAvailable;
   long in_inventory = inventory.getSlotWithItemId(id).getNumberOfItems();
   int category = shownCategories.get(col);
   switch (category) {
     case ID:
       return id;
     case SYMBOL:
       return item.getId();
     case NAME:
       return item.getName();
     case VALUE:
       return item.getPrice();
     case ATTACK:
       return item.getAttack();
     case ARMOR:
       return item.getArmor();
     case STOCK:
       return stock;
     case IN_INVENTORY:
       return in_inventory;
     default:
       return null;
   }
 }
예제 #2
0
 public final int getRowCount() {
   return shopTable.getOffers().size();
 }
예제 #3
0
 public ShopTableModel(final ShopTable shopTable) {
   this.shopTable = shopTable;
   this.inventory = shopTable.getInventory();
   inventory.addInventoryChangeListener(this);
   this.shownCategories = new ArrayList<>();
 }