|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.vcscore.util; import javax.swing.table.*; import javax.swing.event.TableModelListener; import javax.swing.event.TableModelEvent; /** * In a chain of data manipulators some behaviour is common. TableMap * provides most of this behavour and can be subclassed by filters * that only need to override a handful of specific methods. TableMap * implements TableModel by routing all requests to its model, and * TableModelListener by routing all events to its listeners. Inserting * a TableMap which has not been subclassed into a chain of table filters * should have no effect. * */ public class TableMap extends AbstractTableModel implements TableModelListener { protected TableModel model; private static final long serialVersionUID = 764201097633884793L; public TableModel getModel() { return model; } public void setModel(TableModel model) { this.model = model; model.addTableModelListener(this); } // By default, implement TableModel by forwarding all messages // to the model. public Object getValueAt(int aRow, int aColumn) { return model.getValueAt(aRow, aColumn); } public void setValueAt(Object aValue, int aRow, int aColumn) { model.setValueAt(aValue, aRow, aColumn); } public int getRowCount() { return (model == null) ? 0 : model.getRowCount(); } public int getColumnCount() { return (model == null) ? 0 : model.getColumnCount(); } public String getColumnName(int aColumn) { return model.getColumnName(aColumn); } public Class getColumnClass(int aColumn) { return model.getColumnClass(aColumn); } public boolean isCellEditable(int row, int column) { return model.isCellEditable(row, column); } // // Implementation of the TableModelListener interface, // // By default forward all events to all the listeners. public void tableChanged(TableModelEvent e) { fireTableChanged(e); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.