groovyfx-project / groovyfx

A library for writing JavaFX 8 applications in the Groovy language.
http://groovyfx.org
Apache License 2.0
199 stars 48 forks source link

GroovyFX Scripting Window #48

Closed msgilligan closed 3 years ago

msgilligan commented 8 years ago

This is a feature request.

I'm looking for a reusable, embeddable Groovy console window for scripting in my JavaFX app. What is the best starting point in all of Groovydom? Does it make sense to include something like that in this project?

aalmiray commented 8 years ago

I think it would be best to start another project, as an embeddable console requires additional dependencies such as a rich text editor (https://github.com/TomasMikula/RichTextFX), undo capabilities (https://github.com/TomasMikula/UndoFX), key bindings (https://github.com/TomasMikula/WellBehavedFX), and maybe even promises (https://github.com/jdeferred/jdeferred) to handle correctly threading.

msgilligan commented 8 years ago

Thanks @aalmiray for all the links and advice. I agree that it makes sense that a scripting window component be in a separate JAR because of the dependencies, it doesn't necessarily have to be in a separate repo, though.

I'm new to JavaFX (though I've been using Groovy for 10 years and Java longer than that) and it's been very frustrating searching around for what libraries to use in my project. I've been writing mostly in Java 8 because I wanted to start with the basics, but I want to start using some Groovy, too. I really want the GroovyFX property and binding support, for example. The other decidedly Groovy feature I want in my app is scripting and a DSL. I'm not that interested in the builder stuff, by the way -- I prefer to use SceneBuilder (and FXML)

As you know JavaFX is more of library than a framework and is un-opinionated about the structure of your app. So I'm looking around at various projects that I can use. I'm already using NSMenuFX because if I can't get proper Mac OS menus then JavaFX isn't a viable solution (I want to submit to Mac App Store, etc) and I'm looking at Adam Bien's Afterburner.FX because it looks like a lightweight solution to provide dependency injection and a little more structure, etc. Griffon looks really cool, but is not the correct fit for the type of App I'm building. TornadoFX from Kotlin looks interesting (another Kotlin temptation) but I want to stick with Groovy, I think.

I'm looking for one-stop shopping, I suppose. A place where I can get all the basics for a cross-platform app without choosing a heavyweight framework either. Clearly some of these pieces will be (non-Groovy) Java libraries, but since I want some Groovy in the app -- and the Groovy community is a great place that I feel comfortable in -- I'm looking to the Groovy community for best-practices.

So I guess what I'm saying is that it would be nice if GroovyFX were to provide add some optional, component modules. A scripting console is a big project (too big for me to start from scratch), but seems like a key component that highlights the advantages of Groovy. Maybe it could even replace the current (Swing-based, right?) Groovy Console someday. (Maybe I should just try to embed the current Swing console in my FX app?

I'd also like to see a great sample app that includes some lightweight pure Java libraries -- maybe Afterburner.FX (or equivalent) and NSMenuFX (or something else, if available) that can create correct Mac OS menus.

I think of the difference between Ratpack and Grails -- both of which are great projects and have their place -- and I'm looking for more of the Ratpack of FX. It seems like GroovyFX could become such a solution.

Sorry if this is a little rambling and off-topic, but I'm hoping some of the contributors here would appreciate a newbie's perspective. I'm willing to create additional issues here (or in another project) to pass this info along. Of course, I also just asked about the hard question about the Gradle FX plugin so maybe you guys are going to just ban me from the project haha.

russel commented 8 years ago

I suspect that maybe you want Griffon? http://griffon-framework.org/

msgilligan commented 8 years ago

Griffon looks a little too heavyweight for my application, but I'll take a second look.

aalmiray commented 8 years ago

We welcome all feedback and criticism on Griffon. The design of the framework is supposed to be modular, in order to avoid forcing a single path on the developer's mind. The smallest application possible (for the time being) weights ~4M due to Guice/Guava and can grow up to ~12M due to Groovy/GroovyFX. In terms of features you can override almost any portion of the framework. I'm really interested to know more about the requirements that would make Griffon be considered inadequate for this particular project. that's how we learn and make it better 😃

msgilligan commented 8 years ago

Hi @aalmiray I just spent some time looking at Griffon and also Basilisk. I have several applications in mind and I want reusable components that can be used in multiple applications. The GroovyFX console window would be desktop only, but other components would be used on mobile apps as well. I'm leaning away from using JavaFX on mobile and instead using native and Android and iOS UI. (I'm looking at Intel Multi-OS Engine for iOS, which would allow me to use Java-wrappers to create a native UI)

I would love to continue this conversation with you, but maybe on this particular issue thread? Where would be the best place to have that conversation?

msgilligan commented 8 years ago

If we were to make a JavaFX-based replacement for the current Groovy Swing Console, would you use Griffon?

I've also tried embedding the Swing Console in a JavaFX and the preliminary results aren't good. (Menus get all messed up on Mac OS) I'm wondering if there's a way to embed it using the SwingNode class from JavaFX.

aalmiray commented 8 years ago

I'd suggest starting a conversation at the Griffon mailing list (http://griffon-user.74797.x6.nabble.com/) would be best. Targeting both desktop and mobile (iOS & Android) using the same codebase is only possible if you choose JavaFX and the jfxmobile plugin form Gluon; this is exactly what Basilisk offers, plus all the goodies from Griffon.

Embedding Swing on a JavaFX produces mixed results. As you saw, menus are problematic, not to mention you must ensure both UI toolkits use the same UI thread, otherwise other problems will arise. In short, mixing Swing and JavaFx results in a bad development experience, let's not dwell into the user experience 😉

msgilligan commented 6 years ago

Hey @aalmiray I see you're working on this: https://twitter.com/aalmiray/status/1006996345243291649 That's awesome!

Is the work in a Github repo?

aalmiray commented 6 years ago

It's available at https://github.com/aalmiray/groovy-console-fx

msgilligan commented 3 years ago

Closing this issue. If you're looking for a GroovyFX Console window, please follow: https://github.com/aalmiray/groovy-console-fx

(Note: It would be nice if that project could make a re-usable component for the scripting window itself.)