Cljfx-flowless is an idiomatic wrapper of Flowless library — an efficient virtual flow implementation similar to list view.
See latest version of io.github.vlaaad/cljfx-flowless
on Clojars.
cljfx/flowless requires Java 11.
A minimal code to try it out:
(require '[cljfx.api :as fx]
'[cljfx.flowless :as fx.flowless])
(fx/on-fx-thread
(fx/create-component
{:fx/type :stage
:showing true
:scene {:fx/type :scene
:root {:fx/type fx.flowless/virtualized-scroll-pane ;; add scroll bars
:content {:fx/type fx.flowless/virtual-flow
:cell-factory identity
:items (for [i (range 1000)]
{:fx/type :label :text (str i)})}}}}))
This lifecycle defines a VirtualFlow.
Supported props:
:items
- list of any objects.:cell-factory
- a function that converts item to cljfx description of any node that will display the item. Required, can't be changed.:orientation
- either:vertical
(default) or:horizontal
.:gravity
- either:front
(default) or:rear
, defines alignment of cell when they don't fill the whole view.- other region props
This lifecycle defines a node that wraps VirtualFlow pane and shows it with scroll bars. Supported props:
:content
(required) - component description that defines a VirtualFlow instance. Can't be changed.:hbar-policy
and:vbar-policy
- scroll bar policies, either:never
,:always
or:as-needed
(default).- other region props.