KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > model > ResultsTableModel


1 package com.opensymphony.workflow.designer.model;
2
3 import com.opensymphony.workflow.loader.ResultDescriptor;
4 import com.opensymphony.workflow.designer.ResourceManager;
5
6 /**
7  * @author Hani Suleiman (hani@formicary.net)
8  * Date: May 20, 2003
9  * Time: 11:37:35 AM
10  */

11 public class ResultsTableModel extends ListTableModel
12 {
13   private String JavaDoc[] header = new String JavaDoc[]{ResourceManager.getString("id"), ResourceManager.getString("owner"),
14                                          ResourceManager.getString("status"), ResourceManager.getString("status.old"),
15                                          ResourceManager.getString("step")};
16
17   public int getColumnCount()
18   {
19     return header.length;
20   }
21
22   public String JavaDoc getColumnName(int column)
23   {
24     return header[column];
25   }
26
27   public Class JavaDoc getColumnClass(int columnIndex)
28   {
29     switch(columnIndex)
30     {
31       case 0:
32       case 4:
33         return Integer JavaDoc.class;
34       case 1:
35       case 2:
36       case 3:
37         return String JavaDoc.class;
38       default:
39         return String JavaDoc.class;
40     }
41   }
42
43   public Object JavaDoc getValueAt(int rowIndex, int columnIndex)
44   {
45     ResultDescriptor result = (ResultDescriptor)list.get(rowIndex);
46     switch(columnIndex)
47     {
48       case 0:
49         return result.hasId() ? new Integer JavaDoc(result.getId()) : null;
50       case 1:
51         return result.getOwner()!=null ? result.getOwner() : "";
52       case 2:
53         return result.getStatus()!=null ? result.getStatus() : "";
54       case 3:
55         return result.getOldStatus()!=null ? result.getOldStatus() : "";
56       case 4:
57         return new Integer JavaDoc(result.getStep());
58       default:
59         return "";
60     }
61   }
62 }
63
Popular Tags