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

Create renderers lazily #65

Merged

Conversation

crschnick
Copy link
Contributor

I'm using PreferencesFX in my application and I'm very happy with it. However, it is a special kind of application that should also be able to work without any GUI support, i.e. it should still work when the JavaFX platform can't be initialized. One major hurdle for that is that the PreferencesFX renderers are are created instantly when creating the field, even though they don't have to.
This instant initialization forces a platform initialization, which fails on headless systems and causes the preferences to not be loaded.

This PR delays the renderer instantiation until it is actually needed. Obviously, this is only a basic pull request meant to get some feedback. If a change of that form would be actually accepted, I would augment this PR to also support the normal renderer initialization such that the interface is fully compatible with previous versions of FormsFX and also create a similar PreferencesFX PR.

@dlemmermann
Copy link
Collaborator

This looks perfectly good and valid to me. As you stated, for backwards compatibility we need to support both approaches. Once that is there I will gladly approve the PR. Same for PreferencesFX.

@crschnick
Copy link
Contributor Author

Alright, this should be able to be merged as it maintains backward compatibility now. I will open the matching PR for PreferencesFX soon.

@dlemmermann dlemmermann merged commit 490975f into dlsc-software-consulting-gmbh:master-11 Jan 23, 2023
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 this pull request may close these issues.

2 participants