VirtualListView
Virtualized presentation of large item sets as a responsive grid or list.
When to use
Use VirtualListView when a collection contains hundreds or thousands of similar entries. The factory creates only visible items and a small overscan; ordinary forms are better built with VBox or LinearBox.
Layout and StylePack
The viewport respects layoutStyle().padding(), rowGap(), and columnGap(). The same parameters can be configured through StyleKeys.VIRTUAL_LIST_* in a StylePack.
Responsive grid
VirtualListView view = new VirtualListView()
.viewMode(VirtualListView.ViewMode.GRID)
.gridCellWidth(120.0f)
.gridCellHeight(144.0f)
.itemCount(entries.size())
.itemFactory(index -> createEntryCard(entries.get(index)));
view.layout(style -> style
.padding(12.0f)
.columnGap(8.0f)
.rowGap(12.0f));
API
VirtualListView::itemFactory(IntFunction)
Item factory
Sets the factory that creates a UI widget for an item index.
| Parameter | Type | Description |
|---|---|---|
itemFactory |
IntFunction |
Function from item index to Widget; null restores the default Label factory. |
Returns VirtualListView: this VirtualListView for fluent configuration.