uk.ac.starlink.hapi

## Class FilterListModel<T>

- java.lang.Object
- - javax.swing.AbstractListModel<T>
  - - uk.ac.starlink.hapi.FilterListModel<T>

- All Implemented Interfaces:
    java.io.Serializable, javax.swing.ListModel<T>

      public class FilterListModel<T>
      extends javax.swing.AbstractListModel<T>

  ListModel that allows filtering the content by matching to the content of a text field.
  Since:
    16 Jan 2024
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class javax.swing.AbstractListModel

      `listenerList`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilterListModel()` Default constructor.
    `FilterListModel(java.lang.String title, java.util.function.BiPredicate<T,java.lang.String> matcher)` Constructor with custom list element matching.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `getElementAt(int i)`
    `javax.swing.JTextField` | `getFilterField()` Returns the text field used for filtering.
    `javax.swing.JComponent` | `getFilterPanel()` Returns a panel containing the text field and some surrounding components.
    `int` | `getSize()`
    `void` | `setItems(java.util.List<T> items)` Sets the unfiltered content of this model.

    - ### Methods inherited from class javax.swing.AbstractListModel

      `addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FilterListModel

          public FilterListModel()

      Default constructor.

    - #### FilterListModel

          public FilterListModel(java.lang.String title,
                                 java.util.function.BiPredicate<T,java.lang.String> matcher)

      Constructor with custom list element matching.
      Parameters:
        `title` - title text
        `matcher` - indicates whether a list element is to be included given string content of this model's text field

  - ### Method Detail

    - #### setItems

          public void setItems(java.util.List<T> items)

      Sets the unfiltered content of this model.
      Parameters:
        `items` - list items

    - #### getFilterField

          public javax.swing.JTextField getFilterField()

      Returns the text field used for filtering.
      Returns:
        text field

    - #### getFilterPanel

          public javax.swing.JComponent getFilterPanel()

      Returns a panel containing the text field and some surrounding components.

    - #### getSize

          public int getSize()

    - #### getElementAt

          public T getElementAt(int i)