1 19 20 package org.netbeans.modules.web.monitor.client; 21 22 import java.util.*; 23 import javax.swing.table.TableModel ; 24 import javax.swing.table.AbstractTableModel ; 25 import org.openide.util.NbBundle; 26 27 36 public class DisplayTableModel extends AbstractTableModel { 37 38 private Object [][] data = null; 39 private boolean editable, editableNames; 40 private int numCols = 3; 41 42 private static final boolean debug = false; 43 44 public DisplayTableModel(Object [][] data, 45 boolean editable, 46 boolean editableNames) { 47 this.data = data; 48 this.editable = editable; 49 this.editableNames = editableNames; 50 } 51 52 public String getColumnName(int col) { 53 return ""; } 56 57 public int getRowCount() { return data.length; } 58 public int getColumnCount() { return numCols; } 59 public Object getValueAt(int row, int col) { 60 return data[row][col]; 61 } 62 public boolean isCellEditable(int row, int col) { 63 if(editable) { 64 if(col == 0) return editableNames; 65 if(col == 1) return true; 66 if(col == 2) return true; 67 } 68 if(col == 2) return true; 69 return false; 70 } 71 72 public void setValueAt(Object value, int row, int col) { 73 data[row][col] = value; 74 fireTableCellUpdated(row, col); 75 } 76 77 void log(String s) { 78 System.out.println("DisplayTableModel::" + s); } 80 81 } 83 | Popular Tags |