|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| TableModelIndexed.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.table.TableModel;
|
|
| 10 |
|
|
| 11 |
/**
|
|
| 12 |
* @author Laurent Etiemble
|
|
| 13 |
* @version $Revision: 1.8 $
|
|
| 14 |
*/
|
|
| 15 |
public abstract class TableModelIndexed extends TableModelDecorator |
|
| 16 |
{
|
|
| 17 |
/** Description of the Field */
|
|
| 18 |
protected int[] indexes = new int[0]; |
|
| 19 |
|
|
| 20 |
|
|
| 21 |
/**
|
|
| 22 |
* Constructor for TableFilter.
|
|
| 23 |
*
|
|
| 24 |
* @param model
|
|
| 25 |
*/
|
|
| 26 | 0 |
public TableModelIndexed(TableModel model)
|
| 27 |
{
|
|
| 28 | 0 |
super(model);
|
| 29 |
} |
|
| 30 |
|
|
| 31 |
|
|
| 32 |
/**
|
|
| 33 |
* Gets the rowCount attribute of the TableFilter object
|
|
| 34 |
*
|
|
| 35 |
* @return The rowCount value
|
|
| 36 |
*/
|
|
| 37 | 0 |
public int getRowCount() |
| 38 |
{
|
|
| 39 | 0 |
return this.indexes.length; |
| 40 |
} |
|
| 41 |
|
|
| 42 |
|
|
| 43 |
/**
|
|
| 44 |
* Gets the valueAt attribute of the TableFilter object
|
|
| 45 |
*
|
|
| 46 |
* @param row Description of the Parameter
|
|
| 47 |
* @param column Description of the Parameter
|
|
| 48 |
* @return The valueAt value
|
|
| 49 |
*/
|
|
| 50 | 0 |
public Object getValueAt(int row, int column) |
| 51 |
{
|
|
| 52 | 0 |
return this.model.getValueAt(this.indexes[row], column); |
| 53 |
} |
|
| 54 |
|
|
| 55 |
|
|
| 56 |
/**
|
|
| 57 |
* @param model The new model value
|
|
| 58 |
*/
|
|
| 59 | 0 |
public void setModel(TableModel model) |
| 60 |
{
|
|
| 61 | 0 |
super.setModel(model);
|
| 62 |
} |
|
| 63 |
|
|
| 64 |
|
|
| 65 |
/**
|
|
| 66 |
* Sets the valueAt attribute of the TableFilter object
|
|
| 67 |
*
|
|
| 68 |
* @param newValue The new valueAt value
|
|
| 69 |
* @param row The new valueAt value
|
|
| 70 |
* @param column The new valueAt value
|
|
| 71 |
*/
|
|
| 72 | 0 |
public void setValueAt(Object newValue, int row, int column) |
| 73 |
{
|
|
| 74 | 0 |
this.model.setValueAt(newValue, this.indexes[row], column); |
| 75 |
} |
|
| 76 |
|
|
| 77 |
|
|
| 78 |
/**
|
|
| 79 |
* Description of the Method
|
|
| 80 |
*
|
|
| 81 |
* @param i Description of the Parameter
|
|
| 82 |
* @param j Description of the Parameter
|
|
| 83 |
*/
|
|
| 84 | 0 |
protected void swap(int i, int j) |
| 85 |
{
|
|
| 86 | 0 |
int tmp = indexes[i];
|
| 87 | 0 |
indexes[i] = indexes[j]; |
| 88 | 0 |
indexes[j] = tmp; |
| 89 |
} |
|
| 90 |
} |
|
| 91 |
|
|
||||||||||