Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
492 views
in Technique[技术] by (71.8m points)

listview - what are "virtualized controls" ? (mentioned in JavaFX documentation).

from http://docs.oracle.com/javafx/2/api/javafx/scene/control/Cell.html :

"The Cell API is used for virtualized controls such as ListView, TreeView, and TableView. A Cell is a Labeled Control, and is used to render a single "row" inside a ListView, TreeView or TableView."

Why are they virtualized?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When you have a lot of data to display in a Control such as a ListView, you need some way of virtualizing the Nodes created and used. Otherwise it will affect the memory footprint and consequently the time.

For example, if you have 10 million data items, you don’t want to create 10 million Nodes. So you create enough Nodes to fill the display dynamically and reuse them as the user scrolls through the ListView control.

From documentation:

Because TreeView, ListView, TableView and other such controls can potentially be used for displaying incredibly large amounts of data, it is not feasible to create an actual Cell for every single item in the control. We represent extremely large data sets using only very few Cells. Each Cell is "recycled", or reused. This is what we mean when we say that these controls are virtualized.

P.S : every framework has this kind of virtualization, be it Android, WPF , JavaFX etc.

From one of the developers of JavaFX: http://fxexperience.com/2009/09/ui-virtualization/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...