1 package org.musicontroller.gui.admin;
2
3 import java.util.List;
4
5 import org.apache.tapestry.form.IPropertySelectionModel;
6 import org.musicontroller.security.Role;
7
8
9
10
11
12
13
14 public class RoleSelectionModel implements IPropertySelectionModel {
15 private List<Role> _itemList;
16
17 public RoleSelectionModel(List<Role> roles) {
18 _itemList = roles;
19 }
20
21
22
23
24
25 public String getLabel(int index) {
26 return ((Role) _itemList.get(index)).getName();
27 }
28
29
30
31
32
33 public int getOptionCount() {
34 return _itemList.size();
35 }
36
37
38
39
40
41 public Role translateValue(String value) {
42 int index = Integer.parseInt(value);
43 return _itemList.get(index);
44 }
45
46
47
48
49
50 public Role getOption(int index) {
51 return _itemList.get(index);
52 }
53
54
55
56
57
58 public String getValue(int index) {
59 return Integer.valueOf(index).toString();
60 }
61
62
63
64
65
66 public boolean isDisabled(int index) {
67 return false;
68 }
69
70 }