Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.filter
Class ListTableFilter

java.lang.Object
  extended by com.sciapp.filter.TableFilter
      extended by com.sciapp.filter.ListTableFilter
All Implemented Interfaces:
Serializable

public class ListTableFilter
extends TableFilter

A table filter for filtering the rows of a TableModel based on a list of row indexes. The list of rows that are accepted are passed in the constructor or can be manipulated later on with the addIndex(int), removeIndex(int), setAcceptedIndexes(int[]) and clear() methods.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sciapp.filter.TableFilter
ALL_COLUMNS, column, filter
 
Constructor Summary
ListTableFilter()
          Constructs a ListTableFilter.
ListTableFilter(int[] acceptedIndexes)
          Constructs a ListTableFilter.
 
Method Summary
 void addIndex(int index)
          Adds a row index to the list of accepted indexes.
 void clear()
          Clears all row indexes, therefore blocking all rows.
 boolean filter(ListTableModel model, Object row)
          This method will throw an UnsupportedOperationException since the row index cannot be evaluated from the supplied parameters.
 boolean filter(TableModel model, int rowIndex)
          Decides whether a particular row of a JTable will be filtered.
 int[] getAcceptedIndexes()
          Retrieves the row indexes that this table filter will allow.
 void removeIndex(int index)
          Removes a row index from the list of accepted indexes.
 void setAcceptedIndexes(int[] acceptedIndexes)
          Assigns the row indexes that this table filter will allow.
 
Methods inherited from class com.sciapp.filter.TableFilter
getColumn, getFilter, setColumn, setFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListTableFilter

public ListTableFilter()
Constructs a ListTableFilter.


ListTableFilter

public ListTableFilter(int[] acceptedIndexes)
Constructs a ListTableFilter.

Method Detail

addIndex

public void addIndex(int index)
Adds a row index to the list of accepted indexes.

Parameters:
index - a row index that is accepted when filtering.

clear

public void clear()
Clears all row indexes, therefore blocking all rows.


filter

public boolean filter(ListTableModel model,
                      Object row)
This method will throw an UnsupportedOperationException since the row index cannot be evaluated from the supplied parameters. Decides whether a particular row of a JTable will be filtered. An alternative to this method is filter(TableModel m, int rowIndex).

Overrides:
filter in class TableFilter
Parameters:
model - the ListTableModel that holds a reference to the tabular row data
row - the row of the table to filter, represented as an object
Returns:
true if the row is to be filtered, false otherwise

filter

public boolean filter(TableModel model,
                      int rowIndex)
Decides whether a particular row of a JTable will be filtered. This method is presented as an alternative to filter(ListTableModel ltm, Object o).

Overrides:
filter in class TableFilter
Parameters:
model - the TableModel that holds the unfiltered row data
rowIndex - the index of the row of the table to filter
Returns:
true if the row is to be filtered, false otherwise

getAcceptedIndexes

public int[] getAcceptedIndexes()
Retrieves the row indexes that this table filter will allow.

Returns:
an array of row indexes that this table filter will allow while filtering

removeIndex

public void removeIndex(int index)
Removes a row index from the list of accepted indexes.

Parameters:
index - the row index to remove. The associated row will be blocked.

setAcceptedIndexes

public void setAcceptedIndexes(int[] acceptedIndexes)
Assigns the row indexes that this table filter will allow.

Parameters:
acceptedIndexes - an array of row indexes that this table filter will allow while filtering

Copyright © 2005 Scientific Applications. All Rights Reserved.