|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| TableModelMatchFilter.java | 0% | 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 java.util.ArrayList;
|
|
| 10 |
|
|
| 11 |
import javax.swing.table.TableModel;
|
|
| 12 |
|
|
| 13 |
/**
|
|
| 14 |
* @author Laurent Etiemble
|
|
| 15 |
* @version $Revision: 1.8 $
|
|
| 16 |
*/
|
|
| 17 |
public class TableModelMatchFilter extends TableModelFilter |
|
| 18 |
{
|
|
| 19 |
/** Description of the Field */
|
|
| 20 |
protected ArrayList tempIndexes = new ArrayList(); |
|
| 21 |
|
|
| 22 |
|
|
| 23 |
/**
|
|
| 24 |
* Constructor for TableModelMatchFilter.
|
|
| 25 |
*
|
|
| 26 |
* @param model
|
|
| 27 |
*/
|
|
| 28 | 0 |
public TableModelMatchFilter(TableModel model)
|
| 29 |
{
|
|
| 30 | 0 |
super(model);
|
| 31 |
} |
|
| 32 |
|
|
| 33 |
|
|
| 34 |
/** */
|
|
| 35 | 0 |
public synchronized void filter() |
| 36 |
{
|
|
| 37 | 0 |
this.tempIndexes.clear();
|
| 38 | 0 |
int rows = this.model.getRowCount(); |
| 39 |
|
|
| 40 | 0 |
if (this.column < 0) |
| 41 |
{
|
|
| 42 | 0 |
for (int row = 0; row < rows; row++) |
| 43 |
{
|
|
| 44 | 0 |
this.tempIndexes.add(new Integer(row)); |
| 45 |
} |
|
| 46 |
} |
|
| 47 |
else
|
|
| 48 |
{
|
|
| 49 | 0 |
for (int row = 0; row < rows; row++) |
| 50 |
{
|
|
| 51 | 0 |
Object value = model.getValueAt(row, column); |
| 52 | 0 |
for (int i = 0; i < values.length; i++) |
| 53 |
{
|
|
| 54 | 0 |
if (values[i].equals(value))
|
| 55 |
{
|
|
| 56 | 0 |
tempIndexes.add(new Integer(row));
|
| 57 |
} |
|
| 58 |
} |
|
| 59 |
} |
|
| 60 |
} |
|
| 61 |
|
|
| 62 | 0 |
this.indexes = new int[this.tempIndexes.size()]; |
| 63 | 0 |
for (int i = 0; i < this.indexes.length; i++) |
| 64 |
{
|
|
| 65 | 0 |
this.indexes[i] = ((Integer) this.tempIndexes.get(i)).intValue(); |
| 66 |
} |
|
| 67 |
} |
|
| 68 |
} |
|
| 69 |
|
|
||||||||||