- java.lang.Object
-
- org.controlsfx.control.table.TableFilter<T>
-
- Type Parameters:
T
-
public final class TableFilter<T> extends Object
Applies a filtering control to a providedTableView
instance. The filter will be applied immediately on construction, and can be made visible by right-clicking the desired column to filter on.
Features
-Convenient filter control holds a checklist of distinct items to include/exclude, much like an Excel filter.
-New/removed records will be captured by the filter control and reflect new or removed values from checklist. -Filters on more than one column are combined to only display mutually inclusive records on the client's TableView.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TableFilter.Builder<T>
A Builder for a TableFilter against a specified TableView
-
Constructor Summary
Constructors Constructor Description TableFilter(TableView<T> tableView)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executeFilter()
static <T> TableFilter.Builder<T>
forTableView(TableView<T> tableView)
Returns a TableFilter.Builder to configure a TableFilter on the specified TableView.ObservableList<T>
getBackingList()
Returns the backingObservableList
originally provided to the constructor.Optional<ColumnFilter<T,?>>
getColumnFilter(TableColumn<T,?> tableColumn)
ObservableList<ColumnFilter<T,?>>
getColumnFilters()
FilteredList<T>
getFilteredList()
Returns theFilteredList
used by this TableFilter and is backing theTableView
.boolean
isDirty()
void
resetAllFilters()
void
resetFilter()
void
selectAllValues(TableColumn<?,?> column)
Programmatically selects all values for the specified TableColumnvoid
selectValue(TableColumn<?,?> column, Object value)
Programmatically selects value for the specified TableColumnvoid
setSearchStrategy(BiPredicate<String,String> searchStrategy)
Allows specifying a different behavior for the search box on the TableFilter.void
unSelectAllValues(TableColumn<?,?> column)
Programmatically unselect all values for the specified TableColumnvoid
unselectValue(TableColumn<?,?> column, Object value)
Programmatically unselects value for the specified TableColumn
-
-
-
Constructor Detail
-
TableFilter
@Deprecated public TableFilter(TableView<T> tableView)
Deprecated.Use TableFilter.forTableView() factory and leverage Builder
-
-
Method Detail
-
setSearchStrategy
public void setSearchStrategy(BiPredicate<String,String> searchStrategy)
Allows specifying a different behavior for the search box on the TableFilter. By default, the contains() method on a String is used to evaluate the search box input to qualify the distinct filter values. But you can specify a different behavior by providing a simple BiPredicate argument to this method. The BiPredicate argument allows you take the input value and target value and use a lambda to evaluate a boolean. For instance, you can implement a comparison by assuming the input value is a regular expression, and call matches() on the target value to see if it aligns to the pattern.- Parameters:
searchStrategy
-
-
getBackingList
public ObservableList<T> getBackingList()
Returns the backingObservableList
originally provided to the constructor.- Returns:
- ObservableList
-
getFilteredList
public FilteredList<T> getFilteredList()
Returns theFilteredList
used by this TableFilter and is backing theTableView
.- Returns:
- FilteredList
-
selectValue
public void selectValue(TableColumn<?,?> column, Object value)
Programmatically selects value for the specified TableColumn
-
unselectValue
public void unselectValue(TableColumn<?,?> column, Object value)
Programmatically unselects value for the specified TableColumn
-
selectAllValues
public void selectAllValues(TableColumn<?,?> column)
Programmatically selects all values for the specified TableColumn
-
unSelectAllValues
public void unSelectAllValues(TableColumn<?,?> column)
Programmatically unselect all values for the specified TableColumn
-
executeFilter
public void executeFilter()
-
resetFilter
public void resetFilter()
-
resetAllFilters
public void resetAllFilters()
-
getColumnFilters
public ObservableList<ColumnFilter<T,?>> getColumnFilters()
-
getColumnFilter
public Optional<ColumnFilter<T,?>> getColumnFilter(TableColumn<T,?> tableColumn)
-
isDirty
public boolean isDirty()
-
forTableView
public static <T> TableFilter.Builder<T> forTableView(TableView<T> tableView)
Returns a TableFilter.Builder to configure a TableFilter on the specified TableView. Call apply() to initialize and return the TableFilter- Type Parameters:
T
-- Parameters:
tableView
-
-
-