Interface FilteredModel<T>

Type Parameters:
T - the type of data in the model.
All Known Subinterfaces:
EntityTableModel<E>, FilteredTableModel<R,C>
All Known Implementing Classes:
EntityComboBoxModel, FilteredComboBoxModel, ItemComboBoxModel, SwingEntityTableModel

public interface FilteredModel<T>
Specifies a data model that can be filtered to hide some or all of the items it contains.
  • Field Details

  • Method Details

    • filterItems

      void filterItems()
      Filters this model according to the condition specified by includeCondition(). If no include condition is specified this method does nothing. This method does not interfere with the internal ordering of the visible items.
      See Also:
    • includeCondition

      Value<Predicate<T>> includeCondition()
      Returns:
      the include condition value
    • items

      Collection<T> items()
      Returns:
      an unmodifiable view of all visible and filtered items in this model
      See Also:
    • visibleItems

      List<T> visibleItems()
      Returns:
      an unmodifiable view of the visible items, in the order they appear in the model
    • filteredItems

      Collection<T> filteredItems()
      Returns:
      an unmodifiable view of the filtered items
    • visibleCount

      int visibleCount()
      Returns:
      the number of currently visible items
    • filteredCount

      int filteredCount()
      Returns:
      the number of currently filtered items
    • containsItem

      boolean containsItem(T item)
      Returns true if this model contains the given item, visible or filtered.
      Parameters:
      item - the item
      Returns:
      true if this model contains the item
    • visible

      boolean visible(T item)
      Returns true if this model contains the given item, and it is visible, that is, not filtered
      Parameters:
      item - the item
      Returns:
      true if the given item is visible
    • filtered

      boolean filtered(T item)
      Returns true if this model contains the given item, and it is filtered, that is, is not visible
      Parameters:
      item - the item
      Returns:
      true if the given item is filtered
    • refresher

      Returns:
      this models Refresher instance
    • refresh

      void refresh()
      Refreshes the items in this filtered model using its FilteredModel.Refresher.
      Throws:
      RuntimeException - in case of an exception when running refresh synchronously, as in, not on the user interface thread
      See Also:
    • refreshThen

      void refreshThen(Consumer<Collection<T>> afterRefresh)
      Refreshes the data in this filtered model using its FilteredModel.Refresher. Note that this method only throws exceptions when run synchronously off the user interface thread. Use FilteredModel.Refresher.refreshFailedEvent() to listen for exceptions that happen during asynchronous refresh.
      Parameters:
      afterRefresh - called after a successful refresh, may be null
      See Also: