View Javadoc
1 /* 2 * ==================================================================== 3 * 4 * This code is subject to the freebxml License, Version 1.1 5 * 6 * Copyright (c) 2003 freebxml.org. All rights reserved. 7 * 8 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/client/browser/TableMap.java,v 1.1 2003/07/31 18:36:27 farrukh_najmi Exp $ 9 * ==================================================================== 10 */ 11 package com.sun.xml.registry.client.browser; 12 13 import javax.swing.table.*; 14 import javax.swing.event.TableModelListener; 15 import javax.swing.event.TableModelEvent; 16 17 /*** 18 * In a chain of data manipulators some behaviour is common. TableMap 19 * provides most of this behavour and can be subclassed by filters 20 * that only need to override a handful of specific methods. TableMap 21 * implements TableModel by routing all requests to its model, and 22 * TableModelListener by routing all events to its listeners. Inserting 23 * a TableMap which has not been subclassed into a chain of table filters 24 * should have no effect. 25 * 26 * @version 1.4 12/17/97 27 * @author Philip Milne 28 */ 29 public class TableMap extends AbstractTableModel 30 implements TableModelListener { 31 protected TableModel model; 32 33 public TableModel getModel() { 34 return model; 35 } 36 37 public void setModel(TableModel model) { 38 this.model = model; 39 model.addTableModelListener(this); 40 } 41 42 // By default, implement TableModel by forwarding all messages 43 // to the model. 44 45 public Object getValueAt(int aRow, int aColumn) { 46 return model.getValueAt(aRow, aColumn); 47 } 48 49 public void setValueAt(Object aValue, int aRow, int aColumn) { 50 model.setValueAt(aValue, aRow, aColumn); 51 } 52 53 public int getRowCount() { 54 return (model == null) ? 0 : model.getRowCount(); 55 } 56 57 public int getColumnCount() { 58 return (model == null) ? 0 : model.getColumnCount(); 59 } 60 61 public String getColumnName(int aColumn) { 62 return model.getColumnName(aColumn); 63 } 64 65 public Class getColumnClass(int aColumn) { 66 return model.getColumnClass(aColumn); 67 } 68 69 public boolean isCellEditable(int row, int column) { 70 return model.isCellEditable(row, column); 71 } 72 // 73 // Implementation of the TableModelListener interface, 74 // 75 // By default forward all events to all the listeners. 76 public void tableChanged(TableModelEvent e) { 77 fireTableChanged(e); 78 } 79 }

This page was automatically generated by Maven