Guice with JavaFX

1,053 views
Skip to first unread message

Arthur Gregório

unread,
Feb 25, 2013, 6:58:39 PM2/25/13
to google...@googlegroups.com
hi!

Someone can tell me if there is any implementation or some guice plugin to use it with java fx?

i've seen a couple of "tests" in some blogs but the publish date of the post is so old (before january 2012)..

is there anything new to do the integration work?


at.,

Arthur P. Gregório
+55 45 9958-0302
@gregorioarthur
www.arthurgregorio.eti.br

Stephan Classen

unread,
Feb 26, 2013, 2:24:10 AM2/26/13
to google...@googlegroups.com
I just started using JavaFX last week and have not yet combined it with guice.
But as far as I can tell most of the JavaFX classes have a default constructor and should therefore be easely injectable.

What exactly are you trying to inject and do you plan on using a mocking framework to inject mocks for tests?
--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Arthur Gregório

unread,
Feb 26, 2013, 6:42:58 AM2/26/13
to google...@googlegroups.com
need to develop a desktop application but did not want to use swing ... Following the classical model'll need a persistence layer (JPA), services and controllers ..

in both links would be an example of such integration but do not know how it would look on an application with more layers wondered if someone already implemented something more complex or just know if there is something to help (plugin) this process ...



Arthur P. Gregório
+55 45 9958-0302
@gregorioarthur
www.arthurgregorio.eti.br


2013/2/26 Stephan Classen <st.cl...@gmx.ch>

Arthur Gregório

unread,
Apr 19, 2013, 7:29:51 AM4/19/13
to google...@googlegroups.com
uhmmm! today i use swing with guice.. i found some difficulties when i try to use then with jfx application

btw

seems to be a good opportunity to give another chance to jfx

thanks for the response!


at.,

Arthur P. Gregório
+55 45 9958-0302
@gregorioarthur
www.arthurgregorio.eti.br


2013/4/19 Benjamin P. Jung <head...@gmail.com>
Hi Arthur,

I am the author of "fx-guice" which should make it really easy to use Google Guice in your JavaFX applications.
The framework itself is licensed using the Apache License v2 and the sources can be downloaded from Github:

I also published the artifact to the Sonatype OSS Maven repository, so it should be really easy to fetch pre-built JARs (especially if you are using a Maven-based build system).

The Wiki page of the project hosts a bunch of examples (even though I feel that the code is self-explanatory... but... hey! I AM the author! ;-))
The sources itself also come with an "examples" folder that contains a bunch of code snippets to get you started.

The main idea of my framework:

(1)
Extend "com.cathive.fx.guice.GuiceApplication" instead of "javax.application.Application".

(2)
You will then have perform your Guice module initialization in your app's #init(List<Module>) method.

(3)
Instead of the basic FXMLLoader you'll have to use @injected instances of the GuiceFXMLLoader class.
Then you can use @FXML and @Inject annotations together in your FXMLController classes.

(4)
The framework offers a bunch of other nice stuff, such as the @FxApplicationThread annotations that
ensures execution of your methods on JavaFX's event dispatch thread via method interceptors and
evil AOP magic.


Benjamin

John Nader

unread,
Oct 11, 2013, 7:20:56 AM10/11/13
to google...@googlegroups.com
I've been using fx-guice for about 6 months now and find it very useful.  It has even been enhanced to support mocking of the loader for unit testing code that depends on FXML without having to load the views.  I'd recommend it.


On Friday, April 19, 2013 5:02:57 AM UTC-4, Benjamin P. Jung wrote:
Hi Arthur,

I am the author of "fx-guice" which should make it really easy to use Google Guice in your JavaFX applications.
The framework itself is licensed using the Apache License v2 and the sources can be downloaded from Github:

I also published the artifact to the Sonatype OSS Maven repository, so it should be really easy to fetch pre-built JARs (especially if you are using a Maven-based build system).

The Wiki page of the project hosts a bunch of examples (even though I feel that the code is self-explanatory... but... hey! I AM the author! ;-))
The sources itself also come with an "examples" folder that contains a bunch of code snippets to get you started.

The main idea of my framework:

(1)
Extend "com.cathive.fx.guice.GuiceApplication" instead of "javax.application.Application".

(2)
You will then have perform your Guice module initialization in your app's #init(List<Module>) method.

(3)
Instead of the basic FXMLLoader you'll have to use @injected instances of the GuiceFXMLLoader class.
Then you can use @FXML and @Inject annotations together in your FXMLController classes.

(4)
The framework offers a bunch of other nice stuff, such as the @FxApplicationThread annotations that
ensures execution of your methods on JavaFX's event dispatch thread via method interceptors and
evil AOP magic.


Benjamin


On Tuesday, February 26, 2013 12:42:58 PM UTC+1, Arthur Gregório wrote:
Reply all
Reply to author
Forward
0 new messages