01: package com.opensymphony.workflow.designer.model;
02:
03: import com.opensymphony.workflow.loader.PermissionDescriptor;
04: import com.opensymphony.workflow.designer.ResourceManager;
05:
06: /**
07: * @author Hani Suleiman (hani@formicary.net)
08: * Date: May 20, 2003
09: * Time: 11:04:16 AM
10: */
11: public class PermissionsTableModel extends ListTableModel {
12: private String[] header = new String[] {
13: ResourceManager.getString("id"),
14: ResourceManager.getString("name") };
15:
16: public PermissionsTableModel() {
17: }
18:
19: public boolean isCellEditable(int rowIndex, int columnIndex) {
20: return true;
21: }
22:
23: public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
24: PermissionDescriptor permission = (PermissionDescriptor) list
25: .get(rowIndex);
26: switch (columnIndex) {
27: case 0:
28: if (aValue != null)
29: permission.setId(((Integer) aValue).intValue());
30: break;
31: case 1:
32: permission.setName(aValue != null ? aValue.toString()
33: : null);
34: }
35: }
36:
37: public int getColumnCount() {
38: return header.length;
39: }
40:
41: public String getColumnName(int column) {
42: return header[column];
43: }
44:
45: public Class getColumnClass(int columnIndex) {
46: switch (columnIndex) {
47: case 0:
48: return Integer.class;
49: case 1:
50: return String.class;
51: default:
52: return String.class;
53: }
54: }
55:
56: public Object getValueAt(int rowIndex, int columnIndex) {
57: PermissionDescriptor permission = (PermissionDescriptor) list
58: .get(rowIndex);
59: switch (columnIndex) {
60: case 0:
61: return new Integer(permission.getId());
62: case 1:
63: return permission.getName();
64: default:
65: return "";
66: }
67: }
68: }
|