[jfx19] RFR: 8290348: TreeTableView jumping to top [v2]

Johan Vos jvos at openjdk.org
Tue Jul 19 08:47:02 UTC 2022


On Sun, 17 Jul 2022 18:59:22 GMT, Johan Vos <jvos at openjdk.org> wrote:

>> Do not recalculate total estimated size recursively.
>> 
>> In the (unlikely) event that the recalculation triggers a new recalculation (e.g. when the height of a Cell is changed), do not start this recalculation.
>> The cache and cache size may become inconsistent if a recursive calculation is started.
>> This fixes JDK-8290348
>
> Johan Vos has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fix issue with IDE-indicated unused statement

> 
I'll make the test more deterministic.
FWIW, the following UI code allows to reproduce the failure (and fix) easier, but it is UI-based and has a Thread.sleep() so I won't add this in a unit test.
(the generateChildren method is the same as in the unit test)


        TreeItem<String> root = new TreeItem<>("Root Node");
        root.setExpanded(true);
        root.getChildren().addAll(generateChildren(1));

        TreeView<String> treeView = new TreeView<>(root);

        treeView.scrollTo(100);
        Thread t = new Thread() {
            @Override public void run() {
                try {
                    Thread.sleep(3000);
                    Platform.runLater(() -> {
                        root.getChildren().get(1).setExpanded(false);
                    });
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
        t.start();
        Scene scene = new Scene(treeView, 640, 480);
        stage.setScene(scene);
        stage.show();

-------------

PR: https://git.openjdk.org/jfx/pull/836


More information about the openjfx-dev mailing list