quick.dbtable
Interface Filter


public interface Filter

Filters are used to filter out some rows from all the available rows based on a criteria.

  You can implement your complex criteria within the filter method and then just return an array
  of row numbers which are filtered

   a sample filter

   public class MyFilter implements Filter
   {
        public int[] filter(TableModel tm)
        {
          Vector v = new Vector();

          //finds all the records whose first column's data is "abc"
          for( int i=0; i< tm.getRowCount(); i++)
          {
             //checks whether the cell data in first column is "abc",
             //you don't have to use DBTable's compareObject method, you can compare using your own techniques
             if( DBTable.compareObject("abc", tm.getValueAt(i,1)) == DBTable.EQUALS )
                v.addElement(new Integer(i));
          }

          //create the final int array which has these filtered rows
          int arr[] = new int[v.size()];

          for(int i=0; i< v.size(); i++)
          {
            arr[i] = ((Integer)v.elementAt(i)).intValue();
          }

          return arr;
        }
  }

  //finally assign the filter to the quicktable
  yourDBTable.setFilter(new MyFilter());

  

See Also:
DBTable.filter(Filter), DBTable.filter(int,int, Object)

Method Summary
 int[] filter(javax.swing.table.TableModel tm)
          returns the int array of the rows which is filtered
 

Method Detail

filter

public int[] filter(javax.swing.table.TableModel tm)
returns the int array of the rows which is filtered

Parameters:
tm - the underlying table model which should be filtered
Returns:
the filtered int array