01: package com.opensymphony.workflow.designer.model;
02:
03: import com.opensymphony.workflow.loader.RegisterDescriptor;
04: import com.opensymphony.workflow.loader.PaletteDescriptor;
05: import com.opensymphony.workflow.loader.ConfigRegisterDescriptor;
06: import com.opensymphony.workflow.designer.ResourceManager;
07: import com.opensymphony.workflow.designer.WorkflowGraphModel;
08:
09: /**
10: * @author Andrea Capitani (a.capitani@leonardomultimedia.it)
11: * Date: Nov 16, 2004
12: * Time: 18:20:16 PM
13: */
14: public class RegistersTableModel extends ListTableModel {
15: private String[] header = new String[] {
16: ResourceManager.getString("name"),
17: ResourceManager.getString("type") };
18: private WorkflowGraphModel graphModel;
19:
20: public WorkflowGraphModel getGraphModel() {
21: return graphModel;
22: }
23:
24: public void setGraphModel(WorkflowGraphModel graphModel) {
25: this .graphModel = graphModel;
26: }
27:
28: public boolean isCellEditable(int rowIndex, int columnIndex) {
29: return false;
30: }
31:
32: public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
33: RegisterDescriptor register = (RegisterDescriptor) list
34: .get(rowIndex);
35: switch (columnIndex) {
36: case 0:
37: if (aValue != null)
38: register.setVariableName(aValue.toString());
39: break;
40: case 1:
41: if (aValue != null)
42: register.setType(aValue.toString());
43: break;
44: }
45: }
46:
47: public int getColumnCount() {
48: return header.length;
49: }
50:
51: public String getColumnName(int column) {
52: return header[column];
53: }
54:
55: public Class getColumnClass(int columnIndex) {
56: return String.class;
57: }
58:
59: public Object getValueAt(int rowIndex, int columnIndex) {
60: RegisterDescriptor register = (RegisterDescriptor) list
61: .get(rowIndex);
62: PaletteDescriptor palette = graphModel.getPalette();
63: ConfigRegisterDescriptor config = palette.getRegister(register
64: .getVariableName());
65: switch (columnIndex) {
66: case 0:
67: String name = config != null ? config.getVariableName()
68: : ResourceManager.getString("unknown");
69: return name;
70: case 1:
71: return register.getType();
72: default:
73: return "";
74: }
75: }
76: }
|