Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.search
Class TableSearch

java.lang.Object
  extended by com.citra.table.search.TableSearch
All Implemented Interfaces:
Search

public class TableSearch
extends Object
implements Search

TableSearch searches through tables with the use of a Filter.


Field Summary
static int ALL_COLUMNS
          denotes all columns to be searched
static int COLUMN_MODE
          mode indicating that the search will take place in a horizontal direction (column)
protected  int defaultColumn
          the default column
protected  Filter filter
          The filter being used.
protected  int mode
          the search mode
static int ROW_MODE
          mode indicating that the search will take place in a vertical direction (row)
 
Constructor Summary
TableSearch(Filter filter)
          Constructs a TableSearch.
 
Method Summary
 int getDefaultColumn()
          Returns the default column to search upon or ALL_COLUMNS.
 Filter getFilter()
          Returns the associated filter.
 int getLastMatchingColumn()
          Returns the matched column from the last search.
 int getMode()
          Returns the current search mode.
 int search(TableModel model, Object searchValue, int fromRow, int fromColumn, boolean forward)
          Searches the table and returns the matching row or -1 if no match was found.
 void setDefaultColumn(int defaultColumn)
          Assigns the default column.
 void setFilter(Filter filter)
          Assigns the filter to be used when searching.
 void setMode(int mode)
          Assigns the search mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

protected Filter filter
The filter being used.


mode

protected int mode
the search mode


defaultColumn

protected int defaultColumn
the default column


ALL_COLUMNS

public static final int ALL_COLUMNS
denotes all columns to be searched

See Also:
Constant Field Values

ROW_MODE

public static final int ROW_MODE
mode indicating that the search will take place in a vertical direction (row)

See Also:
Constant Field Values

COLUMN_MODE

public static final int COLUMN_MODE
mode indicating that the search will take place in a horizontal direction (column)

See Also:
Constant Field Values
Constructor Detail

TableSearch

public TableSearch(Filter filter)
Constructs a TableSearch.

Method Detail

getDefaultColumn

public int getDefaultColumn()
Returns the default column to search upon or ALL_COLUMNS.

Returns:
the default column

getFilter

public Filter getFilter()
Returns the associated filter.

Returns:
the filter

getLastMatchingColumn

public int getLastMatchingColumn()
Returns the matched column from the last search.

Specified by:
getLastMatchingColumn in interface Search
Returns:
the matched column from the last search

getMode

public int getMode()
Returns the current search mode.

Returns:
the search mode

search

public int search(TableModel model,
                  Object searchValue,
                  int fromRow,
                  int fromColumn,
                  boolean forward)
Searches the table and returns the matching row or -1 if no match was found. The matching column can be retrieved with Search.getLastMatchingColumn().

Specified by:
search in interface Search
Parameters:
model - the table model to search
searchValue - the value to search for
fromRow - the search starting row
fromColumn - the search starting column
forward - the search direction
Returns:
the matching row or -1 if no match was found

setDefaultColumn

public void setDefaultColumn(int defaultColumn)
Assigns the default column.

Parameters:
defaultColumn - the default column to assign

setFilter

public void setFilter(Filter filter)
Assigns the filter to be used when searching.

Parameters:
filter - the filter to assign

setMode

public void setMode(int mode)
Assigns the search mode.

Parameters:
mode - the search mode to assign

Copyright © 2011 Citra Technologies. All Rights Reserved.