Module is.codion.common.model
Interface FilterComboBoxModel.Builder<T>
- Type Parameters:
T- the item type
- Enclosing interface:
FilterComboBoxModel<T>
public static interface FilterComboBoxModel.Builder<T>
Builds a
FilterComboBoxModel-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuild()comparator(@Nullable Comparator<T> comparator) filterSelected(boolean filterSelected) Specifies whether filtering the model affects the currently selected item.includeNull(boolean includeNull) SetsincludeNull(boolean)to true ifnullItemis non-null, false otherwise.onRefreshException(Consumer<Exception> onRefreshException) By default, exceptions during refresh are rethrown, use this method to handle async exceptions differentlyonSelectedItem(Consumer<@Nullable T> item) refresh(boolean refresh) translator(Function<Object, T> translator) Provides a way for a combo box model to translate an item received viaSingleSelection.item()to an actual item to select, such as selecting the String "1" in a String based model when selected item is set to the Integer 1.
-
Method Details
-
comparator
- Parameters:
comparator- the comparator, null for unsorted- Returns:
- this builder
-
includeNull
- Parameters:
includeNull- true if a null item should be included- Returns:
- this builder
-
nullItem
SetsincludeNull(boolean)to true ifnullItemis non-null, false otherwise.- Parameters:
nullItem- the item representing null- Returns:
- this builder
-
select
- Parameters:
item- the item to select initially- Returns:
- this builder
-
translator
Provides a way for a combo box model to translate an item received viaSingleSelection.item()to an actual item to select, such as selecting the String "1" in a String based model when selected item is set to the Integer 1.- Parameters:
translator- the selected item translator- Returns:
- this builder
-
filterSelected
Specifies whether filtering the model affects the currently selected item. If true, the selection is cleared when the selected item is excluded from the model, otherwise the selected item can potentially represent a value which is not currently included in the model
- Parameters:
filterSelected- true if the selected item should be filtered, false by default- Returns:
- this builder instance
- See Also:
-
onSelectedItem
- Parameters:
item- receives the selected item, note that this item may be null- 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
-
refresh
- Parameters:
refresh- true if the model items should be refreshed on initialization, false by default- Returns:
- this builder instance
-
build
FilterComboBoxModel<T> build()- Returns:
- a new
FilterComboBoxModelinstance
-