- Type Parameters:
T- the row type
- All Known Implementing Classes:
FilterModel.AbstractRefresher
- Enclosing interface:
- FilterModel<T>
public static interface FilterModel.Refresher<T>
Handles refreshing data for a
FilterModel.-
Method Summary
Modifier and TypeMethodDescriptionis.codion.common.state.Stateasync()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.is.codion.common.value.Value<Supplier<Collection<T>>>items()is.codion.common.state.StateObserverobserver()voidrefresh()Refreshes the items in the associated filter model.is.codion.common.event.EventObserver<?>is.codion.common.event.EventObserver<Exception>voidrefreshThen(Consumer<Collection<T>> afterRefresh) Refreshes the data in this model.
-
Method Details
-
async
is.codion.common.state.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 State controlling whether asynchronous refreshing is enabled
- See Also:
-
items
is.codion.common.value.Value<Supplier<Collection<T>>> items()- Returns:
- a Value controlling the item supplier for this refresher instance
-
refresh
void refresh()Refreshes the items in the associated filter model. Note that this method only throws exceptions when run synchronously.- Throws:
RuntimeException- in case of an exception when running synchronously.- See Also:
-
refreshThen
Refreshes the data in this model. Note that this method only throws exceptions when run synchronously. UserefreshFailedEvent()to listen for exceptions that happen during asynchronous refresh.- Parameters:
afterRefresh- called after a successful refresh, may be null- Throws:
RuntimeException- in case of an exception when running synchronously.- See Also:
-
observer
is.codion.common.state.StateObserver observer()- Returns:
- an observer active while a refresh is in progress
-
refreshEvent
is.codion.common.event.EventObserver<?> refreshEvent()- Returns:
- an observer notified each time this model has been successfully refreshed
- See Also:
-
refreshFailedEvent
is.codion.common.event.EventObserver<Exception> refreshFailedEvent()- Returns:
- an observer notified each time an asynchronous refresh has failed
- See Also:
-