Interface FilterModel.IncludedItems<T>

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

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

    • get

      @NonNull List<T> get()
      Specified by:
      get in interface Observable<T>
      Returns:
      the included items or an empty list if all items are filtered
    • predicate

      Returns:
      the FilterModel.IncludedPredicate controlling which items should be included
    • 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 included
      Parameters:
      item - the item
      Returns:
      true if the item is included
    • indexOf

      int indexOf(T item)
      Parameters:
      item - the item
      Returns:
      the index of the item in this model, -1 if it is not included
    • 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 included 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 included 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 included 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 included 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 included 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 included 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
    • size

      int size()
      Returns:
      the number of included items
    • sort

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