If you are familiar with Grails, Groovy and you have a need of a desktop application, the Griffon Framework is the best solution.
Griffon Framework is based on the MVC pattern of desktop application development platform for the JVM. This is an open source framework that uses the Groovy language and following many Grails conventions.
The recommended way to create a Griffon project is using Lazybones utility and Gradle build system. Lazybones allows you to create a project structure for any framework or library based on a template. In order to register templates for Griffon, you need to edit the config file %USERPROFILE%/.lazybones/config.groovy in the following way:
Then you appear able to run the command to create a project template:
During the execution of the command it is necessary to enter the:
- group name (org.example);
- artifact id (griffon-javafx-groovy-sample);
- version (0.1.0-SNAPSHOT);
- griffon version (2.9.1);
- package name (org.example);
- class name (Home).
That will have a project with the following structure:
The main part of the Griffon project is in the griffon-app folder. For general configuration one can use griffon-app/conf/Config.groovy. Here is a typical example of it:
Models, Views and Controllers are located in models, views and controllers folders respectively.
Here is a typical example of Model:
where @ArtifactProviderFor(GriffonModel) serves as an additional hint to the compiler that lets one know if it is expected to generate or update a metadata file in an specific location; @FXObservable creates plain field as bindable property.
Here is a typical example of View:
where @MVCMember injects references to the other portions of the MVC triad if fields named model, view and controller are present in the Model, Controller or View; @Nonnull checks the object on NULL.
Here is a typical example of Controller:
Each Griffon project has its own life cycle. The folder contains lifecycle phase. Every phase has an associated lifecycle class that is invoked at the appropriate time.
To run the project, you must execute command gradle run.