View Javadoc

1   // %511085336:hoplugins.teamAnalyzer.ui.model%
2   package hoplugins.teamAnalyzer.ui.model;
3   
4   import hoplugins.commons.ui.BaseTableModel;
5   
6   import java.util.Vector;
7   
8   import javax.swing.ImageIcon;
9   
10  
11  /***
12   * Custom FilterTable model
13   *
14   * @author <a href=mailto:draghetto@users.sourceforge.net>Massimiliano Amato</a>
15   */
16  public class UiFilterTableModel extends BaseTableModel {
17      //~ Constructors -------------------------------------------------------------------------------
18  
19      /***
20       * Creates a new instance of UiFilterTableModel
21       */
22      public UiFilterTableModel() {
23          super();
24      }
25  
26      /***
27       * Creates a new UiFilterTableModel object.
28       *
29       * @param data Vector of table data
30       * @param columnNames Vector of column names
31       */
32      public UiFilterTableModel(Vector data, Vector columnNames) {
33          super(data, columnNames);
34      }
35  
36      //~ Methods ------------------------------------------------------------------------------------
37  
38      /***
39       * Returns true if the cell is editable
40       *
41       * @param row
42       * @param column
43       *
44       * @return
45       */
46      public boolean isCellEditable(int row, int column) {
47          if (column != 0) {
48              return false;
49          }
50  
51          String available = (String) getValueAt(row, 6);
52  
53          if (available.equalsIgnoreCase("true")) {
54              return true;
55          }
56  
57          return false;
58      }
59  
60      /***
61       * Returns the column class type
62       *
63       * @param column
64       *
65       * @return
66       */
67      public Class getColumnClass(int column) {
68          if (column == 2) {
69              return ImageIcon.class;
70          }
71  
72          return super.getColumnClass(column);
73      }
74  }