[jfx20] RFR: 8290863: Update the documentation of Virtualized controls to include the best practice of not using Nodes directly in the item list [v3]
Nir Lisker
nlisker at openjdk.org
Fri Jan 20 14:47:58 UTC 2023
On Wed, 18 Jan 2023 09:25:08 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:
>> This PR adds a warning about inserting Nodes directly into the virtualized containers such as ListView, TreeView, TableView and TreeTableView. It also adds code snippets showing the recommended pattern of using a custom cell factory for each of the virtualized control.
>
> Ajit Ghaisas has updated the pull request incrementally with one additional commit since the last revision:
>
> Remove extra spaces
modules/javafx.controls/src/main/java/javafx/scene/control/ListView.java line 151:
> 149: *
> 150: * <h3>Warning: Nodes should not be inserted directly into the items list</h3>
> 151: * ListView allows for the items list to contain elements of any type, including
`ListView` should be in `@code`
modules/javafx.controls/src/main/java/javafx/scene/control/ListView.java line 152:
> 150: * <h3>Warning: Nodes should not be inserted directly into the items list</h3>
> 151: * ListView allows for the items list to contain elements of any type, including
> 152: * {@link Node} instances. Putting nodes into
`Node` is already linked above so there's no need for it, but it's fine to leave as is.
modules/javafx.controls/src/main/java/javafx/scene/control/ListView.java line 163:
> 161: * <li>Avoid creating new {@link Node}s in custom {@link #cellFactoryProperty() cell factory} {@code updateItem} method.</li>
> 162: * </ul>
> 163: * <p>The following minimal example shows how to create a custom cell factory for {@code ListView} containing {@link Node}s:
No need to link `Node` here again.
-------------
PR: https://git.openjdk.org/jfx/pull/995
More information about the openjfx-dev
mailing list