1 19 package org.netbeans.modules.db.sql.visualeditor.querybuilder; 20 21 import org.openide.util.NbBundle; 22 import javax.swing.table.DefaultTableModel ; 23 24 class QueryBuilderInputTableModel extends DefaultTableModel { 25 26 28 final String [] columnNames = { 29 NbBundle.getMessage(QueryBuilderInputTableModel.class, "COLUMN"), NbBundle.getMessage(QueryBuilderInputTableModel.class, "ALIAS"), NbBundle.getMessage(QueryBuilderInputTableModel.class, "TABLE"), NbBundle.getMessage(QueryBuilderInputTableModel.class, "OUTPUT"), NbBundle.getMessage(QueryBuilderInputTableModel.class, "SORT_TYPE"), NbBundle.getMessage(QueryBuilderInputTableModel.class, "SORT_ORDER"), NbBundle.getMessage(QueryBuilderInputTableModel.class, "CRITERIA"), NbBundle.getMessage(QueryBuilderInputTableModel.class, "CRITERIA_ORDER"), }; 52 53 Object [][] data = { 54 { "", "", "", "", Boolean.FALSE, "", "", "" } }; 56 57 58 60 public QueryBuilderInputTableModel () 61 { 62 super(0, 10); 63 setColumnIdentifiers ( columnNames ); 64 } 65 66 67 73 public Class getColumnClass(int c) { 74 if ( getRowCount() == 0 ) return (new String ("").getClass()); if ( getValueAt(0,c) == null ) return (new String ("").getClass()); return getValueAt(0, c).getClass(); 77 } 78 79 80 83 public boolean isCellEditable(int row, int col) { 84 if ((col==QueryBuilderInputTable.Column_COLUMN) || 87 (col==QueryBuilderInputTable.Table_COLUMN)) { 88 return false; 89 } 90 else if ( col==QueryBuilderInputTable.Criteria_COLUMN && 91 getValueAt(row, col).equals ( 92 QueryBuilderInputTable.Criteria_Uneditable_String) ) { 93 return false; 94 } 95 else if ( col==QueryBuilderInputTable.CriteriaOrder_COLUMN && 96 getValueAt(row, col).equals ( 97 QueryBuilderInputTable.CriteriaOrder_Uneditable_String ) ) { 98 return false; 99 } 100 else { 101 return true; 102 } 103 } 104 } 105 106 | Popular Tags |