Subscribe

  • Subscribe  

Integrate JavaFX with Spring Rich Client Project

Posted by Charles | February 27, 2008 .

If you claim to be a Java developer then you must know Spring Framework. If you know something about Spring Framework then you must heard of Spring Rich Client Project, which is to “provide an elegant way to build highly-configurable, GUI-standards-following rich-client applications faster by leveraging the Spring Framework, and a rich library of UI factories and support classes.” Besides those, I’d wish you’ve heard a thing or two about JavaFX too, which is Sun’s own attempt to have a space in the RIA world. Then how about integrate JavaFX into Spring RCP to create custom GUI?

There is a module spring-richclient-jdk6 created just for that.

In that module, there is ScriptedView that uses a script to render its contents. The JavaFX script can be created as:

  <bean id="fxView" class="org.springframework.richclient.
               application.support.DefaultViewDescriptor">
    <property name="viewClass" value="org.springframework.
                        richclient.script.ScriptedView" />
    <property name="viewProperties">
      <map>
        <entry key="script" value="classpath:/path/to/script.fx" />
      </map>
    </property>
  </bean>

According to the author:

In your script, you can have a reference to the view and to the view’s container. The view’s container is a JPanel that’s passed into the script, on which you can put your components. Look at the “containerBindingName” and “viewBindingName” properties of ScriptedView. (Note that for javafx, the binding name must something like this: container:JComponent)

In the same way, not only JavaFX, bot also Groovy, javaScript and other script languages supported by JEE 6 ScriptEngine are also supported. For details go to http://spring-rich-c.sourceforge.net…epository.html.

Leave a Comment

If you would like to make a comment, please fill out the form below.


Name

Email

Website

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Comments

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word


Related Posts

1 Comment so far
  1. Matt Ryan  April 28, 2008 2:40 am

    Great post!

    I’ve been working with Spring for some time and just recently started to play with JavaFX, but it totally slipped my mind the topic of their combined usage.

    Gave me something more to think about. Thx

<

Direct TV Offers - usdirect has the best directtv deals