JavaFX and Spring CRUD

Exadel Flamingo RIA framework comes with CRUD application generator. Using the maven-based generator, you can easily generate JavaFX user interfaces connected to Spring or Seam back-ends. In this post I showed how to do it Seam. Let’s do the same with Spring framework. There are just a few simple steps.

  1. If you don’t have, download and install JavaFX SDK 1.2 for your operating system.
    1. Set JAVAFX_HOME variable
  2. Download Exadel Flamingo
  3. Unzip the downloaded file
  4. Run flamingoinstall (if you are on Linux, you will need to make the file executable)
  5. Inside flamingo/bin, run flamingo create project . Just follow the wizard questions, in most cases you can accept the default values. My answers are shown in bold.
     
max@:~/Exadel/Flamingo/flamingo-1.8.2$ ./bin/flamingo create project
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [com.exadel.flamingo.maven.plugin:flamingoapp:1.8.2:create-project] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[WARNING] While downloading jboss:javassist:3.3.ga
  This artifact has been relocated to javassist:javassist:3.3.GA.

[INFO] [flamingoapp:create-project]
discovered andromdapp type --> 'flamingo-seam'
discovered andromdapp type --> 'flamingo-spring'
Please choose the type of application to generate (flamingo-seam, flamingo-spring):[flamingo-spring]
flamingo-spring
Please enter the location in which your new application will be created (i.e. c:/java/development):
[/home/max/Exadel/Flamingo/dev]
/home/max/Exadel/Flamingo/dev
Enter the project name (e.g. myproject): [javafx-spring]
javafx-spring
Please enter the root package name for your project (e.g. com.mydomain.myproject): [com.sample]
com.sample
Will this project have Flex or JavaFX user interface? (flex, javafx): [javafx]
javafx
What kind of database are you using? (hsql, mysql, oracle, postgres, mssql, db2, sybase, none): [hsql]
hsql
Enter the JDBC URL for your database (e.g. jdbc:hsqldb:.): [jdbc:hsqldb:.]
jdbc:hsqldb:.
Enter database username: [sa]
sa
Enter database password: []
Do you want to update the database schema each time you deploy? (y, n): [y]
y
Enter the entity class name (Flex source files to view and modify entities will be generated as well): [Person]
Person
....
....
  1. Once generation is completed, go to javafx-spring/web and run this command: ant -f build.xml create-keyEntry
  2. Go one level up to javafx-spring/web and run: mvn package
  3. Copy javafx-spring/web/target/javafx-spring.war to Tomcat
    8) Start Tomcat
  4. Go to http://localhost:8080/javafx-spring and start the JavaFX applet.

You will see an application shown below:

Login screen:
screenshot_002

Main screen (before entering users):
screenshot_003

Adding a user:
screenshot_004

Main screen with users:
screenshot_005

© 2008 SYS-CON Media