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 void
addAll(Collection<T> items)
void
addElement(T element)
void
adjustmentValueChanged(AdjustmentEvent e)
void
clear()
void
clearSearch()
int
getAllSize()
T
getElementAt(int index)
protected String
getSearchText(T item)
Gets the text used for searching items.int
getSize()
List<T>
getVisibleItems()
int
getVisibleSize()
void
requestRedraw()
void
search(String text)
void
setNullSearchText(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:
getElementAt
in 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:
adjustmentValueChanged
in interfaceAdjustmentListener
-