JavaFX CRUD generation example with Flamingo

Exadel Flamingo provides a set of commands that help a developer to generate initial code. To bootstrap a project, a developer answers a few questions in a wizard. Based on these questions, a standard project is generated. Flamingo is based on Maven, therefore the new application is generated according to Maven conventions, making it easy for people familiar with Maven to navigate through the project.

The generated code provides all the necessary plumbing and connectivity from JavaFX (and Flex) to Seam or Spring. A developer only needs to focus on business functionality; Flamingo takes care of the rest. All communications between the user interface and Seam or Spring components are taken care of by Exadel Flamingo. Let’s see an examples with JavaFX.

Steps

1. Download and unzip Flamingo
2. Run FlamingoInstall/bin/mvn-install-javafx. This step adds JavaFX libs to your local Maven repository
3. Run FlamingoInstall/bin/flamingoinstall
4. Run FlmaingoInstall/bin/flamingo create project. You will be asked a number of questions. My answers are in bold:


max@Salsa:~/Exadel/Flamingo/flamingo-1.8.1$ ./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.1:create-project] (aggregator-style)
[INFO] ————————————————————————
[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-seam]
flamingo-seam
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-seam]
javafx-seam
Please enter the root package name for your project (e.g. com.mydomain.myproject): [sample]
javafx.example
Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support)? (ear, war): [war]
war
Will this project have Flex or JavaFX user interface? (flex, javafx): [javafx]
javafx
Will this project use Seam Remoting or Flamingo servlets? (servlets, remoting, both): [servlets]
servlets
————————————————————————————-
G e n e r a t i n g A n d r o M D A P o w e r e d A p p l i c a t i o n
————————————————————————————-
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/build.txt’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/flamingoproject.properties’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/java/pom.xml’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/javafx/pom.xml’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/java/src/main/java/javafx/example/javafx/ILoginAction.java’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/java/src/main/java/javafx/example/javafx/LoginClient.java’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/java/src/main/java/javafx/example/javafx/ServiceFactory.java’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/javafx/src/main/javafx/javafx/example/javafx/customnodes/TableNode.fx’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/javafx/src/main/javafx/javafx/example/javafx/FXClient.fx’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/javafx/src/main/javafx/javafx/example/javafx/LoginForm.fx’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/pom.xml’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/readme.txt’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/build.xml’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/pom.xml’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/security.properties’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/java/javafx/example/service/AuthenticatorAction.java’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/resources/seam.properties’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/webapp/hello.jsp’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/webapp/index.html’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/webapp/jnlp/javafx-seam.jnlp’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/webapp/WEB-INF/components.xml’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/webapp/WEB-INF/jboss-web.xml’
Output: ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/web/src/main/webapp/WEB-INF/web.xml’
————————————————————————————-
New application generated to –> ‘file:/home/max/Exadel/Flamingo/dev/javafx-seam/’
————————————————————————————-
[INFO] ————————————————————————
[INFO] BUILD SUCCESSFUL
[INFO] ————————————————————————
[INFO] Total time: 57 seconds
[INFO] Finished at: Wed Jun 17 11:23:07 PDT 2009
[INFO] Final Memory: 12M/81M
[INFO] ————————————————————————
max@Salsa:~/Exadel/Flamingo/flamingo-1.8.1$

5. Go to javafx-seam/web and run this command to sign the jar files: ant -f build.xml create-keyEntry
6. In the same directory, run mvn package
7. Almost done. Copy javafx-seam>/web/target/javafx-seam.war to JBoss Application Server (jbossas/server/default/deploy).
8. Start the server
9. In browser, go to http://localhost:8080/javafx-seam.
10. That’s it, enjoy.

11 thoughts on “JavaFX CRUD generation example with Flamingo

  1. Hi Max,

    I tried your example on Mac OSX. Unfortunately it seems not to run.
    The war archive is deployable without any error in application server log, but the javafx- servlet does not show any control.
    The same jboss- instance and example- war installed on a windows box works fine.
    I used the library versions you mentioned.

    Before, I tried to install the seam- javafx- examples of flamingo-1.8 on my Mac, using a newer version of seam, with the same result.

    Do you have a suggestion or is there an issue ?

    Thanks in forward

    Rainer

  2. >>but the javafx- servlet does not show any control.
    What do you mean the javafx-servlet doesn’t show any control? What do you see in the browser? Any errors?

    >>Before, I tried to install the seam- javafx- examples of flamingo-1.8 on my Mac, >>using a newer version of seam, with the same result.
    Do you mean you tried running “flaming create project” on Mac OS?

  3. Hi Max,

    >> What do you see in the browser? Any errors?
    After the initialization of the applet there is only a plain grey area inside the page below the title. (the output area of the applet without any contents).
    I tried it with safari, firefox and omni-web browsers. There are no errors, neither in browser nor in jboss log. Browser status displays: “Applet org.jdesktop.applet.util.JNLPAppletLauncher started”
    JBoss- log:
    [Contexts] starting up: org.jboss.seam.security.identity
    [Contexts] starting up: org.jboss.seam.web.session

    >> Do you mean you tried running “flaming create project� on Mac OS?
    I tried to run the mavenized project “../flamingo-1.8.1/examples/seam-javafx-helloworld” using
    maven 2.1, javafx 1.2, seam 2.1.1.GA, jboss 4.2.3

  4. I uploaded the war- archive and java- console- output to drop.io/flamingo_crud_osx. I built the archive with source level 1.5 when I saw in console output, that the jre 5 was launched. No change of behaviour.

  5. We deployed the war file and the application started successfully. It could be a problem with Java plug-in in the browser. Description and solution are here: http://weblogs.java.net/blog/cayhorstmann/archive/2008/09/applet_dragging.html . I had the same problem on Ubuntu. I don’t know if the same problem exists on Mac OS, but it’s something it try.

    One more thing to try:

    Launch Firefox and input following string in address location:

    about:plugins

    Page with information about plugin will displayed.
    If correct plugin is used you should to see next information.

    Java(TM) Plug-in 1.6.0_14

    File name: libnpjp2.so

    If you see something else, there is a problem with Java pug-in in Firefox.

  6. After trying several configurations in my opinion this issue is caused by a problem in the mac osx java framework.
    Firefox for mac osx does not use a link on a java library as libnpjp2.so, but the JavaEmbeddingPlugin, that redirects the osx java configuration to Firefox.
    Although I set the preferences for Java-Applet-Plugin to highest priority for Java SE6, the osx launcher starts Java SE 5 in our case.
    This happens for jnlp- descriptors for javafx- applets with jse version 1.5 , as in the example invoked inside a jsp- context.
    A similar jnlp- descriptor for javafx- applets, launched directly in os, is executed with JSE 6.

    I am using Java Developer Preview 5 (July 8, 2009 Build 9M3086)
    In the release notes there is an item
    ‘Areas to Test: Changing the preferred version ordering in Java Preferences with bundled Java applications.’
    So I think there may be an issue within this build.

    I tried your hints for configuring FirFox on GentOs (Redhat Linux Distribubtion) and the test- war- archive worked fine too.

    Perhaps I have wait until there is a fix from apple or a description how to address mime types of applets besides setting jse version in jnlp- descriptor.

    Thanks for your quick response. I like the possility to use javafx- applets inside a seam application.

  7. Thanks for the update. Keep us posted if you find out anything else. One thing is definitely true, Sun (soon Oracle) need to make JavaFX deployment much simpler.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s