RFR: 8328577: Toolbar's overflow button overlaps the items [v6]

eduardsdv duke at openjdk.org
Fri Apr 19 14:21:02 UTC 2024


On Mon, 15 Apr 2024 15:41:19 GMT, eduardsdv <duke at openjdk.org> wrote:

>> This change fixes the calculation of which nodes go to the toolbar and which go to the overflow menu.
>> It is now determined before the nodes are removed from the scene graph.
>> This is important because the values returned by ``Node.prefWidth(..)``/``Node.prefHeight(..)`` may depend on whether the node is added to the scene graph.
>> 
>> Furthermore I corrected the ``hasOveflow`` value passed to the ``organizeOverflow(double, boolean)`` in ``correctOverflow(double)``.
>
> eduardsdv has updated the pull request incrementally with one additional commit since the last revision:
> 
>   JDK-8328577: Refactor and fix binding of style related properties

So, none of them can be reproduced on windows, only on mac.

The #2 can be reproduced in the version before PR and after PR.

The #3 is reproducible only with PR changes and in my opinion an other bug in JavaFX, which is made to appear by this PR.

It can be quick-fixed by adding a ``Platform.runLater(..)`` into WINDO_HIDDEN event handler:

            popup.addEventHandler(WindowEvent.WINDOW_HIDDEN, e -> {
                // Quick-fix for MacOs:
                // If an item is selected in the overflow list and we select an item from the visible list,
                // selection in the overflow list remains on opening the overflow list for the first time but overflow icon becomes grey.
                // If we open overflow list again, selection will get removed.
                Platform.runLater(() -> {
                    // Put the overflowed items back to the list,
                    // otherwise subsequent prefWidth(..)/prefHeight(..) may return wrong values.
                    overflowItems.clear();
                    for (Node item : getSkinnable().getItems()) {
                        if (!box.getChildren().contains(item)) {
                            overflowItems.add(item);
                        }
                    }
                });
            });


What is your suggestion? Should it be **quick**-fixed in this PR or should a new issue be created for it?

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

PR Comment: https://git.openjdk.org/jfx/pull/1434#issuecomment-2066686657


More information about the openjfx-dev mailing list