Module is.codion.common.model
Package is.codion.common.model.filter
Interface FilterModel.Refresher<T>
- Type Parameters:
T- the type of items produced by thisFilterModel.Refresher
- All Known Implementing Classes:
AbstractRefreshWorker,FilterModel.AbstractRefresher
- Enclosing interface:
FilterModel<T>
public static interface FilterModel.Refresher<T>
Handles refreshing data for a
FilterModel.-
Method Summary
Modifier and TypeMethodDescriptionactive()Changes to this state are always triggered on the UI thread.async()Sometimes we'd like to be able to refresh one or more models and perform some action on the refreshed data, after the refresh has finished, such as selecting a particular item or such.voidrefresh(@Nullable Consumer<Collection<T>> onResult) Refreshes the data.result()This event is always triggered on the UI thread.
-
Method Details
-
async
State async()Sometimes we'd like to be able to refresh one or more models and perform some action on the refreshed data, after the refresh has finished, such as selecting a particular item or such. This is quite difficult to achieve with asynchronous refresh enabled, so here's a way to temporarily disable asynchronous refresh, for a more predictable behaviour.- Returns:
- the
Statecontrolling whether asynchronous refreshing is enabled - See Also:
-
active
ObservableState active()Changes to this state are always triggered on the UI thread.
- Returns:
- an observable indicating that a refresh is in progress
-
result
Observer<Collection<T>> result()This event is always triggered on the UI thread.
- Returns:
- an observer notified with the result after a successful refresh
-
refresh
Refreshes the data. Async refresh is performed when it is enabled (
async()) and this method is called on the UI thread.- Parameters:
onResult- called on the EDT with the result after a successful refresh, may be null- See Also:
-