gluonhq / scenebuilder

Scene Builder is a visual, drag 'n' drop, layout tool for designing JavaFX application user interfaces.
https://gluonhq.com/products/scene-builder/
Other
728 stars 218 forks source link

Custom component shows additional properties in Custom section #698

Open heySourabh opened 1 month ago

heySourabh commented 1 month ago

The custom component shows the "Focus Visible", "Focus Within", "View Order" and other undefined properties under Custom section. This creates unnecessary clutter when working with custom components.

Expected Behavior

The Custom section must only show properties relevant to the Custom component.

Current Behavior

Additional properties from parent component are shown ( see screenshots below ).

Steps to Reproduce

Here is a very simple wireframe of custom component for testing:

import javafx.beans.property.StringProperty;
import javafx.beans.property.StringPropertyBase;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;

public class Card extends VBox {

    public Card() {
        getChildren().add(new Label("Card Test"));
    }

    private StringProperty title;

    public void setTitle(String title) {
        titleProperty().set(title);
    }

    public String getTitle() {
        return title == null ? "Title" : title.get();
    }

    public StringProperty titleProperty() {
        if(title == null) {
            title = new StringPropertyBase("Title") {
                @Override
                public Object getBean() {
                    return Card.this;
                }

                @Override
                public String getName() {
                    return "title";
                }
            };
        }
        return title;
    }
}

Compiling and loading this class file shows the attached properties panel, with additional properties from the parent classes. The only property which must be shown here is Title. scene-builder-properties

The striked-out properties must not be shown for this test custom component. scene-builder-properties (bug)

Your Environment (taken from About Scene Builder menu)

Product Version JavaFX Scene Builder 22.0.0

Build Information Version 22.0.0 Date: 2024-03-22 16:11:53 JavaFX Version: 22 Java Version: 22, OpenJDK Runtime Environment

Operating System Linux, amd64, 5.4.0-192-generic

Screenshots

Attached above.

Oliver-Loeffler commented 3 weeks ago

This might be related to #701 and #702.