https://github.com/cljfx/flowless
Cljfx wrapper of https://github.com/FXMisc/Flowless
https://github.com/cljfx/flowless
Last synced: 9 months ago
JSON representation
Cljfx wrapper of https://github.com/FXMisc/Flowless
- Host: GitHub
- URL: https://github.com/cljfx/flowless
- Owner: cljfx
- License: mit
- Created: 2022-06-22T12:43:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-25T09:25:42.000Z (over 2 years ago)
- Last Synced: 2024-02-28T02:23:40.878Z (almost 2 years ago)
- Language: Clojure
- Homepage:
- Size: 6.84 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://clojars.org/io.github.vlaaad/cljfx-flowless)
# cljfx-flowless
Cljfx-flowless is an idiomatic wrapper of [Flowless](https://github.com/FXMisc/Flowless)
library — an efficient virtual flow implementation similar to list view.
# Installation
See latest version of `io.github.vlaaad/cljfx-flowless` on [Clojars](https://clojars.org/io.github.vlaaad/cljfx-flowless).
# Requirements
cljfx/flowless requires Java 11.
# Usage
A minimal code to try it out:
```clojure
(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)})}}}}))
```
# Documentation
## virtual-flow
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
## virtualized-scroll-pane
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.