Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PopOver has infinite layout passes when adding line border with title #1538

Closed
jperedadnr opened this issue Jan 31, 2024 · 0 comments · Fixed by #1539
Closed

PopOver has infinite layout passes when adding line border with title #1538

jperedadnr opened this issue Jan 31, 2024 · 0 comments · Fixed by #1539

Comments

@jperedadnr
Copy link
Collaborator

jperedadnr commented Jan 31, 2024

Run the following simple test case with current ControlsFX 11.2.0 and JavaFX 21.0.2:

import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.controlsfx.control.PopOver;
import org.controlsfx.tools.Borders;

public class PopOverTest extends Application {

    @Override
    public void start(final Stage primaryStage) {
        final Button button = new Button("Button");
        final StackPane root = new StackPane(button);
        button.setOnAction(e -> {
            final PopOver popOver = new PopOver();
            StackPane pane = new StackPane(new Label("Text"));
            Node node = Borders.wrap(pane).lineBorder()
                    .buildAll();
            ((Pane) node).needsLayoutProperty().addListener((obs, ov, nv) -> System.out.println("needs layout = " + nv));
            popOver.setContentNode(node);
            popOver.show(root);
        });
        Scene scene = new Scene(root, 200, 100);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

Click on the button to show the popOver control and see the output:

image
needs layout = false
needs layout = true
needs layout = false

That's it (as expected).

Now add a title to the border:

            Node node = Borders.wrap(pane).lineBorder()
                     .title("Title")
                    .buildAll();

run again:

image

and check the output:

needs layout = false
needs layout = true
needs layout = false
needs layout = true
needs layout = false
needs layout = true
needs layout = false
needs layout = true
needs layout = false
needs layout = true
...

it doesn't stop while the popup is showing up.

(This can be reproduced on all platforms)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant