DataList renders only the visible slice of its backing collection while the full record set remains searchable, selectable, and incrementally mutable.
It works with rendered rows such as DataListItem and CheckableDataListItem, wraps each record as a VirtualItem, and delegates window management to ScrollingWindowList and VirtualScrollPanel.
V
the record type represented by the list
I
the rendered row type used for visible items
AbstractDataListItem participates in the package virtualization infrastructure, so instances are created only for the records that are currently visible in the window.
It provides the shared clickable row structure, prefix and postfix slots, value storage, search hooks, and selection wiring to the backing VirtualItem.
V
the value type represented by the row
C
the concrete row subtype used for fluent APIs
DataListItem builds on AbstractDataListItem by rendering a simple text span for the record and exposing hooks for custom clickable behavior.
V
the value type represented by the row
CheckableDataListItem extends DataListItem by rendering a checkbox in the prefix area and keeping it synchronized with the associated VirtualItem.
V
the value type represented by the row
DataFilter lets DataList and AbstractDataSelect ask whether a record matches a search token without forcing the full collection to be rendered.
T
the record type being filtered
Each VirtualItem lazily owns the rendered window item for the current viewport while keeping selection state, metadata, and key resolution attached to the underlying record.
This lets DataList and DataSelect track selection even when a row is currently outside the rendered window.
T
the wrapped record type
I
the rendered window item type
ScrollingWindowList decides which records should currently be realized as rendered window items, fires enter and exit callbacks, and supports incremental add and remove operations.
It is the core list engine behind VirtualScrollPanel and, by extension, DataList.
T
the record type in the backing list
I
the rendered window item type
VirtualScrollItemMapper converts a backing record into the rendered WindowItem that should appear inside the current viewport.
This abstraction is shared by DataList, DataSelect, and the lower-level virtual scroll infrastructure.
T
the record type to map
I
the rendered window item type
VirtualScrollPanel measures row height, maintains synchronized scroll containers, computes the active record window, and reuses DOM nodes so only the needed slice of a large list is rendered.
DataList uses this panel to keep list interactions responsive even with very large data sets.
T
the record type represented by the panel
E
the DOM element type used by rendered items
I
the rendered window item type
C
the concrete panel subtype
public static DataList<V, I> create(VirtualScrollItemMapper<V, I> mapper, KeyProvider<V> keyProvider)
mapper
maps each record into its rendered list item
keyProvider
resolves stable keys for record lookup and selection
V
the record type
I
the rendered row type
a new DataList instance
public DataList<V, I> setItems(List<V> items)
items
the records to expose through the list
this DataList instance
public DataList<V, I> setSearchable(DataFilter<V> dataFilter)
dataFilter
the search predicate to apply for each record, or null to disable searching
this DataList instance
public List<I> getWindowItems()
the list items currently materialized in the viewport
public Optional<I> findOptionStarsWith(String token)
token
the prefix to match against visible rows
the first matching rendered row, if one is currently in the window
public DataList<V, I> selectAll(boolean silent)
silent
true to suppress selection listener callbacks while selecting
this DataList instance
public DataList<V, I> deselectAll(boolean silent)
silent
true to suppress deselection listener callbacks while clearing
this DataList instance
public VirtualScrollListVirtualScroll<V, I> getVirtualScrollPanel()
the virtual scroll panel used by this list
public void AbstractDataListItem(V value)
value
the record represented by this row
public C setSearchable(boolean searchable)
searchable
true when this row should participate in search matching
the current row instance
public boolean onSearch(String token, boolean caseSensitive)
token
the current search token
caseSensitive
whether search comparisons should preserve case
public C select(boolean silent)
silent
true to avoid notifying listeners while selecting
the current row instance
public C deselect(boolean silent)
silent
true to avoid notifying listeners while deselecting
the current row instance
public C setSelectable(boolean selectable)
selectable
true when selection is allowed for this row
the current row instance
public C withBodyElement(ChildHandler<C, DivElement> handler)
handler
receives the row and its body element for customization
the current row instance
public void DataListItem(String text, V value)
text
the text displayed inside the row body
value
the record represented by the row
public static DataListItem<V> create(String text, V value)
text
the text displayed inside the row body
value
the record represented by the row
V
the value type represented by the row
a new DataListItem instance
public DataListItem<V> withClickableElement(ChildHandler<DataListItem<V>, AnchorElement> handler)
handler
receives the row and its clickable anchor element
the current DataListItem instance
public SpanElement getTextElement()
the text element for this row, or null when no text was supplied
public void CheckableDataListItem(String text, V value)
text
the text displayed inside the row body
value
the record represented by the row
public static CheckableDataListItem<V> create(String text, V value)
text
the text displayed inside the row body
value
the record represented by the row
V
the value type represented by the row
a new CheckableDataListItem instance
public void onSelectionChanged(boolean selection)
selection
the current selected state for the row
public void setVirtualItem(VirtualItem<V, DataListItem<V>> virtualItem)
virtualItem
the virtual item that owns this rendered row
public boolean onSearch(T record, String token, boolean caseSensitive)
record
the record being tested
token
the current user-entered search token
caseSensitive
whether the match should preserve case
public void VirtualItem(T record, VirtualScrollItemMapper<T, I> mapper, KeyProvider<T> keyProvider)
record
the underlying record
mapper
creates the rendered window item when needed
keyProvider
resolves stable keys for the wrapped record
public VirtualItem<T, I> select(boolean silent)
silent
true to suppress selection listeners
public VirtualItem<T, I> deselect(boolean silent)
silent
true to suppress deselection listeners
public I windowItem()
the rendered window item for the current record
public T getRecord()
the record associated with this virtual item
public VirtualItem<T, I> setSelectable(boolean selectable)
selectable
true when the record should be selectable
public String getKey()
the key that identifies this virtual item
public void ScrollingWindowList(VirtualScrollItemMapper<T, I> mapper, KeyProvider<T> keyProvider, ScrollingListWindowListener<T, I> listener)
mapper
maps records into rendered window items
keyProvider
resolves stable keys for the backing records
listener
receives enter, exit, add, and remove notifications
public void setList(List<T> list, int windowSize)
list
the full backing record collection
windowSize
the number of records to keep inside the active window
public ListWindow<T, I> getWindow()
the current visible window of rendered items
public void scroll(int offset)
offset
the number of records to move the window by
public void add(T item, int index)
item
the record to insert
index
the insertion position in the backing list
public void remove(int startIndex, int numberOfItems)
startIndex
the first index to remove
numberOfItems
how many records to remove
public List<VirtualItem<T, I>> getAll()
all virtual items, not just the visible subset
public I map(T record)
record
the record to render
public void VirtualScrollPanel(VirtualScrollItemMapper<T, I> mapper, KeyProvider<T> keyProvider)
ScrollingWindowList.
mapper
maps records into rendered items
keyProvider
resolves stable keys for the records in the viewport
public C setItems(List<T> items)
items
the full record collection to virtualize
public C updateItems(List<VirtualItem<T, I>> items)
items
the virtual items that should back the current viewport
public C addOnListReadyListener(Consumer<C> listener)
listener
the callback to invoke once the list is ready
public C withBodyElement(ChildHandler<C, DivElement> handler)
handler
receives the panel and its body element
public ScrollingWindowList<T, I> getWindowList()
the backing ScrollingWindowList instance
public int getItemHeight()
the item height in pixels