Class LoadOnScrollListModel<T>

java.lang.Object
javax.swing.AbstractListModel<T>
com.illumon.iris.gui.list.LoadOnScrollListModel<T>
Type Parameters:
T - the data type
All Implemented Interfaces:
AdjustmentListener, Serializable, EventListener, ListModel<T>

public class LoadOnScrollListModel<T> extends AbstractListModel<T> implements AdjustmentListener
A model for a JList containing large amounts of data. Sets a Display Size so that only a small slice of the data is loaded at anyone time. Adjust data displayed on scroll. Supports text search.
See Also:
  • Constructor Details

    • LoadOnScrollListModel

      public LoadOnScrollListModel(int displaySize, JScrollBar scrollBar)
  • Method Details

    • getSize

      public int getSize()
      Specified by:
      getSize in interface ListModel<T>
    • getVisibleSize

      public int getVisibleSize()
    • getAllSize

      public int getAllSize()
    • getVisibleItems

      public List<T> getVisibleItems()
    • clear

      public void clear()
    • addAll

      public void addAll(Collection<T> items)
    • getElementAt

      public T getElementAt(int index)
      Specified by:
      getElementAt in interface ListModel<T>
    • addElement

      public void addElement(T element)
    • clearSearch

      public void clearSearch()
    • search

      public void search(String text)
    • getSearchText

      protected String getSearchText(T item)
      Gets the text used for searching items. Override this method for something other than toString().
      Parameters:
      item - the item to search
      Returns:
      the text to use for the search
    • setNullSearchText

      public void setNullSearchText(String text)
      Sets the text to be used to search on null values. By default this is an empty string.
      Parameters:
      text - the text to search for null values e.g. "null"
    • requestRedraw

      public void requestRedraw()
    • adjustmentValueChanged

      public void adjustmentValueChanged(AdjustmentEvent e)
      Specified by:
      adjustmentValueChanged in interface AdjustmentListener