|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| TableModelDecorator.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package org.ejtools.swing.table;
|
|
| 8 |
|
|
| 9 |
import javax.swing.event.TableModelEvent;
|
|
| 10 |
import javax.swing.event.TableModelListener;
|
|
| 11 |
import javax.swing.table.AbstractTableModel;
|
|
| 12 |
import javax.swing.table.TableModel;
|
|
| 13 |
|
|
| 14 |
/**
|
|
| 15 |
* @author Laurent Etiemble
|
|
| 16 |
* @version $Revision: 1.9 $
|
|
| 17 |
*/
|
|
| 18 |
public abstract class TableModelDecorator extends AbstractTableModel implements TableModelListener |
|
| 19 |
{
|
|
| 20 |
/** Description of the Field */
|
|
| 21 |
protected TableModel model = null; |
|
| 22 |
|
|
| 23 |
|
|
| 24 |
/**
|
|
| 25 |
* Constructor for TableFilter.
|
|
| 26 |
*
|
|
| 27 |
* @param model Description of the Parameter
|
|
| 28 |
*/
|
|
| 29 | 0 |
public TableModelDecorator(TableModel model)
|
| 30 |
{
|
|
| 31 | 0 |
this.model = model;
|
| 32 | 0 |
this.model.addTableModelListener(this); |
| 33 |
} |
|
| 34 |
|
|
| 35 |
|
|
| 36 |
/** Constructor for TableModelDecorator. */
|
|
| 37 | 0 |
protected TableModelDecorator()
|
| 38 |
{
|
|
| 39 | 0 |
super();
|
| 40 |
} |
|
| 41 |
|
|
| 42 |
|
|
| 43 |
/**
|
|
| 44 |
* @param column Description of the Parameter
|
|
| 45 |
* @return The columnClass value
|
|
| 46 |
*/
|
|
| 47 | 0 |
public Class getColumnClass(int column) |
| 48 |
{
|
|
| 49 | 0 |
return this.model.getColumnClass(column); |
| 50 |
} |
|
| 51 |
|
|
| 52 |
|
|
| 53 |
/**
|
|
| 54 |
* @return The columnCount value
|
|
| 55 |
*/
|
|
| 56 | 0 |
public int getColumnCount() |
| 57 |
{
|
|
| 58 | 0 |
return this.model.getColumnCount(); |
| 59 |
} |
|
| 60 |
|
|
| 61 |
|
|
| 62 |
/**
|
|
| 63 |
* @param column Description of the Parameter
|
|
| 64 |
* @return The columnName value
|
|
| 65 |
*/
|
|
| 66 | 0 |
public String getColumnName(int column) |
| 67 |
{
|
|
| 68 | 0 |
return this.model.getColumnName(column); |
| 69 |
} |
|
| 70 |
|
|
| 71 |
|
|
| 72 |
/**
|
|
| 73 |
* Returns the model.
|
|
| 74 |
*
|
|
| 75 |
* @return TableModel
|
|
| 76 |
*/
|
|
| 77 | 0 |
public TableModel getModel()
|
| 78 |
{
|
|
| 79 | 0 |
return this.model; |
| 80 |
} |
|
| 81 |
|
|
| 82 |
|
|
| 83 |
/**
|
|
| 84 |
* @return The rowCount value
|
|
| 85 |
*/
|
|
| 86 | 0 |
public int getRowCount() |
| 87 |
{
|
|
| 88 | 0 |
return this.model.getRowCount(); |
| 89 |
} |
|
| 90 |
|
|
| 91 |
|
|
| 92 |
/**
|
|
| 93 |
* @param row Description of the Parameter
|
|
| 94 |
* @param column Description of the Parameter
|
|
| 95 |
* @return The valueAt value
|
|
| 96 |
*/
|
|
| 97 | 0 |
public Object getValueAt(int row, int column) |
| 98 |
{
|
|
| 99 | 0 |
return this.model.getValueAt(row, column); |
| 100 |
} |
|
| 101 |
|
|
| 102 |
|
|
| 103 |
/**
|
|
| 104 |
* @param row Description of the Parameter
|
|
| 105 |
* @param column Description of the Parameter
|
|
| 106 |
* @return The cellEditable value
|
|
| 107 |
*/
|
|
| 108 | 0 |
public boolean isCellEditable(int row, int column) |
| 109 |
{
|
|
| 110 | 0 |
return this.model.isCellEditable(row, column); |
| 111 |
} |
|
| 112 |
|
|
| 113 |
|
|
| 114 |
/**
|
|
| 115 |
* Sets the model.
|
|
| 116 |
*
|
|
| 117 |
* @param model The model to set
|
|
| 118 |
*/
|
|
| 119 | 0 |
public void setModel(TableModel model) |
| 120 |
{
|
|
| 121 | 0 |
this.model = model;
|
| 122 |
} |
|
| 123 |
|
|
| 124 |
|
|
| 125 |
/**
|
|
| 126 |
* @param o The new valueAt value
|
|
| 127 |
* @param row The new valueAt value
|
|
| 128 |
* @param column The new valueAt value
|
|
| 129 |
*/
|
|
| 130 | 0 |
public void setValueAt(Object o, int row, int column) |
| 131 |
{
|
|
| 132 | 0 |
this.model.setValueAt(o, row, column);
|
| 133 |
} |
|
| 134 |
|
|
| 135 |
|
|
| 136 |
/**
|
|
| 137 |
* @param event Description of the Parameter
|
|
| 138 |
*/
|
|
| 139 | 0 |
public void tableChanged(TableModelEvent event) |
| 140 |
{
|
|
| 141 | 0 |
this.fireTableChanged(event);
|
| 142 |
} |
|
| 143 |
} |
|
| 144 |
|
|
||||||||||