01: package com.opensymphony.workflow.designer.model;
02:
03: import com.opensymphony.workflow.loader.FunctionDescriptor;
04: import com.opensymphony.workflow.loader.PaletteDescriptor;
05: import com.opensymphony.workflow.loader.ConfigFunctionDescriptor;
06: import com.opensymphony.workflow.designer.ResourceManager;
07: import com.opensymphony.workflow.designer.WorkflowGraphModel;
08:
09: /**
10: * @author Hani Suleiman (hani@formicary.net)
11: * Date: May 20, 2003
12: * Time: 11:04:16 AM
13: */
14: public class FunctionsTableModel 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: FunctionDescriptor function = (FunctionDescriptor) list
34: .get(rowIndex);
35: switch (columnIndex) {
36: case 0:
37: if (aValue != null)
38: function.setName(aValue.toString());
39: break;
40: case 1:
41: if (aValue != null)
42: function.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: FunctionDescriptor function = (FunctionDescriptor) list
61: .get(rowIndex);
62: PaletteDescriptor palette = graphModel.getPalette();
63: ConfigFunctionDescriptor config = palette
64: .getPrefunction(function.getName());
65: switch (columnIndex) {
66: case 0:
67: String name = config != null
68: && config.getDisplayName() != null ? config
69: .getDisplayName() : ResourceManager
70: .getString("unknown");
71: return name;
72: case 1:
73: return function.getType();
74: default:
75: return "";
76: }
77: }
78: }
|