{"id":2279,"date":"2010-10-18T11:39:50","date_gmt":"2010-10-18T09:39:50","guid":{"rendered":"https:\/\/test.viaboxx.de\/2010\/10\/18\/griffon-faster-groovy-desktop-development\/"},"modified":"2021-08-11T10:27:19","modified_gmt":"2021-08-11T10:27:19","slug":"griffon-faster-groovy-desktop-development","status":"publish","type":"post","link":"https:\/\/www.viaboxx.de\/en\/blog\/griffon-faster-groovy-desktop-development\/","title":{"rendered":"Griffon \u2013 Faster Groovy Desktop Development"},"content":{"rendered":"\n<p>I needed an installable desktop application based on existing Java logic, where the technology should fit in our portfolio. We are mainly based around Java enterprise and web development. Working with Grails I thought it would be a great idea to use Groovy also for the desktop application. With this search I found Griffon, which Fabian also evaluated at the beginning of the year.<\/p>\n\n\n\n<p>After working on the last two evenings with this framework I\u2019m really amazed. Without any real experience with Swing my app is running, packaged for Windows as .exe, for Mac as .dmg. It is the same speed effect you have when working with Rails or Grails for web applications \u2013 but now for the desktop. In combination with IntelliJ IDEA and its Jetgroovy plugin it really makes fun. And that\u2019s what it\u2019s all about.<\/p>\n\n\n\n<p>Don\u2019t believe it? Let\u2019s create your installable desktop application in 10min. Description for Mac user (but similar on Windows).<\/p>\n\n\n\n<p><strong>1. Download Griffon<\/strong><\/p>\n\n\n\n<p>Go to the Griffon <a href=\"http:\/\/griffon.codehaus.org\/Download\">download page<\/a> and download e.g. <a href=\"http:\/\/dist.codehaus.org\/griffon\/griffon\/0.9.x\/griffon-0.9-bin.zip\">version 0.9 as binary zip<\/a>.<\/p>\n\n\n\n<p><strong>2. Extract Griffon<\/strong><\/p>\n\n\n\n<p>Extract Griffon e.g. to \/Library\/DevLibs\/griffon-0.9 (our location for frameworks like Maven, Grails, \u2026)<\/p>\n\n\n\n<p><strong>3. Configure environment and path<\/strong><\/p>\n\n\n\n<p>I\u2019m managing my environment in .bash_profile where I need to add the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-code notranslate\"><code>export GRIFFON_HOME=\/Library\/DevLibs\/griffon-0.9\nexport PATH=$GRIFFON_HOME\/bin:$PATH<\/code><\/pre>\n\n\n\n<p>And now you can open the Terminal.<\/p>\n\n\n\n<p><strong>4. Create app<\/strong><\/p>\n\n\n\n<p>Go to our project directory and type:<\/p>\n\n\n\n<pre class=\"wp-block-code notranslate\"><code>griffon create-app<\/code><\/pre>\n\n\n\n<p>You will be prompted to enter your application name:<\/p>\n\n\n\n<pre class=\"wp-block-code notranslate\"><code>Welcome to Griffon 0.9 - http:\/\/griffon.codehaus.org\/\nLicensed under Apache Standard License 2.0\nGriffon home is set to: \/Library\/DevLibs\/griffon-0.9\n \nBase Directory: \/Users\/simon\/Projekte\nResolving dependencies...\nDependencies resolved in 1320ms.\nRunning script \/Library\/DevLibs\/griffon-0.9\/scripts\/CreateApp_.groovy\nEnvironment set to development\nApplication name not specified. Please enter:\nviaboxx<\/code><\/pre>\n\n\n\n<p><strong>5. App layout<\/strong><\/p>\n\n\n\n<p>If you are familiar with Grails, it is nothing new to you:<\/p>\n\n\n\n<p>griffon-app<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>conf: Configuration scripts (yeah, scriptable configuration)<\/li><li>controllers: Your controller classes which are tightly coupled with the view classes<\/li><li>i18n: Your properties-files (in UTF-8 like in Grails \u2013 unlike Java)<\/li><li>lifecycle: Some scripts classes to hook into the lifecycle<\/li><li>models: Your model definitions<\/li><li>resources: Images and other stuff<\/li><li>views: Your view classes<\/li><\/ul>\n\n\n\n<p>lib (fix dependencies, better use Ivy and configure dependencies in griffon-app\/conf\/BuildConfig.groovy)<\/p>\n\n\n\n<p>scripts<\/p>\n\n\n\n<p>src (other sources)<\/p>\n\n\n\n<p><strong>6. Modify app<\/strong><\/p>\n\n\n\n<p>To modify your newly created application go to griffon-app\/views\/viaboxx\/ViaboxxView.groovy<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[codesyntax lang=\"groovy\"]\n&lt;pre>package viaboxx\n \napplication(title: 'viaboxx',\n  pack: true,\n  locationByPlatform:true,\n  iconImage: imageIcon('\/griffon-icon-48x48.png').image,\n  iconImages: [imageIcon('\/griffon-icon-48x48.png').image,\n               imageIcon('\/griffon-icon-32x32.png').image,\n               imageIcon('\/griffon-icon-16x16.png').image]) {\n    panel() {\n        borderLayout()\n \n        hbox(constraints:NORTH) {\n            textField(id: \"nameInput\",\n                    columns: 10,\n                    actionPerformed: {controller.textEntered()})\n            button(text: \"Entered\",\n                    actionPerformed: {controller.textEntered()})\n \n        }\n        label(constraints:SOUTH,\n                id: \"outputLabel\",\n                text: \"Enter name above\")\n    }\n}&lt;\/pre>\n[\/codesyntax]<\/pre>\n\n\n\n<p>And the matching controller: griffon-app\/controllers\/viaboxx\/ViaboxxController<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[codesyntax lang=\"groovy\"]\n&lt;pre>package viaboxx\n \nclass ViaboxxController {\n \/\/ these will be injected by Griffon\n def model\n def view\n \n def textEntered = {\n view.outputLabel.text = \"Hello World, ${view.nameInput.text}\"\n }\n}&lt;\/pre>\n[\/codesyntax]<\/pre>\n\n\n\n<p><strong>7. Run app<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted notranslate\"><strong><code><strong>griffon run-app<\/strong><\/code><\/strong><\/pre>\n\n\n\n<p>Easy, isn\u2019t it. And the groovy builder syntax is so short and sexy.<\/p>\n\n\n\n<p><strong>8. Package app<\/strong><\/p>\n\n\n\n<p>You need to install a plugin (there are a lot of great plugins available)<\/p>\n\n\n\n<pre class=\"wp-block-code notranslate\"><code>griffon install-plugin installer<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code notranslate\"><code>griffon package mac<\/code><\/pre>\n\n\n\n<p>Find the result in the folder <strong>dist<\/strong>. There are a lot of other package modes available. Including ZIP, RPM, EXE, \u2026<\/p>\n\n\n\n<p><strong>9. More Infos<\/strong><\/p>\n\n\n\n<p>Official page: <a href=\"http:\/\/griffon.codehaus.org\/\">http:\/\/griffon.codehaus.org\/<\/a><\/p>\n\n\n\n<p>Documentation: <a href=\"http:\/\/dist.codehaus.org\/griffon\/guide\/index.html\">http:\/\/dist.codehaus.org\/griffon\/guide\/index.html<\/a><\/p>\n\n\n\n<p>Installer plugin: <a href=\"http:\/\/docs.codehaus.org\/display\/GRIFFON\/Installer+Plugin\">http:\/\/docs.codehaus.org\/display\/GRIFFON\/Installer+Plugin<\/a><\/p>\n\n\n\n<p>Quick Start: <a href=\"http:\/\/griffon.codehaus.org\/Quick+Start\">http:\/\/griffon.codehaus.org\/Quick+Start<\/a><\/p>\n\n\n\n<p>Sample apps: <a href=\"http:\/\/mikusa.blogspot.com\/2009\/04\/griffon-applications.html\">http:\/\/mikusa.blogspot.com\/2009\/04\/griffon-applications.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I needed an installable desktop application based on existing Java logic, where the technology should fit in our portfolio. We are mainly based around Java enterprise [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[76],"tags":[],"class_list":["post-2279","post","type-post","status-publish","format-standard","hentry","category-code"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Simon Tiffert","author_link":"https:\/\/www.viaboxx.de\/en\/blog\/author\/simon-tiffertviaboxx-de\/"},"uagb_comment_info":0,"uagb_excerpt":"I needed an installable desktop application based on existing Java logic, where the technology should fit in our portfolio. We are mainly based around Java enterprise [&hellip;]","_links":{"self":[{"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/posts\/2279"}],"collection":[{"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/comments?post=2279"}],"version-history":[{"count":3,"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/posts\/2279\/revisions"}],"predecessor-version":[{"id":7079,"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/posts\/2279\/revisions\/7079"}],"wp:attachment":[{"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/media?parent=2279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/categories?post=2279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.viaboxx.de\/en\/wp-json\/wp\/v2\/tags?post=2279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}