Interface FilterModel.VisibleItems<T>

Type Parameters:
T - the item type
All Superinterfaces:
Observable<List<T>>, Observer<List<T>>
Enclosing interface:
FilterModel<T>

public static interface FilterModel.VisibleItems<T> extends Observable<List<T>>
  • Method Details

    • get

      @NonNull List<T> get()
      Specified by:
      get in interface Observable<T>
      Returns:
      the visible items or an empty list if no item is visible
    • predicate

      Returns:
      the FilterModel.VisiblePredicate controlling which items should be visible
    • added

      Observer<Collection<T>> added()
      Returns:
      an Observer notified when items have been added
    • selection

      SingleSelection<T> selection()
      Returns:
      the SingleSelection instance for these items
    • contains

      boolean contains(T item)
      Returns true if the given item is visible
      Parameters:
      item - the item
      Returns:
      true if the item is visible
    • indexOf

      int indexOf(T item)
      Parameters:
      item - the item
      Returns:
      the index of the item in this model, -1 if it is not visible
    • get

      T get(int index)
      Parameters:
      index - the row index
      Returns:
      the item at the given index in this model
      Throws:
      IndexOutOfBoundsException - in case the index is out of bounds
    • add

      boolean add(int index, T item)

      Adds the given item at the given index and sorts the visible items if sorting is enabled.

      Note that if the item does not pass the predicate() it is filtered right away and the method returns false.

      Parameters:
      index - the index
      item - the item to add
      Returns:
      true if the item was added to the visible items
      Throws:
      IndexOutOfBoundsException - in case the index is out of bounds
    • add

      boolean add(int index, Collection<T> items)

      Adds the given items at the given index and sorts the visible items if sorting is enabled.

      Note that if an item does not pass the predicate() it is filtered right away.

      Parameters:
      index - the index at which to add the items
      items - the items to add
      Returns:
      true if one or more of the items was added to the visible items
      Throws:
      IndexOutOfBoundsException - in case the index is out of bounds
    • set

      boolean set(int index, T item)

      Sets the item at the given index. Note that sorting is NOT performed after the item has been set.

      Note that if the item does not pass the predicate() this method has no effect.

      Parameters:
      index - the index
      item - the item
      Returns:
      true if the item was set, false if it did not pass the predicate()
      Throws:
      IndexOutOfBoundsException - in case the index is out of bounds
      See Also:
    • remove

      T remove(int index)

      Removes from this model the visible element at the given index

      Parameters:
      index - the index of the row to be removed
      Returns:
      the removed item
      Throws:
      IndexOutOfBoundsException - in case the index is out of bounds
    • remove

      List<T> remove(int fromIndex, int toIndex)

      Removes from this model all visible elements whose index is between fromIndex, inclusive and toIndex, exclusive

      Parameters:
      fromIndex - index of first row to be removed
      toIndex - index after last row to be removed
      Returns:
      the removed items
      Throws:
      IndexOutOfBoundsException - in case the indexes are out of bounds
    • count

      int count()
      Returns:
      the number of visible items
    • sort

      void sort()
      Sorts the visible items using this FilterModel.Sort instance, preserving the selection.
      See Also: