1 4 package com.tc.admin.common; 5 6 import javax.swing.table.TableCellEditor ; 7 import javax.swing.table.TableCellRenderer ; 8 import javax.swing.table.TableModel ; 9 10 public class PropertyTable extends XTable { 11 private PropertyTableModel m_model; 12 13 public PropertyTable() { 14 super(); 15 } 16 17 public PropertyTable(PropertyTableModel model) { 18 super(); 19 setModel(m_model = model); 20 } 21 22 protected TableModel createDefaultDataModel() { 23 return new PropertyTableModel(); 24 } 25 26 public void setModel(TableModel model) { 27 if(!(model instanceof PropertyTableModel)) { 28 throw new IllegalArgumentException ("Must be a PropertyTableModel"); 29 } 30 super.setModel(m_model = (PropertyTableModel)model); 31 } 32 33 public PropertyTableModel getPropertyModel() { 34 return (PropertyTableModel)getModel(); 35 } 36 37 public TableCellEditor getCellEditor(int row, int column) { 38 switch(column) { 39 case PropertyTableModel.VALUE_COLUMN: 40 return getDefaultEditor(m_model.getRowClass(row)); 41 } 42 43 return super.getCellEditor(row, column); 44 } 45 46 public TableCellRenderer getCellRenderer(int row, int column) { 47 switch(column) { 48 case PropertyTableModel.VALUE_COLUMN: 49 return getDefaultRenderer(m_model.getRowClass(row)); 50 } 51 52 return super.getCellRenderer(row, column); 53 } 54 } 55 | Popular Tags |