01: package com.opensymphony.workflow.designer.model;
02:
03: import com.opensymphony.workflow.loader.ActionDescriptor;
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 ActionsTableModel extends ListTableModel {
12: private String[] header = new String[] {
13: ResourceManager.getString("id"),
14: ResourceManager.getString("name"),
15: ResourceManager.getString("view"),
16: ResourceManager.getString("auto") };
17:
18: public ActionsTableModel() {
19: }
20:
21: public boolean isCellEditable(int rowIndex, int columnIndex) {
22: return columnIndex != 0;
23: }
24:
25: public int getColumnCount() {
26: return header.length;
27: }
28:
29: public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
30: ActionDescriptor action = (ActionDescriptor) list.get(rowIndex);
31: switch (columnIndex) {
32: case 0:
33: if (aValue != null)
34: action.setId(((Integer) aValue).intValue());
35: break;
36: case 1:
37: if (aValue != null)
38: action.setName(aValue.toString());
39: break;
40: case 2:
41: action.setView(aValue != null ? aValue.toString() : null);
42: break;
43: case 3:
44: action.setAutoExecute(((Boolean) aValue).booleanValue());
45: break;
46: }
47: }
48:
49: public String getColumnName(int column) {
50: return header[column];
51: }
52:
53: public Class getColumnClass(int columnIndex) {
54: switch (columnIndex) {
55: case 0:
56: return Integer.class;
57: case 1:
58: case 2:
59: return String.class;
60: case 3:
61: return Boolean.class;
62: default:
63: return String.class;
64: }
65: }
66:
67: public Object getValueAt(int rowIndex, int columnIndex) {
68: ActionDescriptor action = (ActionDescriptor) list.get(rowIndex);
69: switch (columnIndex) {
70: case 0:
71: return new Integer(action.getId());
72: case 1:
73: return action.getName();
74: case 2:
75: return action.getView() != null ? action.getView() : "";
76: case 3:
77: return action.getAutoExecute() ? Boolean.TRUE
78: : Boolean.FALSE;
79: default:
80: return "";
81: }
82: }
83: }
|