- Type Parameters:
T- the item type
- All Known Subinterfaces:
FilterComboBoxModel.ComboBoxItems<T>
- Enclosing interface:
FilterModel<T>
FilterModel.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Collection<T> items) Adds the given items to this model.voidAdds the given item to this model.builder()voidclear()Clears the itemsbooleanReturns true if the model contain the given item, as included or filtered.voidfilter()Filters the items according to theFilterModel.IncludedItems.predicate().filtered()get()included()voidrefresh()Refreshes the data in this model using itsFilterModel.Refresher.voidrefresh(Consumer<Collection<T>> onResult) Refreshes the data in this model using itsFilterModel.Refresher.voidremove(Collection<T> items) Removes the given items from this model.voidRemoves the items fulfilling the given predicate from this model.voidRemoves the given item from this model.voidReplaces the given map keys with their respective values.voidReplaces the first occurrence of the given item.voidset(Collection<T> items) It is up to the implementation whether the included items are sorted when the items are set.intsize()
-
Method Details
-
refresher
FilterModel.Refresher<T> refresher()- Returns:
- this models
FilterModel.Refresherinstance
-
refresh
void refresh()Refreshes the data in this model using its
FilterModel.Refresher.
Retains the selection and filtering. Sorts the refreshed data.- See Also:
-
refresh
Refreshes the data in this model using its
FilterModel.Refresher.
Retains the selection and filtering. Sorts the refreshed data.- Parameters:
onResult- called on the EDT after a successful refresh- See Also:
-
get
Collection<T> get()- Returns:
- all items, included and filtered, in no particular order
-
set
It is up to the implementation whether the included items are sorted when the items are set.- Parameters:
items- the items
-
add
Adds the given item to this model.
If the item passes the
FilterModel.IncludedItems.predicate()it is appended to the included items, which are then sorted if sorting is enabled.If the item does not pass the
FilterModel.IncludedItems.predicate(), it will be filtered right away.- Parameters:
item- the item to add
-
add
Adds the given items to this model.
Items that pass the
FilterModel.IncludedItems.predicate()are is appended to the included items, which are then sorted if sorting is enabled.If no items pass the
FilterModel.IncludedItems.predicate(), they will be filtered right away.- Parameters:
items- the items to add
-
remove
Removes the given item from this model.
- Parameters:
item- the item to remove from the model
-
remove
Removes the given items from this model.
- Parameters:
items- the items to remove from the model
-
remove
Removes the items fulfilling the given predicate from this model.
- Parameters:
predicate- thePredicatespecifying the items to remove from the model
-
replace
Replaces the first occurrence of the given item. If the item is not found this method has no effect.
Note that this method respects the include predicate, so a currently filtered item may be replaced with an included item and vice verse.
If the included items change they are sorted if sorting is enabled.
- Parameters:
item- the item to replacereplacement- the replacement item- See Also:
-
replace
Replaces the given map keys with their respective values.
Note that this method respects the include predicate, so a currently filtered item may be replaced with an included item and vice verse.
If the included items change they are sorted if sorting is enabled.
- Parameters:
replacements-
-
clear
void clear()Clears the items -
included
FilterModel.IncludedItems<T> included()- Returns:
- a
FilterModel.IncludedItemsproviding access to the included items, in the order they appear in the model
-
filtered
FilterModel.FilteredItems<T> filtered()- Returns:
- a
FilterModel.FilteredItemsproviding access to the filtered items
-
contains
Returns true if the model contain the given item, as included or filtered.- Parameters:
item- the item- Returns:
- true if this model contains the item
-
size
int size()- Returns:
- the total number of items, included and filtered
-
filter
void filter()Filters the items according to the
FilterModel.IncludedItems.predicate().If no predicate is specified calling this method has no effect.
This method does not interfere with the internal ordering of the included items.
- See Also:
-
builder
- Returns:
- a new
FilterModel.Items.Builder.RefresherStepinstance
-