]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/tablemodels/GroupsOverviewModel.java
Merge branch 'master' of
[pub/jan/sbc.git] / src / main / java / at / ac / tuwien / sbc / valesriegler / pizzeria / gui / tablemodels / GroupsOverviewModel.java
1 package at.ac.tuwien.sbc.valesriegler.pizzeria.gui.tablemodels;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import at.ac.tuwien.sbc.valesriegler.DEP_GroupDataMin;
7 import at.ac.tuwien.sbc.valesriegler.DEP_Order;
8 import at.ac.tuwien.sbc.valesriegler.common.TableModel;
9
10 public class GroupsOverviewModel extends TableModel<DEP_GroupDataMin> {
11         private static final String ID = "ID";
12         private static final String SIZE = "Size";
13         
14         private static final String[] COLUMNS = new String[] {
15                 ID, SIZE
16         };
17
18         @Override
19         protected String[] getColumns() {
20                 return COLUMNS;
21         }
22
23         @Override
24         public Object getValueAt(int rowIndex, int columnIndex) {
25                 List<DEP_GroupDataMin> values = new ArrayList<>(items.values());
26                 DEP_GroupDataMin group = values.get(rowIndex);
27                 String wantedColumn = COLUMNS[columnIndex];
28                 switch(wantedColumn) {
29                 case ID : return group.getId();
30                 case SIZE : return group.getSize();
31                 default : throw new RuntimeException(UNHANDLEDCOLUMN); 
32                 }
33         }
34
35 }