Module is.codion.common.model
Interface FilterTableModel.Builder<R,C>
- Type Parameters:
R- the row typeC- the column identifier type
- Enclosing interface:
FilterTableModel<R,C>
public static interface FilterTableModel.Builder<R,C>
A builder for a
FilterTableModel.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides aFilterTableModel.Builderinstance -
Method Summary
Modifier and TypeMethodDescriptionbuild()filters(Supplier<Map<C, ConditionModel<?>>> filters) items(Supplier<Collection<R>> items) listener(FilterModel.IncludedItems.ItemsListener itemsListener) Adds anFilterModel.IncludedItems.ItemsListenernotified of fine-grained changes to the included items, allowing toolkit layers to bridge to their table change notifications (e.g.onIndexesSelected(Consumer<List<Integer>> indexes) onIndexSelected(Consumer<Integer> index) onItemSelected(Consumer<R> item) onItemsSelected(Consumer<List<R>> items) onRefreshException(Consumer<Exception> onRefreshException) By default, exceptions during refresh are rethrown, use this method to handle async exceptions differentlyonSelectionChanged(Runnable listener) refresh(boolean refresh) selection(Function<FilterModel.IncludedItems<R>, MultiSelection<R>> selection) Provides theMultiSelectionfor this model, given itsFilterModel.IncludedItems.Items failing validation can not be added to the model.
-
Method Details
-
filters
- Parameters:
filters- the column filter model factory- Returns:
- this builder instance
-
items
- Parameters:
items- supplies the items- Returns:
- this builder instance
-
validator
Items failing validation can not be added to the model.- Parameters:
validator- the item validator- Returns:
- this builder instance
-
onRefreshException
By default, exceptions during refresh are rethrown, use this method to handle async exceptions differently- Parameters:
onRefreshException- the exception handler to use during refresh- Returns:
- this builder instance
-
included
- Parameters:
included- thePredicatecontrolling which items should be included- Returns:
- this builder instance
-
refresh
- Parameters:
refresh- true if the model items should be refreshed on initialization, false by default- Returns:
- this builder instance
-
onSelectionChanged
- Parameters:
listener- the selection listener- Returns:
- this builder instance
-
onItemSelected
- Parameters:
item- receives the selected item- Returns:
- this builder instance
-
onItemsSelected
- Parameters:
items- receives the selected items- Returns:
- this builder instance
-
onIndexSelected
- Parameters:
index- receives the selected index- Returns:
- this builder instance
-
onIndexesSelected
- Parameters:
indexes- receives the selected indexes- Returns:
- this builder instance
-
selection
FilterTableModel.Builder<R,C> selection(Function<FilterModel.IncludedItems<R>, MultiSelection<R>> selection) Provides theMultiSelectionfor this model, given itsFilterModel.IncludedItems. The default is the pure-JavaMultiSelection.multiSelection(MultiSelection.IndexedItems); the Swing layer plugs ajavax.swing.ListSelectionModelbased one.- Parameters:
selection- the selection factory- Returns:
- this builder instance
-
listener
Adds anFilterModel.IncludedItems.ItemsListenernotified of fine-grained changes to the included items, allowing toolkit layers to bridge to their table change notifications (e.g.TableModelEvents).- Parameters:
itemsListener- theFilterModel.IncludedItems.ItemsListenerto add- Returns:
- this builder instance
-
build
FilterTableModel<R,C> build()- Returns:
- a new
FilterTableModelinstance.
-