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

Custom Control question. #693

Open
xdsswar opened this issue Jun 17, 2024 · 3 comments
Open

Custom Control question. #693

xdsswar opened this issue Jun 17, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@xdsswar
Copy link

xdsswar commented Jun 17, 2024

``Hi, first thanks for taking the time to read my question.

I'm developing a new Java-fx custom control that will facilitate responsive UI design by having size breakpoints , similar to bootstrap or any other web css lib for responsive design. My question is :

How can I archive the same as the AnchorPane does with the static methods setTopAnchor, setLeftAnchor, etc, the constraints , and be able to load that in SceneBuilder in order to set the values for each Node inside it. My control have a similar approach to set properties for each child node independently, like col-span, col-offset, etc, but I'm unable to get that to work in SceneBuilder. The only way I was able to do that was by creating a Node Wrapper and declaring the properties inside that class, but that means adding another Node extra for each child and I don't wan that . If you guys use a specific way to do that and can point me in the right direction I will appreciate it . Thanks

Example of custom Node props:

/**
 * Column count for extra small screens.
 */
private static final String EXTRA_SMALL_COLS = "xs-cols";

/**
 * Sets the column span for extra small screens.
 *
 * @param node The node to set the column span on.
 * @param value The column span value.
 */
public static void setXsColSpan(Node node, Double value) {
    setConstraint(node, EXTRA_SMALL_COLS, value);
}

/**
 * Retrieves the column span for extra small screens.
 *
 * @param node The node to get the column span from.
 * @return The column span value.
 */
public static Integer getXsColSpan(Node node) {
    return (Integer) getConstraint(node, EXTRA_SMALL_COLS);
}
@xdsswar xdsswar added the enhancement New feature or request label Jun 17, 2024
@xdsswar
Copy link
Author

xdsswar commented Jun 18, 2024

Maybe using reflection I'm able to place the properties 😵

@Oliver-Loeffler
Copy link
Collaborator

Not sure yet how I would do that, but its a thing where I'll dive into.

@xdsswar
Copy link
Author

xdsswar commented Jun 21, 2024

I have this demo where you can see the layout in action and its properties

https://youtu.be/Mpv68iuaPCs

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

No branches or pull requests

2 participants