1 package org.objectweb.jac.aspects.gui; 2 3 import javax.swing.event.TableModelEvent ; 4 import javax.swing.event.TableModelListener ; 5 import javax.swing.table.AbstractTableModel ; 6 import org.apache.log4j.Logger; 7 import org.objectweb.jac.core.rtti.CollectionItem; 8 import org.objectweb.jac.core.rtti.FieldItem; 9 import org.objectweb.jac.core.rtti.MemberItem; 10 11 22 23 class TableMap extends AbstractTableModel 24 implements TableModelListener , ExtendedTableModel 25 { 26 static Logger logger = Logger.getLogger("gui.model"); 27 28 protected ExtendedTableModel model; 29 30 public ExtendedTableModel getModel() { 31 return model; 32 } 33 34 public void setModel(ExtendedTableModel model) { 35 if (this.model!=null) 36 this.model.removeTableModelListener(this); 37 this.model = model; 38 model.addTableModelListener(this); 39 } 40 41 44 public CollectionItem getCollection() { 45 return model.getCollection(); 46 } 47 48 public Object getValueAt(int aRow, int aColumn) { 49 return model.getValueAt(aRow, aColumn); 50 } 51 52 public Object getObject(int row) { 53 return model.getObject(row); 54 } 55 56 public Object getObject(int row, int column) { 57 return getObject(row,column); 58 } 59 60 public int indexOf(Object object) { 61 return model.indexOf(object); 62 } 63 64 public void setValueAt(Object aValue, int aRow, int aColumn) { 65 model.setValueAt(aValue, aRow, aColumn); 66 } 67 68 public int getRowCount() { 69 return (model == null) ? 0 : model.getRowCount(); 70 } 71 72 public int getColumnCount() { 73 return (model == null) ? 0 : model.getColumnCount(); 74 } 75 76 public String getColumnName(int aColumn) { 77 return model.getColumnName(aColumn); 78 } 79 80 public Class getColumnClass(int aColumn) { 81 return model.getColumnClass(aColumn); 82 } 83 84 public boolean isCellEditable(int row, int column) { 85 return model.isCellEditable(row, column); 86 } 87 88 public Object getCellRenderer(View tableView, int column, 89 ViewFactory factory, DisplayContext context) { 90 return model.getCellRenderer(tableView, column,factory,context); 91 } 92 93 public MemberItem[] getMembers() { 94 return model.getMembers(); 95 } 96 97 public String [] getHeaders() { 98 return model.getHeaders(); 99 } 100 101 public int getColumnIndex(FieldItem field) { 102 return model.getColumnIndex(field); 103 } 104 105 public void tableChanged(TableModelEvent e) { 110 fireTableChanged(e); 111 } 112 113 115 public void close() { 116 ((Model)model).close(); 117 } 118 119 public TableFilter getFilter() { 120 if (this instanceof TableFilter) 121 return (TableFilter)this; 122 else 123 return model.getFilter(); 124 } 125 126 public TableSorter getSorter() { 127 logger.debug(this+".getSorter"); 128 if (this instanceof TableSorter) 129 return (TableSorter)this; 130 else 131 return model.getSorter(); 132 } 133 } 134 | Popular Tags |