]> git.somenet.org - pub/jan/sbc.git/blob - src/main/java/at/ac/tuwien/sbc/valesriegler/pizzeria/gui/tablemodels/GroupsOverviewModel.java
added some not really helpful class descriptions + removed types that got duplicated...
[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 at.ac.tuwien.sbc.valesriegler.common.TableModel;
4 import at.ac.tuwien.sbc.valesriegler.types.GroupData;
5
6 public class GroupsOverviewModel extends TableModel<GroupData> {
7         private static final String ID = "ID";
8         private static final String SIZE = "Size";
9
10         private static final String[] COLUMNS = new String[] { ID, SIZE };
11
12         @Override
13         protected String[] getColumns() {
14                 return COLUMNS;
15         }
16
17         @Override
18         public Object getValueAt(int rowIndex, int columnIndex) {
19                 GroupData group = items.get(rowIndex);
20                 String wantedColumn = COLUMNS[columnIndex];
21                 switch (wantedColumn) {
22                 case ID:
23                         return group.getId();
24                 case SIZE:
25                         return group.getSize();
26                 default:
27                         throw new RuntimeException(UNHANDLEDCOLUMN);
28                 }
29         }
30
31 }