Interface FilteredModel.Refresher<T>

Type Parameters:
T - the row type
All Known Implementing Classes:
AbstractFilteredModelRefresher, FilteredModel.AbstractRefresher
Enclosing interface:
FilteredModel<T>

public static interface FilteredModel.Refresher<T>
Handles refreshing data for a FilteredModel.
  • 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 State controlling whether asynchronous refreshing is enabled
      See Also:
    • itemSupplier

      Value<Supplier<Collection<T>>> itemSupplier()
      Returns:
      a Value controlling the item supplier for this refresher instance
    • refresh

      void refresh()
      Refreshes the items in the associated filtered model. Note that this method only throws exceptions when run synchronously.
      Throws:
      RuntimeException - in case of an exception when running synchronously.
      See Also:
    • refreshThen

      void refreshThen(Consumer<Collection<T>> afterRefresh)
      Refreshes the data in this model. Note that this method only throws exceptions when run synchronously. Use refreshFailedEvent() 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

      StateObserver observer()
      Returns:
      an observer active while a refresh is in progress
    • refreshEvent

      EventObserver<?> refreshEvent()
      Returns:
      an observer notified each time this model has been successfully refreshed
      See Also:
    • refreshFailedEvent

      EventObserver<Throwable> refreshFailedEvent()
      Returns:
      an observer notified each time an asynchronous refresh has failed
      See Also: