1 7 package org.ejtools.swing.table; 8 9 import java.util.ArrayList ; 10 11 import javax.swing.table.TableModel ; 12 13 17 public class TableModelMatchFilter extends TableModelFilter 18 { 19 20 protected ArrayList tempIndexes = new ArrayList (); 21 22 23 28 public TableModelMatchFilter(TableModel model) 29 { 30 super(model); 31 } 32 33 34 35 public synchronized void filter() 36 { 37 this.tempIndexes.clear(); 38 int rows = this.model.getRowCount(); 39 40 if (this.column < 0) 41 { 42 for (int row = 0; row < rows; row++) 43 { 44 this.tempIndexes.add(new Integer (row)); 45 } 46 } 47 else 48 { 49 for (int row = 0; row < rows; row++) 50 { 51 Object value = model.getValueAt(row, column); 52 for (int i = 0; i < values.length; i++) 53 { 54 if (values[i].equals(value)) 55 { 56 tempIndexes.add(new Integer (row)); 57 } 58 } 59 } 60 } 61 62 this.indexes = new int[this.tempIndexes.size()]; 63 for (int i = 0; i < this.indexes.length; i++) 64 { 65 this.indexes[i] = ((Integer ) this.tempIndexes.get(i)).intValue(); 66 } 67 } 68 } 69 | Popular Tags |