T - the type of data table recordspublic class SearchContext<T> extends Object
| Constructor and Description |
|---|
SearchContext(DataTable<T> dataTable)
Initialize the context with a datatable
|
| Modifier and Type | Method and Description |
|---|---|
SearchContext |
add(Filter filter)
Adds a new filter to the search context
|
void |
addBeforeSearchHandler(Consumer<SearchContext<T>> handler)
Adds a new BeforeSearch handler
|
SearchContext |
clear()
Remove all filters and fires the
SearchClearedEvent |
boolean |
contains(Filter filter)
Checks if the context contains the specified filter
|
void |
fireSearchEvent()
Call all the before search handlers and then fire the
SearchEvent |
List<Filter> |
get(String fieldName) |
List<Filter> |
listAll() |
SearchContext |
remove(Filter filter)
Removes a filter from the context
|
SearchContext |
remove(String fieldName)
Removes all filters associated with the specified field name from the context
|
SearchContext |
remove(String fieldName,
Category category)
Removes all filters associated with the specified field name and of the specified category from
the context
|
void |
removeBeforeSearchHandler(Consumer<SearchContext<T>> handler)
removes a BeforeSearch handler
|
SearchContext |
removeByCategory(Category category)
Removes all filters of the specified category from the context
|
public SearchContext add(Filter filter)
filter - Filterpublic SearchContext remove(Filter filter)
filter - Filterpublic SearchContext remove(String fieldName)
fieldName - String field namepublic SearchContext remove(String fieldName, Category category)
fieldName - String field namecategory - Categorypublic SearchContext removeByCategory(Category category)
category - Categorypublic SearchContext clear()
SearchClearedEventpublic List<Filter> get(String fieldName)
fieldName - String field namepublic boolean contains(Filter filter)
filter - Filterpublic void fireSearchEvent()
SearchEventpublic void addBeforeSearchHandler(Consumer<SearchContext<T>> handler)
handler - Consumer of SearchContextpublic void removeBeforeSearchHandler(Consumer<SearchContext<T>> handler)
handler - Consumer of SearchContextCopyright © 2019–2022 Dominokit. All rights reserved.