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

Extending the demo application with data objects #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FDelporte
Copy link

@msgilligan just a proposal to show the use of injection in a JavaFX application

@msgilligan
Copy link
Member

msgilligan commented Feb 10, 2021

Hey, thanks @FDelporte! The first real PR for Supernaut!

I like your general idea, and I would like to create a sample that is more full-fledged than what is currently in this repo. If you look in the main SupernautFX repository, you'll see that there are two sample apps and a test app. I put them in that repo for testing purposes -- so I can do a full build on single repository/Gradle multi project and make sure everything compiles, and links, and runs. But I also realize that having the projects in a Gradle multi-project makes them less accessible for people wanting to use the framework or looking for a template/starter project.

supernaut-fx-sample-hello:

  • App injection -- main class with start(FxMainView mainView)
  • Controller injection via FxmlLoaderFactory
  • Service injection
  • @Factory annotation to instantiate beans whose classes are not annotated (e.g. String or objects from libraries)
  • BrowserService (wrapper for HostServices::showDocument) demonstration

supernaut-fx-sample-minimal:

  • Single-file app for minimalism/simplicity
  • App injection -- main class with start(FxMainView mainView)

supernaut-fx-testapp:

  • Command-line options for stopping the application (both gracefully and abruptly)
  • Timing measurements
  • Not really intended as a sample or starter app but for testing

Maven/Gradle standalone repositories samples

  • Based on supernaut-fx-sample-minimal
  • Single-file app for minimalism/simplicity
  • App injection -- main class implements FxForegroundApp.FxApplicationCompat with start(Stage stage)
  • BrowserService used a injected object in app class
  • Use of BrowserService commented out in Maven sample because HostServices::showDocument doesn't work with Graal native-image (because showDocument uses something unsupported in AWT)

My goals for the current Maven/Gradle standalone repositories sample:

  • To either replace or be somehow synchonized with the "minimal" sample app in the main repository
  • To have the same source code in the Gradle and Maven versions (perhaps synchronized automatically somehow)
  • To be used a template or starter project. I was going to take a look at the Github "template repository" feature to see if it might be useful. (I also thought about but rejected for now the idea of a start.supernaut.app project generator page.

Other, related goals:

  • Create an AsciiDoc User's Guide that better documents the framework/library and references one or more sample apps.
  • Consider a Kotlin sample app and/or test Kotlin apps in the main build

I like that your changes inject a JavaFX model object (DataObject) and what I would call a service object (SystemInfo) and use a timer to dynamically update a property.

With all this background info, I have two specific pieces of feedback on your PR:

  1. I think these changes belong in the more full-featured sample app not the "minimal" one.
  2. I would like to see the changes in both the Maven and Gradle samples which means we should decide on a mechanism for keeping them synchronized.

What are you thoughts on any or all of these issues?

@FDelporte
Copy link
Author

FDelporte commented Feb 10, 2021

thanks @msgilligan that's a whole lot of info! :-)
you should look at my PR as a "this is something I need and I used this project to test it out"
I will fork the main project and look into it regarding the GraalVM build issues but not sure if I can help a lot there. But at least I will learn again some new stuff ;-)

@msgilligan
Copy link
Member

Thanks, @FDelporte !

@msgilligan
Copy link
Member

msgilligan commented Oct 1, 2021

@FDelporte I'm thinking that it might be cool to add an "about this app" Model object to Supernaut.FX itself -- probably initially in the app.supernaut.fx module, but perhaps later moved to an "FX components" library.

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