All Projects → FXMisc → Flowless

FXMisc / Flowless

Licence: bsd-2-clause
Efficient VirtualFlow for JavaFX

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Flowless

Musicott
JavaFX application that manages and plays music files.
Stars: ✭ 97 (-19.17%)
Mutual labels:  javafx
Gitpic
利用github做图床的小工具
Stars: ✭ 107 (-10.83%)
Mutual labels:  javafx
Open Lowcode
Solution for rapid development of specific enterprise software
Stars: ✭ 116 (-3.33%)
Mutual labels:  javafx
Lipi
A simple static blog generator.
Stars: ✭ 100 (-16.67%)
Mutual labels:  javafx
Coco
The fastest crypto online
Stars: ✭ 103 (-14.17%)
Mutual labels:  javafx
Kissui.scrollanim
CSS3 scroll animation library
Stars: ✭ 1,442 (+1101.67%)
Mutual labels:  viewport
React Fit To Viewport
Stars: ✭ 92 (-23.33%)
Mutual labels:  viewport
Binjr
A Time Series Data Browser
Stars: ✭ 119 (-0.83%)
Mutual labels:  javafx
Asciidocfx
Asciidoc Editor and Toolchain written with JavaFX 16 (Build PDF, Epub, Mobi and HTML books, documents and slides)
Stars: ✭ 1,533 (+1177.5%)
Mutual labels:  javafx
Isonscreen
Simple jQuery plugin to determine if an element is within the viewport
Stars: ✭ 115 (-4.17%)
Mutual labels:  viewport
Easyfxml
A collection of tools and libraries for easier development on the JavaFX platform!
Stars: ✭ 102 (-15%)
Mutual labels:  javafx
Snail
基于Java、JavaFX开发的下载工具,支持下载协议:BT(BitTorrent、磁力链接、种子文件)、HLS(M3U8)、FTP、HTTP。人家才不要你的⭐⭐呢,哼
Stars: ✭ 102 (-15%)
Mutual labels:  javafx
Pdfsam
PDFsam, a desktop application to extract pages, split, merge, mix and rotate PDF files
Stars: ✭ 1,829 (+1424.17%)
Mutual labels:  javafx
Caption ocr tool
视频硬字幕提取工具
Stars: ✭ 98 (-18.33%)
Mutual labels:  javafx
Preact Scroll Viewport
Preact Component that renders homogeneous children only when visible
Stars: ✭ 118 (-1.67%)
Mutual labels:  viewport
Cssfx
Allow runtime modification of JavaFX CSS
Stars: ✭ 95 (-20.83%)
Mutual labels:  javafx
Logfx
LogFX is a simple Log reader supporting color highlighting and able to handle giant files.
Stars: ✭ 109 (-9.17%)
Mutual labels:  javafx
Youtube Comment Suite
Download YouTube comments from numerous videos, playlists, and channels for archiving, general search, and showing activity.
Stars: ✭ 120 (+0%)
Mutual labels:  javafx
Binding.scala
Reactive data-binding for Scala
Stars: ✭ 1,539 (+1182.5%)
Mutual labels:  javafx
Jgnash
jGnash Personal Finance
Stars: ✭ 112 (-6.67%)
Mutual labels:  javafx

Flowless

Efficient VirtualFlow for JavaFX. VirtualFlow is a layout container that lays out cells in a vertical or horizontal flow. The main feature of a virtual flow is that only the currently visible cells are rendered in the scene. You may have a list of thousands of items, but only, say, 30 cells are rendered at any given time.

JavaFX has its own VirtualFlow, which is not part of the public API, but is used, for example, in the implementation of ListView. It is, however, not very efficient when updating the viewport on items change or scroll.

Here is a comparison of JavaFX's ListView vs. Flowless on a list of 80 items, 25 of which fit into the viewport.

Flowless (# of cell creations / # of cell layouts) JDK 8u40 ListView (# of updateItem calls / # of cell layouts) JDK 8u40 ListView with fixed cell size (# of updateItem calls / # of cell layouts)
update an item in the viewport 1/1 1/1 1/1
update an item outside the viewport 0/0 0/0 0/0
delete an item in the middle of the viewport 1/1 38/25 38/25
add an item in the middle of the viewport 1/1 38/25 38/25
scroll 5 items down 5/5 5/5 5/5
scroll 50 items down 25/25 50/25 25/25

Here is the source code of this mini-benchmark.

Use case for Flowless

You will benefit from Flowless (compared to ListView) the most if you have many item updates and an expensive updateItem method.

Note, however, that Flowless is a low-level layout component and does not provide higher-level features like selection model or inline editing. One can, of course, implement those on top of Flowless.

Additional API

VirtualFlow in Flowless provides additional public API compared to ListView or VirtualFlow from JavaFX.

Direct cell access with getCell(itemIndex) and getCellIfVisible(itemIndex) methods. This is useful for measurement purposes.

List of currently visible cells via visibleCells().

Hit test with the hit(double x, double y) method that converts viewport coordinates into a cell index and coordinates relative to the cell, or indicates that the hit is before or beyond the cells.

Navigate to a subregion of a cell using the show(itemIndex, region) method. This is a finer grained navigation than just the show(itemIndex) method.

Scroll: scrollX(deltaX) and scrollY(deltaY) methods.

Gravity: You can create VirtualFlow where cells stick to the bottom (vertical flow) or right (horizontal flow) when there are not enough items to fill the viewport.

Conceptual differences from ListView

Dumb cells. This is the most important difference. For Flowless, cells are just Nodes and don't encapsulate any logic regarding virtual flow. A cell does not even necessarily store the index of the item it is displaying. This allows VirtualFlow to have complete control over when the cells are created and/or updated.

Cell reuse is opt-in, not forced. Cells are not reused by default. A new cell is created for each item. This simplifies cell implementation and does not impair performance if reusing a cell would be about as expensive as creating a new one (i.e. updateItem would be expensive).

No empty cells. There are no empty cells used to fill the viewport when there are too few items. A cell is either displaying an item, or is not displayed at all.

Assumptions about cells

As noted before, for the purposes of virtual flow in Flowless the cells are just Nodes. You are not forced to inherit from ListCell. However, they are expected to behave according to the following rules:

  • Cells of a vertical virtual flow should properly implement methods
    • computeMinWidth(-1)
    • computePrefWidth(-1)
    • computePrefHeight(width)
  • Cells of a horizontal virtual flow should properly implement methods
    • computeMinHeight(-1)
    • computePrefHeight(-1)
    • computePrefWidth(height)

Include Flowless in your project

Maven coordinates

Group ID Artifact ID Version
org.fxmisc.flowless flowless 0.6.3

Gradle example

dependencies {
    compile group: 'org.fxmisc.flowless', name: 'flowless', version: '0.6.3'
}

Sbt example

libraryDependencies += "org.fxmisc.flowless" % "flowless" % "0.6.3"

Manual download

Download the 0.6.3 jar and place it on your classpath.

Documentation

Javadoc

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].