Package com.illumon.iris.gui.list
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:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LoadOnScrollListModel(int displaySize, JScrollBar scrollBar) -
Method Summary
Modifier and Type Method Description voidaddAll(Collection<T> items)voidaddElement(T element)voidadjustmentValueChanged(AdjustmentEvent e)voidclear()voidclearSearch()intgetAllSize()TgetElementAt(int index)protected StringgetSearchText(T item)Gets the text used for searching items.intgetSize()List<T>getVisibleItems()intgetVisibleSize()voidrequestRedraw()voidsearch(String text)voidsetNullSearchText(String text)Sets the text to be used to search on null values.Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
-
Constructor Details
-
Method Details
-
getSize
public int getSize() -
getVisibleSize
public int getVisibleSize() -
getAllSize
public int getAllSize() -
getVisibleItems
-
clear
public void clear() -
addAll
-
getElementAt
- Specified by:
getElementAtin interfaceListModel<T>
-
addElement
-
clearSearch
public void clearSearch() -
search
-
getSearchText
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
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
- Specified by:
adjustmentValueChangedin interfaceAdjustmentListener
-