什么是“虚拟化控件"??(在 JavaFX 文档中提到). [英] what are "virtualized controls" ? (mentioned in JavaFX documentation).

查看:19
本文介绍了什么是“虚拟化控件"??(在 JavaFX 文档中提到).的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Cell API 用于虚拟化控件,例如 ListView、TreeView 和 TableView.Cell 是带标签的控件,用于在 ListView、TreeView 中呈现单个行"或 TableView."

"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."

为什么要虚拟化?

推荐答案

当您有大量数据要显示在 Control(例如 ListView)中时,您需要某种虚拟化创建和使用的 Nodes 的方法.否则会影响内存占用,进而影响时间.

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.

例如,如果您有 1000 万个数据项,您不想创建 1000 万个节点.因此,您创建了足够多的节点来动态填充显示,并在用户滚动 ListView 控件时重复使用它们.

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.

来自文档:

因为TreeView、ListView、TableView等控件可以可能用于显示大量数据,为每个项目创建一个实际的 Cell 是不可行的控制.我们仅使用非常大的数据集表示几个细胞.每个 Cell 都被回收"或重新使用.这就是我们的意思当我们说这些控件是虚拟化的.

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 : 每个框架都有这种虚拟化,无论是 Android、WPF、JavaFX 等等.

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

来自 JavaFX 的一位开发人员:http://fxexperience.com/2009/09/ui-virtualization/

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

这篇关于什么是“虚拟化控件"??(在 JavaFX 文档中提到).的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆