1 package at.ac.tuwien.sbc.valesriegler.pizzeria.gui.tablemodels;
3 import java.util.ArrayList;
6 import at.ac.tuwien.sbc.valesriegler.common.TableModel;
7 import at.ac.tuwien.sbc.valesriegler.types.Order;
9 public class OrdersOverviewModel extends TableModel<Order> {
10 private static final String ID = "Order ID";
11 private static final String TABLE_ID = "Table ID";
12 private static final String GROUP_ID = "Group ID";
13 private static final String STATUS = "Status";
15 private static final String[] COLUMNS = new String[] { ID, TABLE_ID, GROUP_ID, STATUS };
18 public Object getValueAt(int rowIndex, int columnIndex) {
19 List<Order> values = new ArrayList<>(items.values());
20 Order order = values.get(rowIndex);
21 String wantedColumn = COLUMNS[columnIndex];
22 switch (wantedColumn) {
25 case TABLE_ID: // FIXME: tableid!
26 return new Integer(0);
28 return order.getGroupId();
30 return order.getStatus();
32 throw new RuntimeException(UNHANDLEDCOLUMN);
36 public Order getOrderOfRow(int rowIndex) {
37 return new ArrayList<>(items.values()).get(rowIndex);
41 protected String[] getColumns() {