1 19 20 package org.netbeans.modules.j2ee.ddloaders.multiview; 21 22 import org.netbeans.modules.j2ee.dd.api.ejb.Query; 23 24 27 public class FinderMethodsTableModel extends QueryMethodsTableModel { 28 29 protected static final String [] COLUMN_NAMES = {Utils.getBundleMessage("LBL_Method"), 30 Utils.getBundleMessage("LBL_ReturnsCollection"), 31 Utils.getBundleMessage("LBL_ResultInterface"), 32 Utils.getBundleMessage("LBL_Query"), 33 Utils.getBundleMessage("LBL_Description")}; 34 protected static final int[] COLUMN_WIDTHS = new int[]{200, 100, 120, 200, 100}; 35 36 public FinderMethodsTableModel(EntityHelper.Queries queries) { 37 super(COLUMN_NAMES, COLUMN_WIDTHS, queries); 38 } 39 40 public void editRow(int row) { 41 } 58 59 public int addRow() { 60 return getRowCount() - 1; 62 } 63 64 public QueryMethodHelper getQueryMethodHelper(int row) { 65 return queries.getFinderMethodHelper(row); 66 } 67 68 public int getRowCount() { 69 return queries.getFinderMethodCount(); 70 } 71 72 public Object getValueAt(int rowIndex, int columnIndex) { 73 QueryMethodHelper queryMethodHelper = getQueryMethodHelper(rowIndex); 74 switch (columnIndex) { 75 case 0: 76 return queryMethodHelper.getQueryMethod().getMethodName(); 77 case 1: 78 return new Boolean (queryMethodHelper.returnsCollection()); 79 case 2: 80 return queryMethodHelper.getResultInterface(); 81 case 3: 82 return queryMethodHelper.getEjbQl(); 83 case 4: 84 return queryMethodHelper.getDefaultDescription(); 85 } 86 return null; 87 } 88 89 public void setValueAt(Object value, int rowIndex, int columnIndex) { 90 QueryMethodHelper helper = getQueryMethodHelper(rowIndex); 91 } 106 107 public Class getColumnClass(int columnIndex) { 108 return columnIndex == 1 ? Boolean .class : String .class; 109 } 110 111 public boolean isCellEditable(int rowIndex, int columnIndex) { 112 if (columnIndex == 1 || columnIndex == 4) { 113 return true; 114 } else { 115 return super.isCellEditable(rowIndex, columnIndex); 116 } 117 } 118 } 119 | Popular Tags |